Skip to content

Instantly share code, notes, and snippets.

@NullEntity
Created March 8, 2013 09:07
Show Gist options
  • Save NullEntity/5115178 to your computer and use it in GitHub Desktop.
Save NullEntity/5115178 to your computer and use it in GitHub Desktop.
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