Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "TeamSwitch"
#define VERSION "1.0"
#define AUTHOR "SweatyBanana"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /ct", "TEAMCT")
register_clcmd("say_team /ct", "TEAMCT")
register_clcmd("say /t", "TEAMT")
register_clcmd("say_team /t", "TEAMT")
register_clcmd("say /spec", "SPEC")
register_clcmd("say_team /spec", "SPEC")
}
public TEAMCT( id )
{
if(cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(1, print_chat, "[TEAMS] You are already on the CT team.")
return PLUGIN_HANDLED
}
if(cs_get_user_team(id) != CS_TEAM_CT)
{
return PLUGIN_CONTINUE
}
else
{
new name[32]
get_user_name(id,name,31)
if(is_user_alive(id)) user_kill(id)
cs_set_user_team ( id, CS_TEAM_CT, CS_CT_URBAN)
client_print(0, print_chat, "[TEAMS] %s has switched himself to the CT team.", name)
}
return PLUGIN_CONTINUE
}
public TEAMT( id )
{
if(cs_get_user_team(id) == CS_TEAM_T)
{
client_print(1, print_chat, "[TEAMS] You are already on the TERRORIST team.")
return PLUGIN_HANDLED
}
if(cs_get_user_team(id) != CS_TEAM_T)
{
return PLUGIN_CONTINUE
}
else
{
new name[32]
get_user_name(id,name,31)
if(is_user_alive(id)) user_kill(id)
cs_set_user_team ( id, CS_TEAM_T, CS_T_TERROR)
client_print(0, print_chat, "[TEAMS] %s has switched himself to the CT team.", name)
}
return PLUGIN_CONTINUE
}
public SPEC( id )
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
{
client_print(1, print_chat, "[TEAMS] You are already on the TERRORIST team.")
return PLUGIN_HANDLED
}
if(cs_get_user_team(id) != CS_TEAM_SPECTATOR)
{
return PLUGIN_CONTINUE
}
else
{
new name[32]
get_user_name(id,name,31)
if(is_user_alive(id)) user_kill(id)
cs_set_user_team ( id, CS_TEAM_SPECTATOR)
client_print(0, print_chat, "[TEAMS] %s has switched himself to the SPECTATORS", name)
}
return PLUGIN_CONTINUE
}
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "round_money"
#define VERSION "1.0"
#define AUTHOR "Me"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("round_money", "16000")
register_event("ResetHUD", "roundMoney", "be")
}
public roundMoney(id)
{
new Players[32]
new playerCount, i
get_players(Players, playerCount, "b")
for (i=0; i<playerCount; i++)
{
new player = Players[i]
new money = cs_get_user_money (player)
new cVar = get_cvar_num("round_money")
if(money < cVar)
{
cs_set_user_money (player, cVar, 1) // sets users money to round_money and flashes the update
}
}
return PLUGIN_CONTINUE
}