PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <colorchat>
#define PLUGIN "First Writes"
#define VERSION "2.0"
#define AUTHOR "AFarSeX"
new Started = false;
new const MinNum = 0
new const MaxNum = 9999
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR
)
register_clcmd("amx_firstwrites", "first_writes")
register_clcmd("amx_roshem", "first_writes")
register_clcmd("say /roshem", "first_writes")
register_clcmd("say /fw", "first_writes")
register_clcmd("say", "FirstPerson")
}
public plugin_precache()
{
precache_sound("fvox/one.wav")
precache_sound("fvox/two.wav")
precache_sound("fvox/three.wav")
precache_sound("fvox/four.wav")
precache_sound("fvox/five.wav")
}
public cmdTransfer(id) {
cs_set_user_team(id, CS_TEAM_CT)
spawn(id)
return PLUGIN_HANDLED;
}
public first_writes(id)
{
if(Started)
{
ColorChat(id, RED, "^x04You Need To Wait Untill First Writes Will Over")
return PLUGIN_HANDLED;
}
else if(is_user_admin(id))
{
set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
show_hudmessage(0, "First Writes Start In 5 Sec")
client_cmd(0, "spk ^"fvox/five.wav^"")
set_task(1.0, "four")
}
return PLUGIN_HANDLED;
}
public four()
{
set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
show_hudmessage(0, "First Writes Start In 4 Sec")
client_cmd(0, "spk ^"fvox/four.wav^"")
set_task(1.0, "three")
}
public three()
{
set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
show_hudmessage(0, "First Writes Start In 3 Sec")
client_cmd(0, "spk ^"fvox/three.wav^"")
set_task(1.0, "two")
}
public two()
{
set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
show_hudmessage(0, "First Writes Start In 2 Sec")
client_cmd(0, "spk ^"fvox/two.wav^"")
set_task(1.0, "one")
}
public one()
{
set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 );
show_hudmessage(0, "First Writes Start In 1 Sec")
client_cmd(0, "spk ^"fvox/one.wav^"")
set_task(1.0, "StartFirstWrites")
}
public StartFirstWrites()
{
Started = random_num(MinNum, MaxNum);
set_hudmessage(0, 225, 0, -1.0, -1.0, 0, 4.5, 4.5)
show_hudmessage(0, "The First Write %d Move To Ct Team", Started)
return PLUGIN_HANDLED;
}
public FirstPerson(id)
{
if(cs_get_user_team(id) == CS_TEAM_T && Started)
{
new Write[32], Winner[32]
read_argv(1, Write, charsmax(Write))
num_to_str(Started, Winner, charsmax(Winner))
if(equal(Write, Winner))
{
new szWinner[32]
get_user_name(id, szWinner, charsmax(szWinner))
set_hudmessage(0, 255, 0, -1.0, 0.40, 2, 5.0, 8.0, 0.0, 0.0, 10)
show_hudmessage(0, "%s Won And Moved To Ct Team", szWinner)
cmdTransfer(id)
Started = false
}
}
else if(!Started)
{
new Write[32], Lose[32]
read_argv(1, Write, charsmax(Write))
num_to_str(Started, Lose, charsmax(Lose))
if(equal(Write, Lose))
{
cs_set_user_team(id, CS_TEAM_CT)
Started = false
}
}
}