• need help with a timer
    2 replies, posted
[lua]function kickthatplayer(ply) local en = ents.FindInSphere(self.Entity:GetPos(), 300) for _, v in pairs(en) do if self.Owner:GetOwner(self.Entity) then self.Owner:ChatPrint("hi") end end end timer.Create( "pref_" .. ply:UniqueID()'', 2, 0, kickthatplayer)[/lua] i get this ERROR] addons/nlr kicker/lua/entities/nlr_kicker/init.lua:37: attempt to index global 'ply' (a nil value) can someone halp me please
with that grammar, i doubt you made it but anyway here: [lua] function kickthatplayer(ply) local en = ents.FindInSphere(self.Entity:GetPos(), 300) ply = LocalPlayer() for _, v in pairs(en) do if self.Owner:GetOwner(self.Entity) then self.Owner:ChatPrint("hi") end end end timer.Create( "pref_" .. ply:UniqueID()'', 2, 0, kickthatplayer) [/lua] you need to define ply
[QUOTE=tyguy;39256956]with that grammar, i doubt you made it but anyway here: [lua] function kickthatplayer(ply) local en = ents.FindInSphere(self.Entity:GetPos(), 300) ply = LocalPlayer() for _, v in pairs(en) do if self.Owner:GetOwner(self.Entity) then self.Owner:ChatPrint("hi") end end end timer.Create( "pref_" .. ply:UniqueID()'', 2, 0, kickthatplayer) [/lua] you need to define ply[/QUOTE] that diddnt work it say attempt to index global 'ply' (a nil value) [editline]17th January 2013[/editline] what i am trying to do is set a timer with different names so i dont have to use [lua]ENT:Think()[/lua]
Sorry, you need to Log In to post a reply to this thread.