• TTT ULX respawn, is it possible?
    3 replies, posted
This is the respawn command i've been working on for ulx and i can't seem to get it to work correctly. Now it respawns correctly and even removes the targets corpse but, if they were a traitor and identified, when they are respawned there name is now highlighted in red as a traitor and thats really not what i want. I want it to be as if they never died. [LUA] --[Global Helper Functions][Used by more than one command.]------------------------------------ --[[send_messages][Sends messages to player(s)] @param {[PlayerObject]} v [The player(s) to send the message to.] @param {[String]} message [The message that will be sent.] --]] function send_messages(v, message) if type(v) == "Players" then v:ChatPrint(message) elseif type(v) == "table" then for i=1, #v do v[i]:ChatPrint(message) end end end --[[corpse_find][Finds the corpse of a given player.] @param {[PlayerObject]} v [The player that to find the corpse for.] --]] function corpse_find(v) for _, ent in pairs( ents.FindByClass( "prop_ragdoll" )) do if ent.uqid == v:UniqueID() and IsValid(ent) then return ent or false end end end --[[corpse_remove][removes the corpse given.] @param {[Ragdoll]} corpse [The corpse to be removed.] --]] function corpse_remove(corpse) CORPSE.SetFound(corpse, false) if string.find(corpse:GetModel(), "zm_", 6, true) then corpse:Remove() elseif corpse.player_ragdoll then corpse:Remove() end end --[End]---------------------------------------------------------------------------------------- --[Respawn]------------------------------------------------------------------------------------ --[[ulx.respawn][Respawns <target(s)>] @param {[PlayerObject]} calling_ply [The player who used the command.] @param {[PlayerObject]} target_plys [The player(s) who will have the effects of the command applied to them.] @param {[Boolean]} should_silent [Hidden, determines weather the output will be silent or not.] --]] function ulx.respawn( calling_ply, target_plys, should_silent ) if not GetConVarString("gamemode") == "terrortown" then ULib.tsayError( calling_ply, gamemode_error, true ) else local affected_plys = {} for i=1, #target_plys do local v = target_plys[ i ] if ulx.getExclusive( v, calling_ply ) then ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true ) elseif GetRoundState() == 1 then ULib.tsayError( calling_ply, "Waiting for players!", true ) elseif v:Alive() then ULib.tsayError( calling_ply, v:Nick() .. " is already alive!", true ) else local corpse = corpse_find(v) if corpse then corpse_remove(corpse) end v:SetTeam( TEAM_TERROR ) v:Spawn() v:SetCredits( ( (v:GetRole() == ROLE_INNOCENT) and 0 ) or GetConVarNumber("ttt_credits_starting") ) table.insert( affected_plys, v ) end end ulx.fancyLogAdmin( calling_ply, should_silent ,"#A respawned #T!", affected_plys ) send_messages(affected_plys, "You have been respawned.") end end local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn" ) respawn:addParam{ type=ULib.cmds.PlayersArg } respawn:addParam{ type=ULib.cmds.BoolArg, invisible=true } respawn:defaultAccess( ULib.ACCESS_SUPERADMIN ) respawn:setOpposite( "ulx srespawn", {_, _, true}, "!srespawn" ) respawn:help( "Respawns <target(s)>." ) --[End]---------------------------------------------------------------------------------------- [/LUA] This will be part of a pack of commands that will be released on ulx, i'm just doing a whole bunch of updates to the commands before release.
[url]http://steamcommunity.com/sharedfiles/filedetails/?id=127865722&searchtext=ttt+ulx[/url]
[lua]local CATEGORY_NAME = "TTT" function ulx.respawn( calling_ply, target_plys ) for i=1, #target_plys do target_plys[ i ]:SpawnForRound( true ) end ulx.fancyLogAdmin( calling_ply, "#A respawned #T", target_plys) end local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn" ) respawn:addParam{ type=ULib.cmds.PlayersArg } respawn:defaultAccess( ULib.ACCESS_ADMIN ) respawn:help ( "<user(s)> - Respawns target(s)." )[/lua] This works as well.
[QUOTE=Chef Ramsey;40839005][url]http://steamcommunity.com/sharedfiles/filedetails/?id=127865722&searchtext=ttt+ulx[/url][/QUOTE] Yh if you look at the creators of those commands you will see that i'm listed as one of them :P [editline]30th May 2013[/editline] [QUOTE=bluemist;40839282][lua]local CATEGORY_NAME = "TTT" function ulx.respawn( calling_ply, target_plys ) for i=1, #target_plys do target_plys[ i ]:SpawnForRound( true ) end ulx.fancyLogAdmin( calling_ply, "#A respawned #T", target_plys) end local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.respawn, "!respawn" ) respawn:addParam{ type=ULib.cmds.PlayersArg } respawn:defaultAccess( ULib.ACCESS_ADMIN ) respawn:help ( "<user(s)> - Respawns target(s)." )[/lua] This works as well.[/QUOTE] Hmmmm, ill take a look and see what exactly that does.
Sorry, you need to Log In to post a reply to this thread.