Jump to content

admin tools menu , sorta.


JonSyn

Recommended Posts

i need sleep im not even looking at what im doing, thatll just add it to the suburbsDistribution

ideally what id want to do is just spawn items into crates/shelfs/counters within the admins location anyway

Link to comment
Share on other sites

im looking at Rand - RandomSelector()  on here http://projectzomboid.com/modding/index-files/index-18.html

basically what im trying to do is choose a random item from a list, then also a random amount of that item

 

this here works, spawns a Axe at players feet.

function Spawner() --this is the function that would add the loot in game	local world = getPlayer():getCurrentSquare(); -- Get the players location on map i think.	local loot = "Base.Axe"; -- i could probably remove this line and just have local item = "Base.Axe";	local item = loot; -- Grab the name of the item.	world:AddWorldInventoryItem(item, 0.0, 0.0, 0.0); --Add the item to the ground by player, still need to figure out how to move it farther from player ..	getPlayer():Say("working maybe!"); -- just so i know something happened when i clicked my button.end

and this is what id like to do, its wrong, but its the basic idea i guess.

function Random() -- chooses random item. dosnt work lol    {"Base.RollingPin"},    {"Base.Fork" },    {"base.Axe" }endfunction Spawner() --this is the function that would add the loot in game	local world = getPlayer():getCurrentSquare(); -- Get the players inventory.	local loot = Random();	local item = loot; -- Grab the name of the item.	world:AddWorldInventoryItem(item, 0.0, 0.0, 0.0); --Add the item to the inventory.	getPlayer():Say("working maybe!");end

it should pick 1 of the 3 items in the Random fuction, dosnt but thats basicly how id like to do it.

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");

The setText is used when you hit "y" to speak globally, as you can see, I do a : ISChat.instance.textEntry:setText meaning I set the text of the text entry, and the text entry is the little box where you type your text to say.

So this line just mean "I'll add a "/all " in the front of my chat box"

Anyway, For the random part, I suggest that you read some lua tutorial, but here's how you could do it properly :

Having a table first :

tableItem = {} -- init the table

function createTable() -- fill the table (could be done outside any function tbh)

table.insert(tableItem, "Base.Axe"); -- basic lua "how to insert stuff into a table"

table.insert(tableItem, "Base.OtherStuff");

end

function random() --pick a random thing

local randomThing = tableItem[ZombRand(#tableItem)+1];

end

And there you go, let me quickly explain the weird line : tableItem[ZombRand(#tableItem)+1]

To access an element in my table I need to do stuff like myTable[1] or myTable[2] (it start at 1, not 0, screw you lua :D)

The ZombRand(x) function give me a number between 0 and x - 1.(so if I do ZombRand(2) I could have 0 or 1)

The #tableItem give me the size of the table (be careful, it works only with table, not dictionnary, lua sucks TOTALLY for this, i mean, really... bah, almost it's only bad thing !)

And if you remember, the number start at 1 and my randomize at 0, so I do a +1.

Not sure it's totally clear, but try to play with this, and if you doesn't already, check some lua tutorial and maybe some pz tutorial on pz-mods.

Don't worry, it's easy as pie, I've been there some time ago ;)

Link to comment
Share on other sites

thanks RobertJohnson im gunna mess with it some more in a few hours, my eyes are killing me and my liver too lol

i tried creating a sperate lua with the table in it

ItemList = {}local table = table;ItemList.randItems = {	items = {		"Base.Axe",		"Base.Fork",		"Base.RollingPin",	},

then calling it from my admin tools.lua

function selectItems()		return table.getRndValue(ItemList.randItems.items);	endfunction Spawner() --this is the function that would add the loot in gamelocal string = string;local table = table;	local world = getPlayer():getCurrentSquare(); -- Get the current map area your on.	local loot = selectItems();	local item = loot; -- Grab the name of the item.	world:AddWorldInventoryItem(item, 0.0, 0.0, 0.0); --Add the item to the inventory.			getPlayer():Say("working maybe!");end

but it errors in the console on the         "return table.getRndValue(ItemList.randItems.items);" line

 

had to take a break after that lol.

 

moved on to other things and come back to it , sometimes it helps me catch something i missed.

 

gunna look over your way and see what i can do, appreciate the info/help man.

 

if you'd like i can upload my latest copy of it for you to see, dirty as hell tho, but it works.

Link to comment
Share on other sites

i actually found getRndValue in a old  mod that used it , i just adapted it hoping to have luck.

about to get back to work on the admin tools and try your way, i learned more from looking thru the games lua files then anything else .

i had never thought to look through the ISFishingAction.lua tho. i been thru alot of the other files, helped me out  a great deal.

but yeah looking at what you posted and im sure i understand it, my main issue with stuff is i need and example of hw it works, from there i can figure everything out. but im gunnna go mess with my tools and see if i can get it going and add in the randomized loot spawner ( best i could come up with for a name) then try to evolve it into spawning in crates /shelfs/book cases/etc as i go.

Link to comment
Share on other sites

yeah but doesn't it only spawn in during a map start?

im looking at doing it mid game without restarting, basically just click a button and it puts items selected from a list into the nearest container. but i dont know if its possible.

Link to comment
Share on other sites

i got it ,i got it, i got it!!!!

it spawns items from a huge list i broke up into sections, weapons,farming,food,clothes,carpentry.

now i have to get it to spawn the items into nearby containers instead of on  the ground around me and also maybe a chance of not spawning a item at all and maybe a random amount of each item.

looking at ItemPicker.lua for a way to do it, thats where i found the stuff for what i have so far .

 

thanks for the help so far RobertJohnson ,RoboMat and EnigmaGrey .

Link to comment
Share on other sites

sooooooooooooooo.......

ran into a snag with my random world loot item spawner, it spawns it in a random area around me but you have to go to where i stood when i spawned it to pick it up, it wont show in the loot menu if u goto the icon on the ground.

function Spawner() --this is the function for the button that would add the loot in game    for i = 1, 3 do    local item = catagory(); --get random catagory for the item list. 	local world = getPlayer():getCurrentSquare(); -- Get the current map area your on.        local test_x = ZombRabd(0,10); --random x        local test_y = ZombRabd(0,10); --random y	world:AddWorldInventoryItem(item, test_y, test_x, 0.0); --Add the item to the ground.    end		getPlayer():Say("Dropped loot!");end

im guessing its because of "getPlayer():getCurrentSquare();" because to pick up the item you have to go back to where i stood when i dropped the items. still haven't figured out spawning into containers either but not worried about it.

Link to comment
Share on other sites

What's this ZombRabd ? :P

 

Again, add multiple print everywhere instead of "getPlayer():Say()

function Spawner() --this is the function for the button that would add the loot in game    for i = 1, 3 do    local item = catagory(); --get random catagory for the item list.    print("item : " .. item);    local world = getPlayer():getCurrentSquare(); -- Get the current map area your on.    if world then     print("square is ok");    else     print("square missing !"); -- can't really happend    endlocal test_x = ZombRabd(0,10); --random x -- sure it's not ZombRand ?local test_y = ZombRabd(0,10); --random y    print("x : " .. test_x .. ", y : " .. test_y);    world:AddWorldInventoryItem(item, test_y, test_x, 0.0); --Add the item to the ground.    print("item added");end    end
Link to comment
Share on other sites

 

What's this ZombRabd ? :P

 

Again, add multiple print everywhere instead of "getPlayer():Say()

function Spawner() --this is the function for the button that would add the loot in game    for i = 1, 3 do    local item = catagory(); --get random catagory for the item list.    print("item : " .. item);    local world = getPlayer():getCurrentSquare(); -- Get the current map area your on.    if world then     print("square is ok");    else     print("square missing !"); -- can't really happend    endlocal test_x = ZombRabd(0,10); --random x -- sure it's not ZombRand ?local test_y = ZombRabd(0,10); --random y    print("x : " .. test_x .. ", y : " .. test_y);    world:AddWorldInventoryItem(item, test_y, test_x, 0.0); --Add the item to the ground.    print("item added");end    end

lol yeah its zombrand i couldnt get it to paste in so i retyped it all, its correct in the lua tho.

 

i used to be able to use the debugger online and now i cant get it to close once it opens, so i been trying to do it without it

 

basically i end up checking if the files all load with out error thru the console on game start, then i watch console for whatever error it kicks back if a line dosn't work right , then i follow it back to where i find my mistake. hard way of doing things but when im only working on one line at a time its pretty easy to find my error.

Link to comment
Share on other sites

well my teleportation menu is done, i can choose from 9 different locations in each city and teleport there. makes it alot easier for admining when i need to find a hacker base or get to a player for any reason.

 

so far it has 5 different sections,

Admin Hacks - addxp to admin,unlimited build, fast destroy,invisibility,god mode and a warp.

Admin Controls - Gunshot,Chopper launcher, random item spawn on ground, start/stop rain, and thunder.

Zambie Spawner - spawn hordes in 20,50,200,500,700 and 900 groups.

Teleporter - gives you the ability to spawn in 27 different areas across 3 different citys.

Item Spawner - just a small list of stuff admins can spawn. things from melee weapons to guns/ammo and farming/carpentry/fishing.

its also not useable on Single Player or by non-Admins. what happens if you try to use it in SP or as a normal user hacking? well its not good lol.

also most the buttons use the admin commands so it logs the admins actions to the log folder in admin.txt so server owners can monitor what there Admins are doing.

 

think i may upload a copy today.

Link to comment
Share on other sites

another question, is there a way to collect data for all objects in a given area ? i have figured out how to delete zombies in MP and wanna evolve it from a single click for each zombie to a button press to clear a area.

Link to comment
Share on other sites

yet another question, i been looking for where i can pull a users ip address, like when you ban ip any clue where i might find it? was hoping to find it in ISScoreboard.lua but all i find is ip=true.

Link to comment
Share on other sites

got a question, is it possible to get the coordinates of a player in MP, like say i wanted someone elses coords, is there anyway to do it in a function based off username?

Would like to now this as well. Curious how this could work, testing the whole day but as of now =>no success.

Link to comment
Share on other sites

 

got a question, is it possible to get the coordinates of a player in MP, like say i wanted someone elses coords, is there anyway to do it in a function based off username?

Would like to now this as well. Curious how this could work, testing the whole day but as of now =>no success.

 

 

 

 

what is it your doing can i ask?

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