upload your code somewhere and then it'll be easier to help you to find your errors and to get your mod working.
Anyway, I suggest making a global table:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
ranks = {['user']={}, ['moderator'] = {}}
there you could store player names
then you may have another table with tables of kits:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
kits = (['user']={itemstring1, itemstring2, etc}, ['moderator']={itemstring1, itemstring2, etc})
Then register your command and do smth like this:
(note, that any chat commandhave "name" var that stores invoker's name)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
for i,group in ipairs(ranks) do
if group[name] then
local player = minetest.get_player_by_name(name)
local inv = player:get_inv()
for j,item in ipairs(kits[group]) do
inv:add_item(ItemString(item))
end
break
end
end
Code above is just an example, I'm sure I have syntax errors there.