TTT has some Lua hooks of its own, besides the default GMod hooks. They are used in the same way.
TTTPrepareRound (no parameters) Shared Called when the "Preparing" phase begins. TTTBeginRound (no parameters) Shared Called when Traitors/Detectives have been selected and the round is active. TTTEndRound (result) Shared Called when the round ends. The "result" parameter will be equal to one of the values: WIN_TRAITOR, WIN_INNOCENT or WIN_TIMELIMIT. So if result == WIN_TRAITOR, the Traitors have won the round. The "result" parameter currently only exists on the server even though the hook is shared. It will always be nil on the client. If you need the round result on the client, you will have to send it yourself. TTTDelayRoundStartForVote (no parameters) Server Called just before starting the Preparation phase. If this hook returns true, the start of that phase will be delayed by 30 seconds. You can use this for custom map voting systems and such. By default it is used to prevent new rounds from starting while a Fretta vote is occurring. TTTScoreboardColorForPlayer (ply) Client Called to determine what colour a player's name should be on the scoreboard. Hence, it must return a Color object, or return nil (or nothing at all). The "ply" parameter contains a player object, so you can for example check the player's SteamID and give certain people a special colour. Note that TTT also uses this hook for the default colours, so you should return nil for players that you do not want to do anything special with. TTTPlayerRadioCommand (ply, cmd_name, cmd_target) Server Called when a player tries to use a quickchat/radio command. If this hook returns true, the command will not be sent, ie. it will get blocked. You can use this for anti-spam measures or to replace or modify a message. The "ply" parameter is of course the player using the command, "cmd_name" is the identifier of the command (such as "quick_yes" for the "Yes." command), and "cmd_target" is the target part of the command (an entity index if it's a player or identified corpse, an identifier like "quick_nobody" if not). |