JonSyn Posted April 26, 2014 Share Posted April 26, 2014 so im working on a menu that lets me just click a button when i wanna launch choppers or gunshots or help, also a few othere things to make admining easier for me, but im stuck on the chat aspect right now... it has othere features but im only posting the section for the /help .i tried this elseif feature == "Help" then getPlayer():Say("/help"); but instead of using as it would if i typed it into chat it shows it over my characters head . i aslo tried elseif feature == "Help" then player:Say("/help"); but that returns a error in console.-------------------------------------------------------------attempted index: Say of non-table: null-----------------------------------------STACK TRACE-----------------------------------------function: SpawnTools -- file: tools.lua line # 96function: onMouseUp -- file: ISButton.lua line # 55attempted index: Say of non-table: null-----------------------------------------STACK TRACE-----------------------------------------function: SpawnTools -- file: tools.lua line # 96function: onMouseUp -- file: ISButton.lua line # 55im new to lua and not so good yet, so if i could get a push in the right direction id be very appreciative . Nero 1 Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 26, 2014 Share Posted April 26, 2014 Erm. player is a variable.player needs to be assigned a value, else it is null.Properly it's player = getPlayer(), which itself may prove inadequate having moved to MP coding. getSpecificPlayer(IsoPlayer) is probably the safer bet, which means using an Event that provides the player for you. Then you can simply go player:Say("text"), assuming Say() is the correct method in IsoPlayer. Link to comment Share on other sites More sharing options...
JonSyn Posted April 26, 2014 Author Share Posted April 26, 2014 with the "/" it causes an error in the client console tho with player:Say("/help"), what i want it to do is use it as if i was typing /help into the chat box .so it'll show the help text in the chat. and if i change it to elseif feature == "Help" then player = getPlayer() player:Say("/help"); it justs says /help over my characters head. Link to comment Share on other sites More sharing options...
RoboMat Posted April 26, 2014 Share Posted April 26, 2014 Well that's because the "Say(...)" functions is supposed to print text over the characters head ^^ You'll need to find the correct function for the chat. Link to comment Share on other sites More sharing options...
JonSyn Posted April 26, 2014 Author Share Posted April 26, 2014 im currently reading tutorials and programming in Lua (first edition) so hopefully i come across something. Link to comment Share on other sites More sharing options...
RoboMat Posted April 26, 2014 Share Posted April 26, 2014 You should also look through the source code and the javadocs (although I'm not sure when they last have been updated): http://theindiestone.com/zomboidjavadocs/ JonSyn 1 Link to comment Share on other sites More sharing options...
JonSyn Posted April 26, 2014 Author Share Posted April 26, 2014 thanks ill add it to the list , got alot of stuff to read thru now. Link to comment Share on other sites More sharing options...
JonSyn Posted April 27, 2014 Author Share Posted April 27, 2014 FIGURED IT OUT!!i can launch choppers, fire gunshots, start and stop rain with a click of a button now Link to comment Share on other sites More sharing options...
JonSyn Posted April 27, 2014 Author Share Posted April 27, 2014 its not pretty yet but it works. booner352 1 Link to comment Share on other sites More sharing options...
JonSyn Posted April 27, 2014 Author Share Posted April 27, 2014 just gunna continue my thread here......looking to change my buttons from text based to png icons, im thinking i need to change alot of what im doing to do this.if anyone could help that'd be great Link to comment Share on other sites More sharing options...
JonSyn Posted April 29, 2014 Author Share Posted April 29, 2014 (edited) alright, so no one seems to be interested, but ill keep posting im looking for a way to destroy player built walls and doors and windows and etc.not by using a sledge hammer or axe, but by clicking and having a destroy item menu option.i can do the menu option but not sure how to destroy the selected item by a click.would be nice to have for the hacker built garbage some server hosts find (my self included).any ideas on it? edit :i dont think i made myself clear enough, maybe i did, but im looking for a way to destroy intently on click, i can make the menu option but nothing happens yet. is there a way to set damage to 0? i guess thats the idea here, mostly i want it to just vanish and leave no planks or nails. a little push would help but im sure ill figure it out alone. but thanks for any help Edited April 29, 2014 by JonSyn Link to comment Share on other sites More sharing options...
Nero Posted April 29, 2014 Share Posted April 29, 2014 Keep up the good work, will make my job a lot easier ^^ as when loot and and zeds run dry, typing is a huge chore AliceCooper and JonSyn 2 Link to comment Share on other sites More sharing options...
JonSyn Posted April 29, 2014 Author Share Posted April 29, 2014 your on Alices server aint ya?so you seen what i have so far?its ugly but helps alot for me anyway AliceCooper 1 Link to comment Share on other sites More sharing options...
AliceCooper Posted April 29, 2014 Share Posted April 29, 2014 Went to sleep before i could talk to Nero. Let me just say i build an admin test base in about 5 minutes lol. No more commands, thanks for letting me test this Jon Creative-mode is the sh***t! /Lets get drunk on Skype again tonight! Link to comment Share on other sites More sharing options...
JonSyn Posted April 29, 2014 Author Share Posted April 29, 2014 im on man right now login.the creative mode was pulled from a hack i found, not sure who did it but soon as i can verify that line of code to its creater ill post who it is. Link to comment Share on other sites More sharing options...
JonSyn Posted May 1, 2014 Author Share Posted May 1, 2014 it can now destroy walls/doors/windows/tables/etc with no waisted time.and it can be toggled on/off.now to make it so it checks if the person is an admin before allowing it to be used by them.any ideas on that? Link to comment Share on other sites More sharing options...
badtrix Posted May 1, 2014 Share Posted May 1, 2014 i was just about to post you an idea on how to destroy walls etc., but i have no idea on how to check for admin. But i came across a function called isClient() in ISInventoryTransferAction.lua, maybe there is a similar function to check if isServer(). But i did not check what isClient() actually does, so this might also totally wrong what im posting Link to comment Share on other sites More sharing options...
JonSyn Posted May 1, 2014 Author Share Posted May 1, 2014 i got the item spawner, the events, god mode and invisability and the zombie spawner all so you have to be admin to use, still working on making the build and destroy parts admin use only. nasKo 1 Link to comment Share on other sites More sharing options...
JonSyn Posted May 2, 2014 Author Share Posted May 2, 2014 100% admin use only now !! !! !! !! !! !! !! !! Link to comment Share on other sites More sharing options...
JonSyn Posted May 2, 2014 Author Share Posted May 2, 2014 i have added a line that cause sever damage to non admins who use it and says "I AM A HACKER, I AM USING ADMIN TOOLS BY: JonSyn TO HACK ON YOUR SERVER." and "I JUST TRYED TO USE INVISIBILITY PLEASE IP BAN ME!!!!!!!!!!!!!!!!", difrent for every button, but it says it locally, i cant find a global chat command. could use a lil help. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted May 2, 2014 Share Posted May 2, 2014 /all is the global command? Link to comment Share on other sites More sharing options...
JonSyn Posted May 2, 2014 Author Share Posted May 2, 2014 /all is yeah, but when i try SendCommandToServer("/all hello world");i get the /all hello world is a unknown command in the chat window. with SendCommandToServer("/all", "hello world");i get the /all is a unknown command in the chat window. getPlayer():Say("/all", "hello world");does nothing but give me a error in console for that line.same with getPlayer():Say(command, "/all", "hello world"); and about a dozen other ways iv tried. after looking over the index and ISChat.lua . Link to comment Share on other sites More sharing options...
JonSyn Posted May 3, 2014 Author Share Posted May 3, 2014 giving up on the global chat for now......lol its annoying me, and im sure its sooooooooo simple im just missing it. the next step is to find a way to distribute items throughout the map at a low chance while in game.im sure something like...table.insert(SuburbsDistributions["all"]["crate"].items,"Base.Axe");table.insert(SuburbsDistributions["all"]["crate"]["items"],1.1);wont work in game. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted May 3, 2014 Share Posted May 3, 2014 You can't use Say() for what you think you can. It can only take one variable ( a single string of text). Packing several into that function will rightly give you errors.So, I'll do this once.Grab a program like NotePad++ that allows you to get all the matching strings within a series of files.For example, search for SendCommandToServer gives me . . . C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid\media\lua\client\ISUI\ISChat.lua (1 hit) Line 108: SendCommandToServer(command); C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid\media\lua\client\OptionScreens\ISScoreboard.lua (5 hits) Line 68: SendCommandToServer("/kickuser " .. username); Line 70: SendCommandToServer("/banuser " .. username); Line 72: SendCommandToServer("/banuser " .. username .. " ip=true"); Line 74: SendCommandToServer("/godmod " .. username); Line 76: SendCommandToServer("/invisible " .. username);What, potentially, can we gather from this? From line 108, we see that SendCommandToServer only takes 1 paramemter (command). Any attempts to stuff more down its gullet will be futile.Lines 68 through 76 indcate that /all may not be a valid command for this function, as it is never referenced in the Lua code. This doesn't necessarily mean this is true, as this is only the Lua code, not the Java code.How about we search for /all in all files, then.Well, look here: C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid\media\lua\client\ISUI\ISChat.lua (3 hits) Line 100: if luautils.stringStarts(command, "/all") and ServerOptions.getBoolean("GlobalChat") then Line 101: local message = luautils.trim(string.gsub(command, "/all", "")); Line 175: ISChat.instance.textEntry:setText("/all ");So, it wasn't getPlayer():say(String), or SendCommandToServer(String) After all! All this time, /all was referencing ISChat.lua! But what does all the rest of that do? . . . Link to comment Share on other sites More sharing options...
JonSyn Posted May 3, 2014 Author Share Posted May 3, 2014 local item = button.internal; SendCommandToServer('/additem "' .. item);thats how i spawn items.... was why i used it to do global, i knew it wouldn't work since /all isnt in the list of commands.i had already gone thru all those earlier. C:\Program Files (x86)\Steam\SteamApps\common\ProjectZomboid\media\lua\client\ISUI\ISChat.lua (3 hits) Line 100: if luautils.stringStarts(command, "/all") and ServerOptions.getBoolean("GlobalChat") then Line 101: local message = luautils.trim(string.gsub(command, "/all", "")); Line 175: ISChat.instance.textEntry:setText("/all ");this is where i get lost as im still new to all this and i don't understand line 100, or 101 and 175 for that matter.well i guess i under stand them a bit but i don't get how to use that to get global chat . i use notepad++ :cool:wonder.....issetText("/all ");what im looking for? and would it be something like...setText("/all ", "hello world");orsetText("/all hello world");on a sidenote, would this work to force distribute new loot in game?require "Items/SuburbsDistribution";function Spawner() --this is the function that would add the loot in gametable.insert(SuburbsDistributions["all"]["crate"].items,"Base.Axe");table.insert(SuburbsDistributions["all"]["crate"]["items"],1.1);end elseif feature == "Items" then --this would be linked to the feature button not shown Spawner(); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now