Taken from my coderhire addon:
function ulx.forcerespawn( calling_ply, target_plys )
if GetConVarString("gamemode") == "terrortown" then
for k, v in pairs( target_plys ) do
if v:Alive() then
v:Kill()
v:SpawnForRound( true )
else
v:SpawnForRound( true )
end
end
else
for k, v in pairs( target_plys ) do
if v:Alive() then
v:Kill()
v:Spawn()
else
v:Spawn()
end
end
end
ulx.fancyLogAdmin( calling_ply, "#A respawned #T", target_plys )
end
local forcerespawn = ulx.command( "Utility", "ulx forcerespawn", ulx.forcerespawn, { "!forcerespawn", "!frespawn"} )
forcerespawn:addParam{ type=ULib.cmds.PlayersArg }
forcerespawn:defaultAccess( ULib.ACCESS_ADMIN )
forcerespawn:help( "Force-respawn a player." )