[ULX] TTT Change roles: Traitor, Detective, Innocent. Respawning Script

What thread is sopposed to be named:

**[ULX] TTT Change roles: Traitor, Detective, Innocent. Respawning Script **

So I have looked around the internets and found some code and tried to update for GMOD13. Currently it changes them automatically right then and there. Aim is to try and do it so it changes them for next round. It has worked for me so far so here it is:

(I have commented out the respawning because it is really a bad idea in TTT)-Edit: Nevermind. Comments dont show in C/P


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)." )

function ulx.traitor( calling_ply, target_plys )
        for i=1, #target_plys do
                target_plys[ i ]:SetRole(ROLE_TRAITOR)
        end
        ulx.fancyLogAdmin( calling_ply, "#A set  #T as a traitor", target_plys)
        SendFullStateUpdate()
end
local traitor = ulx.command( CATEGORY_NAME, "ulx traitor", ulx.traitor, "!traitor" )
traitor:addParam{ type=ULib.cmds.PlayersArg }
traitor:defaultAccess( ULib.ACCESS_ADMIN )
traitor:help( "<user(s)> - Turns target(s) into traitors." )

function ulx.detective( calling_ply, target_plys )
        for i=1, #target_plys do
                target_plys[ i ]:SetRole(ROLE_DETECTIVE)
        end
        ulx.fancyLogAdmin( calling_ply, "#A set #T as a detective", target_plys)
        SendFullStateUpdate()
end
local detective = ulx.command( CATEGORY_NAME, "ulx detective", ulx.detective, "!detective" )
detective:addParam{ type=ULib.cmds.PlayersArg }
detective:defaultAccess( ULib.ACCESS_ADMIN )
detective:help( "<user(s)> - Turns target(s) into detectives." )

function ulx.innocent( calling_ply, target_plys )
        for i=1, #target_plys do
                target_plys[ i ]:SetRole(ROLE_INNOCENT)
        end
        ulx.fancyLogAdmin( calling_ply, "#A set #T as a innocent", target_plys)
        SendFullStateUpdate()
end
local innocent = ulx.command( CATEGORY_NAME, "ulx innocent", ulx.innocent, "!inncoent" )
innocent:addParam{ type=ULib.cmds.PlayersArg }
innocent:defaultAccess( ULib.ACCESS_ADMIN )
innocent:help( "<user(s)> - Turns target(s) into innocents." )

By the way, if you couldn’t figure out from the code, the commands are !respawn [user] !traitor [user] !detective [user] !innocent [user]

The !respawn commands are pretty useless because if a traitor dies and is identified then everyone knows they’re a traitor. Traitors also use the fact of an RDM to help them along and they might have been trying to get the person RDM’d all along. I feel it would be a waste of time but just felt like giving my input…

Good luck.

Ya thats why I commented it out at first but the comments do not show up when I copied and pasted it :stuck_out_tongue:

I am working off this code to make a donator option to pay points (pointshop) and choose who they are next round. The problem is going to be the random pick TTT has. I am not sure if this will mess it up or not. If it does it will take a while to fix

And this is not dumb!!! I am sad now :frowning:

This is just a rip of the addon posted on the workshop. If you are going to post something, make sure its your own

Not that I know of. I found this code (outdated) online. I updated it and plan on changing it for my use. I am working on other plugins/addons right now so I have not started on it. Will post it when I am done with it.

If you do not know what I am changing read the post -_-

Awful idea but again good luck.