• Help with find in sphere
    6 replies, posted
Hello yet again! Quick question for anyone willing to help, should the following work? concommand.Add( "tod_activate", function( ply, cmd, args ) if ply:IsUserGroup( "superadmin" ) then plypos = ply:GetPos() print(ents.FindInSphere( plypos, 10 )) else end end ) I'm simply trying to test if ents.FindInSphere actually works, so I can make the function kill any player within that sphere however I am certain i've done this very wrong so I apologize if it's yet another stupid question, but I can only learn with simple questions. If anyone wants to go the extra mile to help me, and i'd appreciate it greatly, could you direct me through making any player within said radius die?
have you tried running it?
Why of course, i'm not that new
concommand.Add( "tod_activate", function( ply, cmd, args )     if ply:IsValid() and ply:IsSuperAdmin() then     --if the console of a dedicated server ran this ply would be a null entity and thus cause an error     --ply:IsSuperAdmin() returns true if the player is also a ulx rank the inherits from superadmin         for k,ent in ipairs(ents.FindInSphere(ply:GetPos(), 10 )) do             if ent:IsValid() and ent:IsPlayer() then                 ent:Kill()             end         end     end end ) try this
Whoops, posted wrongly there :/ sorry But yeah, that looks good except i'm getting this error... 'in' expected near 'inipairs'
C'mon now, put in some effort. It should be "in ipairs" Facepunch code tags are bad, but you should be able to tell how the words in and ipairs are different colors.
Surprisingly, I didn't notice that. Apologies. I would appreciate it if you had a little more patience with my stupidity, but I don't want to start anything considering you did afterall just help me so thank you
Sorry, you need to Log In to post a reply to this thread.