• Ulx TTT respawn.
    8 replies, posted
Alright so i've got a basic respawn command at the moment but i want the body of the target(s) to be removed and there data hidden again. [LUA]function ulx.respawn( calling_ply, target_plys ) if GetConVarString("gamemode") == "terrortown" then 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 ) else v:SetTeam( TEAM_TERROR ) v:Spawn() table.insert( affected_plys, v ) end end ulx.fancyLogAdmin( calling_ply, "#A has respawned #T!", affected_plys ) else ULib.tsayError( calling_ply, "The current gamemode is not trouble in terrorest town", true ) end 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( "Respawns target(s)." )[/LUA] Any ideas? also what does this piece of code actually do, for most commands i just leave it in? [LUA] if ulx.getExclusive( v, calling_ply ) then ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )[/LUA]
This is what I did on my server to respawn people: [lua]function ulx.tttrespawn( calling_ply, target_ply, reason ) local r = target_ply:GetRole() target_ply:SetTeam(TEAM_TERROR) target_ply:Spawn() target_ply:SetRole(r) ulx.fancyulxLogAdmin( calling_ply, "#A respawned #T", target_ply ) end local tttrespawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.tttrespawn, "!respawn" ) tttrespawn:addParam{ type=ULib.cmds.PlayerArg } tttrespawn:defaultAccess( ULib.ACCESS_ADMIN ) tttrespawn:help( "Respawns target." )[/lua]
What does target_ply:SetRole(r) do then?
It makes sure that if you respawn a T that he will remain a T. Some for the other roles ofc
I'm testing the current code, and the code that you just recommended, and theres no difference, i will keep it the way it is, and if there's any problems i will add it in.
I think you're pretty much screwed here. As you can see in traitor_state.lua, all the information the innocents know about traitors is sent via a usermessage. Unless you can somehow manage to find how clients store this information and then edit it you won't be able to make such a command. Either way, There is no possible way to do this only from a ulx command file.
Hmmmm, fine fine, i'm sure i can remove the ragdoll before they've identified it. Any idea how to get the entity of the dead player's body? not ideal, but better than nothing i guess.
I think something to the effect of ply.ragdoll_ent Check corpse.lua near the bottom.
I'm now currently creating a pack of ttt commands that are available for download. I've made significant progress with the respawn command, and have been able to identify the targets ragdoll and then remove it. I will hopefully be able to do this for their weapons as well. Besides that, if the player dies again, their second corpse/ragdoll ends up becoming a server crasher. I end up with this error before a server crash: Crazy physics on [171][prop_physics] [Ang:-1.#IND00,1.#QNAN0,180.000000] [Pos:-1.#IND00,-1.#IND00,1.#QNAN0] - removing This is the code for the respawn command: [LUA]---------------------------------------------Respawn----------------------------------------------- function ulx.respawn( calling_ply, target_plys, should_silent ) if GetConVarString("gamemode") == "terrortown" then 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 ) else for _, ent in pairs( ents.FindByClass( "prop_ragdoll" )) do if ent.uqid == v:UniqueID() then ent:Remove() end end v:SetTeam( TEAM_TERROR ) v:Spawn() table.insert( affected_plys, v ) end if not should_silent then ulx.fancyLogAdmin( calling_ply, "#A has respawned #T!", affected_plys ) else ulx.fancyLogAdmin( calling_ply, true ,"#A has respawned #T!", affected_plys ) if v ~= calling_ply then v:ChatPrint("You have been respawned.") end end end else ULib.tsayError( calling_ply, "The current gamemode is not trouble in terrorest town", true ) 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:help( "Respawns target(s)." ) respawn:setOpposite( "ulx srespawn", {_, _, true}, "!srespawn" )[/LUA] Any ideas why this is happening and how to fix it? Extra information: I was recieving this error before i removed the players old ragdoll. This error occurs when the respawned player eventually dies.
Sorry, you need to Log In to post a reply to this thread.