PHP Code:
// INCLUDES
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
new bool:g_bFreeRound,
bool:g_bUsedButton,
g_synced
public plugin_init()
{
register_plugin( "Free Round without Vote", "1.0", "xPaw" );
register_clcmd( "say /free", "CmdFreeRound" )
register_clcmd( "say /freeround", "CmdFreeRound" )
RegisterHam( Ham_Use, "func_rot_button", "FwdHamUse_Button" )
RegisterHam( Ham_Use, "func_button", "FwdHamUse_Button" )
RegisterHam( Ham_Use, "button_target", "FwdHamUse_Button" )
register_event( "CurWeapon", "EventCurWeapon", "be", "1=1", "2!29" )
register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" )
register_event( "TextMsg", "EventRestart", "a", "2&#Game_C", "2&#Game_w" )
g_synced = CreateHudSyncObj( )
}
public EventNewRound( ) {
g_bFreeRound = false
g_bUsedButton = false
}
public EventRestart( ) {
g_bFreeRound = false
g_bUsedButton = false
}
public EventCurWeapon( id ) {
if(!g_bFreeRound)
return
engclient_cmd( id, "weapon_knife" )
ColorChat( id, RED, "^4[Free Round]^1 Free Round = No traps, No weapons." )
}
public CmdFreeRound( id ) {
if( g_bUsedButton ) {
ColorChat( id, RED, "^4[Free Round]^1 You have already used a trap, you cannot do a free round anymore!")
return PLUGIN_HANDLED
}
if( g_bFreeRound ) {
ColorChat( id, RED, "^4[Free Round]^1 It is already a free round!")
return PLUGIN_HANDLED
}
if( cs_get_user_team( id ) != CS_TEAM_T ) {
ColorChat( id, RED, "^4[Free Round]^1 Only trappers have access to this command!")
return PLUGIN_HANDLED
}
new szName[ 32 ]
get_user_name( id, szName, charsmax( szName ) )
set_hudmessage( 255, 255, 155, -1.0, 0.15, 1, 0.5, 1.0, 0.5, 15.0, -1)
ShowSyncHudMsg( 0, g_synced, "- Free Round -^nNo traps, No weapons" )
ColorChat( 0, RED, "^4[Free Round]^1 Free round has been started by^4 %s", szName )
g_bFreeRound = true
return PLUGIN_CONTINUE
}
public FwdHamUse_Button( iEntity, id, iActivator, iUseType, Float:flValue ) {
if ( cs_get_user_team(id) != CS_TEAM_CT) {
if ( !g_bUsedButton && !g_bFreeRound) {
g_bUsedButton = true
ColorChat( id, RED, "^4[Free Round]^1 You lost your privilege to call for a free round." )
return HAM_IGNORED
} else if ( g_bFreeRound ) {
ColorChat( id, RED, "^4[Free Round]^1 Free Round = No traps, No weapons." )
return HAM_SUPERCEDE
}
}
return HAM_IGNORED
}