General > Developers Corner

ULX Respawn

(1/1)

Aceman9622:
Right, so I need help with my Jailbreak commands for respawning players in case they were RDMed. 
I use Excl's Jailbreak 7.


--- Code: ---function ulx.spawn( calling_ply, target_plys )
local affected_plys = {}
for k,v in pairs(target_plys) do
if !v:Alive() then
v:Spawn()
table.insert(affected_plys, v)
end
end
ulx.fancyLogAdmin( calling_ply, "#A respawned #T", affected_plys )
end
local spawn = ulx.command( "Utility", "ulx respawn", ulx.spawn, "!respawn" )
spawn:addParam{ type=ULib.cmds.PlayersArg }
spawn:defaultAccess( ULib.ACCESS_SUPERADMIN )
spawn:help( "Respawned target(s)." )
--- End code ---

Any help?  This code works, but when it respawns a player, it doesn't respawn them physically.  It sends them to a different living player in spectator mode.  Any idea on how to fix this?

Code was not written by me.

JamminR:
Might try looking at the two releases that already include respawn code and learn from them.
Player Force Spawn
or
Trouble in Terrorist Town Commands for ULX

The second one even has a respawntp (respawn to where admin pointing)

Aceman9622:
Hm, the Force Respawn doesn't seem to work.  I've tried, but I think Excl's Jailbreak prevents it.  Possibly?

JamminR:
If the Jailbreak gamemode overwrites any standard Gmod functions, then it's quite possible, yes.
That's one nice thing about the Gamemode library though, the ability to change the default actions.
It can just cause issues like you are experiencing with 3rd party additions though.

Navigation

[0] Message Index

Go to full version