hello there i am working a command but it is haveing the following error
Timer Error: ...odes\darkrp\entities\entities\sent_backpack\init.lua:217: attempt to index global 'self' (a nil value)
here is the code [lua] function withdraw(ply, args)
if args == "" then return "" end
if not tonumber(args) then
return ""
end
local amount = math.floor(tonumber(args))
if amount <= 1 then
Notify(ply, 1, 4, string.format(LANGUAGE.invalid_x, "argument", ""))
return ""
end
if not ply:CanAfford(amount) then
Notify(ply, 1, 4, string.format(LANGUAGE.cant_afford, ""))
return ""
end
timer.Simple(1, function(ply)
if ValidEntity(ply) then
local SpawnPos = self.Entity:GetPos() + self.Entity:GetForward() * -20
SpawnPos.z = SpawnPos.z + 70
DarkRPCreateMoneyBag(SpawnPos, amount)
end
end, ply)
return ""
end
AddChatCommand("/withdraw", withdraw)
[/lua]
all i whant it to do is creat that money bag without any problems could u help me out here plox .....
thx for ur time
Where do you suppose self magically appears from?
ok fixed Thx
Sorry, you need to Log In to post a reply to this thread.