It would be very nice to have a option that can be used to restrict PlayerArg and PlayersArg to players which fit some things.
Example:
I have a respawn Command. Let's called it ulx respawn.
And I want it that you can only target players that are dead.
So that users where Player:Alive() returns false aren't displayed.
Something like:
local function targets()
local pl = {}
for k,v in pairs(player.GetAll()) do
if not v:Alive() then table.insert(pl, v) end
end
return pl
end
function ulx.respawn( calling_ply, target_ply)
target_ply:Spawn()
ulx.fancyLogAdmin( calling_ply, "#A respawned #T", affected_plys, dmg )
end
local respawn = ulx.command("Util", "ulx respawn", ulx.respawn, "!respawn" )
respawn:addParam{ type=ULib.cmds.PlayerArg, autocomplete_fn=targets }
respawn:defaultAccess(ULib.ACCESS_ADMIN)
respawn:help( "Respawns target." )
If this is already possible and I just missed something, then tell me what.
Thanks.