Jump to content

admin tools menu , sorta.


JonSyn

Recommended Posts

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 # 55

im new to lua and not so good yet, so if i could get a push in the right direction id be very appreciative .

Link to comment
Share on other sites

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

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

alright, so no one seems to be interested, but ill keep posting (fedora)

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 by JonSyn
Link to comment
Share on other sites

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

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 :P

Link to comment
Share on other sites

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

/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

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

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

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.....is

setText("/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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...