I coded 4 new buttons for the
ULX admin addon.
[li]Respawn - Respawns a player. Can be very helpful in RDM cases.[/li]
[li]Traitor - Turns a player into a traitor.[/li]
[li]Detective - Turns a player into a detective.[/li]
[li]Innocent - Turns a player into an innocent.[/li]
Download:
http://hotfile.com/dl/65736743/cfcf4e8/ttt.lua.htmlPut the file in:
/garrysmod/addons/ulx/lua/ulx/modules/ttt.lua
The code in case the file host deletes the file sometime (ttt.lua):
--[[
Title: TTT
Some TTT related functions (respawn,traitor,detective,innocent)
Made by Oren Yomtov (thenameisoren at gmail)
]]
ulx.setCategory( "TTT" )
function ulx.cc_respawn( ply, command, argv, args )
if #argv < 1 then
ULib.tsay( ply, ulx.LOW_ARGS, true )
return
end
local targets, err = ULib.getUsers( argv[ 1 ], _, true, ply ) -- Enable keywords
if not targets then
ULib.tsay( ply, err, true )
return
end
for _, v in ipairs( targets ) do
ulx.logUserAct( ply, v, "#A respawned #T" )
v:SpawnForRound(true)
end
end
ulx.concommand( "respawn", ulx.cc_respawn, "<user(s)> - Respawns target(s).", ULib.ACCESS_ADMIN, "!respawn", _, ulx.ID_PLAYER_HELP )
ulx.addToMenu( ulx.ID_MCLIENT, "Respawn", "ulx respawn" )
function ulx.cc_traitor( ply, command, argv, args )
if #argv < 1 then
ULib.tsay( ply, ulx.LOW_ARGS, true )
return
end
local targets, err = ULib.getUsers( argv[ 1 ], _, true, ply ) -- Enable keywords
if not targets then
ULib.tsay( ply, err, true )
return
end
for _, v in ipairs( targets ) do
ulx.logUserAct( ply, v, "#A turned #T into a traitor" )
v:SetRole(ROLE_TRAITOR)
SendFullStateUpdate()
end
end
ulx.concommand( "traitor", ulx.cc_traitor, "<user(s)> - Turns target(s) into traitors.", ULib.ACCESS_ADMIN, "!traitor", _, ulx.ID_PLAYER_HELP )
ulx.addToMenu( ulx.ID_MCLIENT, "Traitor", "ulx traitor" )
function ulx.cc_detective( ply, command, argv, args )
if #argv < 1 then
ULib.tsay( ply, ulx.LOW_ARGS, true )
return
end
local targets, err = ULib.getUsers( argv[ 1 ], _, true, ply ) -- Enable keywords
if not targets then
ULib.tsay( ply, err, true )
return
end
for _, v in ipairs( targets ) do
ulx.logUserAct( ply, v, "#A turned #T into a detective" )
v:SetRole(ROLE_DETECTIVE)
SendFullStateUpdate()
end
end
ulx.concommand( "detective", ulx.cc_detective, "<user(s)> - Turns target(s) into detectives.", ULib.ACCESS_ADMIN, "!detective", _, ulx.ID_PLAYER_HELP )
ulx.addToMenu( ulx.ID_MCLIENT, "Detective", "ulx detective" )
function ulx.cc_innocent( ply, command, argv, args )
if #argv < 1 then
ULib.tsay( ply, ulx.LOW_ARGS, true )
return
end
local targets, err = ULib.getUsers( argv[ 1 ], _, true, ply ) -- Enable keywords
if not targets then
ULib.tsay( ply, err, true )
return
end
for _, v in ipairs( targets ) do
ulx.logUserAct( ply, v, "#A turned #T into an innocent" )
v:SetRole(ROLE_INNOCENT)
SendFullStateUpdate()
end
end
ulx.concommand( "innocent", ulx.cc_innocent, "<user(s)> - Turns target(s) into innocents.", ULib.ACCESS_ADMIN, "!innocent", _, ulx.ID_PLAYER_HELP )
ulx.addToMenu( ulx.ID_MCLIENT, "Innocent", "ulx innocent" )