So my problem is that i dont know why getElementData doesn`t accept string as name. Am I supposed to define it?
function gzkill(player, cmd, name, ammount)
local ammount = tonumber(ammount)
lpkills = getElementData(player, "zombieskilled")
pkills = getElementData(name, "zombieskilled")
akills = pkills + ammount
rkills = lpkills - ammount
local truename = getPlayerName(name)
if truename == name then
setElementData(name, "zombieskilled", akills)
setElementData(player, "zombieskilled", rkills)
outputChatBox("Sucessfully added!", getRootElement, 255, 255, 255, false)
else
outputChatBox("Wrong name!", getRootElement, 255, 255, 255, false)
end
end
addCommandHandler("idz", gzkill) --restricted
I ran command /idz healLV 10. And got this:
WARNING: zkillgive\main.lua:4: Bad argument @ 'getElementData' [Expected element at argument 1, got string 'healLV']
ERROR: zkillgive\main.lua:5: attempt to perform arithmetic on global 'pkills' (a boolean value)