Created
March 8, 2013 09:07
-
-
Save NullEntity/5115178 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
util.AddNetworkString( "BetchaOpenMenu" ) | |
local DisabledRoundStates = { ROUND_WAIT, ROUND_POST } | |
local function ParseChat( ply, msg ) | |
if msg ~= "/bet" then return msg end | |
if not ply:Alive() then | |
NotifyPlayer( ply, "You must be alive to place a bet!" ) | |
return | |
elseif ply:IsTraitor() then | |
NotifyPlayer( ply, "You can't place a bet when you're a traitor!" ) | |
return | |
elseif ply.bet ~= nil then | |
NotifyPlayer( ply, "You already placed a bet!" ) | |
return | |
elseif table.HasValue( DisabledRoundStates, GAMEMODE.roundstate ) then | |
NotifyPlayer( ply, "You can't do this right now!" ) | |
end | |
net.Start( "BetchaOpenMenu" ) | |
net.Send( ply ) | |
end | |
hook.Add( "PlayerSay", "BetchaParseChat", ParseChat ) | |
local function NotifyPlayer( ply, msg ) | |
ply:PrintMessage( HUD_PRINTTALK, "[Betcha] " .. msg ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment