• Returning all that are arrested
    5 replies, posted
I need a way to return all of the players that are currently arrested with isArrested() But im not sure on how to do it, can anyone help?
uhh [lua] function player.GetAllArrested() local arrestedplayers = { } for _, x in pairs( player.GetAll() ) do if x:isArrested() then table.insert( arrestedplayers, x ) end end return arrestedplayers end [/lua]
Wow, thanks a lot :) i really appriciate it Testing now Ok, so if i wanted to take all of those players by a " for k, v in pairs(_______) do " what would i put in the space
[lua] for _, x in pairs( player.GetAllArrested() ) do [/lua]
for k,v in pairs(player.GetAllArrested()) do ..ninja'd pairs() takes a table: player.GetAllArrested() returns a table
Alright, thanks guys
Sorry, you need to Log In to post a reply to this thread.