ULX

Author Topic: ULX Respawn  (Read 1687 times)

0 Members and 1 Guest are viewing this topic.

Offline Aceman9622

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
ULX Respawn
« on: June 24, 2015, 07:28:11 PM »
Right, so I need help with my Jailbreak commands for respawning players in case they were RDMed. 
I use Excl's Jailbreak 7.

Code: [Select]
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)." )

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.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Respawn
« Reply #1 on: June 24, 2015, 08:14:19 PM »
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)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Aceman9622

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: ULX Respawn
« Reply #2 on: June 25, 2015, 07:03:27 AM »
Hm, the Force Respawn doesn't seem to work.  I've tried, but I think Excl's Jailbreak prevents it.  Possibly?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Respawn
« Reply #3 on: June 25, 2015, 07:43:11 PM »
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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming