AN ERROR HAS OCCURED [the index 'WantedLevel' does not exist]

Started by Kewun, Aug 07, 2016, 07:08 AM

Previous topic - Next topic

Kewun

AN ERROR HAS OCCURED [the index 'WantedLevel' does not exist]

CALLSTACK
*FUNCTION [Arrest()] server.nut line [384]
*FUNCTION [onPlayerCommand()] server.nut line [279]

LOCALS
[target] 0
[player] INSTANCE
[this] TABLE
[text] "0"
[cmd] "arrest"
[player] INSTANCE
[this] TABLE


server.nut line 384:

if (target.WantedLevel <1) {
whole function:
function Arrest(player,target)
{
if (target.WantedLevel <1) {
MessagePlayer("This player is not wanted",player)
return false;
}
if (target.WantedLevel > 0) {
MessagePlayer("[#ffffff]Arrested "+targeet+" , you get $2500",player)
player.Cash += 2500;
target.WantedLevel = 0
Message("[#ffffff]Police "+player+ " has arrested "+target)
}
}

second line, 279 error, onPlayerCommand

Arrest(player,text.tointeger())
whole command:
if(cmd=="arrest")
{
if (!text) {
MessagePlayer("Use /arrest id",player)
return false;
}
Arrest(player,text.tointeger())
}