Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < amxmisc >
- #include < cstrike >
- #include < hamsandwich >
- #include < ColorChat >
- #define FW_ACCESS ADMIN_KICK
- new CTRounds[33] = 0
- new bool: FW_Started = false
- new FWTime
- new NumberSelected
- new bool: haramod
- public plugin_init()
- {
- register_clcmd("say","HandleSay")
- RegisterHam(Ham_Spawn,"player","PlayerRespawned", 1)
- set_task(10.0,"Ratio",_,_,_,"b")
- register_clcmd("say /fwwin", "fwwin")
- haramod = true
- }
- public Ratio()
- {
- new CTCounter, TCounter
- new players[32],pnum
- get_players(players,pnum)
- for(new i = 0;i<pnum;i++)
- {
- new cid = players[i]
- switch(cs_get_user_team(cid))
- {
- case CS_TEAM_T:
- {
- TCounter++
- }
- case CS_TEAM_CT:
- {
- CTCounter++
- }
- }
- }
- if(CTCounter == 0 && TCounter >= 2)
- {
- StartFWRatio()
- }
- else if(CTCounter == 1 && TCounter >= 11)
- {
- StartFWRatio()
- }
- else if(CTCounter == 2 && TCounter >= 16)
- {
- StartFWRatio()
- }
- else if(CTCounter == 3 && TCounter >= 21)
- {
- StartFWRatio()
- }
- }
- public PlayerRespawned(id)
- {
- if(!is_user_alive(id))
- {
- return 1;
- }
- if(cs_get_user_team(id) == CS_TEAM_CT)
- {
- if(CTRounds[id] == 9)
- {
- cs_set_user_team(id,CS_TEAM_T)
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- new szName[32];
- get_user_name(id,szName,31)
- ColorChat(0, 0,"^4[Extazza] ^3%s^1 his was^4 10 ^1rounds in CT.",szName)
- CTRounds[id] = 0
- StartFWRounds
- }
- else
- {
- CTRounds[id]++
- ColorChat(id, 0, "^4[Extazza] ^1You have been CT [^4%d^1/10] Rounds!",CTRounds[id])
- }
- }
- else
- {
- CTRounds[id] = 0
- }
- return 0;
- }
- public HandleSay(id)
- {
- new StrNumberSelected[22]
- num_to_str(NumberSelected,StrNumberSelected,21)
- new szMessage[128], szArg1[38],szArg2[38];
- read_argv(1, szMessage, charsmax(szMessage));
- parse(szMessage, szArg1, charsmax(szArg1),szArg2,charsmax(szArg2));
- if(equali(szArg1,"/fw") || equali(szArg1,"/first")|| equali(szArg1,"!first") || equali(szArg1,"!fw"))
- {
- if(get_user_flags(id) & FW_ACCESS)
- {
- StartFW(id)
- }
- }
- if(equali(szArg1,"/stopfw") || equali(szArg1,"!stopfw"))
- {
- if(get_user_flags(id) & FW_ACCESS)
- {
- StopFW(id)
- }
- }
- if(FW_Started && ! ( haramod ) )
- {
- if(equali(szArg1,StrNumberSelected))
- {
- if(cs_get_user_team(id) == CS_TEAM_T)
- {
- FW_Started = false
- set_hudmessage(0, 212, 255, -1.0, 0.28, 2, 0.02, 4.0, 0.01, 0.1, 1);
- new szName[32]
- get_user_name(id,szName,31)
- if(is_user_alive(id))
- cs_set_user_team(id,CS_TEAM_CT);
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- show_hudmessage(0,"%s, Won The First Write Contest! ^nAnd Moved To The Guards Team.",szName)
- ColorChat(0, 0,"^4[Extazza] ^3%s^4, Won The First Write!",szName)
- }
- else
- {
- ColorChat(id, 0,"^4[Extazza] ^1You are a^4 Guard^1 already!")
- }
- }
- }
- if(equali(szArg1,"/rounds"))
- {
- new player = cmd_target(id, szArg2, 0)
- if(!(player))
- {
- ColorChat(id, 0, "^4[Extazza] ^1There is no player named^3 %s^1",szArg2)
- return 1;
- }
- new szName[32]
- get_user_name(player,szName,31)
- if(cs_get_user_team(player) != CS_TEAM_CT)
- {
- ColorChat(id, 0, "^4[Extazza] ^1The player^3 %s^1 is not in CT team!",szName)
- return 1;
- }
- ColorChat(id, 0, "^4[Extazza] ^1The player^3 %s^1 Left^4 Rounds ^1[^4%d^1/10]^4 rounds!",szName,CTRounds[player])
- }
- return 0;
- }
- public StartFW(id)
- {
- if(!FW_Started)
- {
- FW_Started = true
- FWTime = 6
- set_task(1.0,"CheckTime",1992,_,_,"b")
- new szAdmin[32]
- get_user_name(id,szAdmin,31)
- ColorChat(0, 0, "^4[Extazza] ^1Admin^3 %s ^4started ^1the first writes",szAdmin)
- }
- else
- {
- ColorChat(id, 0, "^4[Extazza] ^1First writes is already ^4activated!")
- }
- return 1;
- }
- public StartFWRatio()
- {
- if(!FW_Started)
- {
- FW_Started = true
- FWTime = 6
- set_task(1.0,"CheckTime",1992,_,_,"b")
- ColorChat(0, 0, "^4[Extazza] ^1Auto^4 FirstWrite ^1started")
- }
- }
- public StartFWRounds()
- {
- if(!FW_Started)
- {
- FW_Started = true
- FWTime = 9
- set_task(1.0,"CheckTime",1992,_,_,"b")
- }
- }
- public StopFW(id)
- {
- if(FW_Started)
- {
- FW_Started = false
- new szName[32]
- get_user_name(id,szName,31)
- ColorChat(0, 0, "^4[Extazza] ^1Admin ^3%s ^4stopped ^1first writes!",szName)
- }
- else
- {
- ColorChat(id, 0, "^4[Extazza] ^1FirstWrite is not ^4activated!")
- }
- return 1;
- }
- public CheckTime()
- {
- if(FWTime > 1)
- {
- if(FW_Started)
- {
- FWTime--
- set_hudmessage(0, 212, 255, -1.0, 0.28, 2, 0.02, 4.0, 0.01, 0.1, 1);
- show_hudmessage(0,"The First Write Will Start In %d Seconds!",FWTime)
- new Num[10]
- num_to_word(FWTime,Num,9)
- client_cmd(0,"spk fvox/%s",Num)
- }
- else
- {
- remove_task(1992)
- }
- }
- else if(FWTime == 1)
- {
- FWTime--
- haramod = false
- set_hudmessage(0, 212, 255, -1.0, 0.28, 2, 0.02, 4.0, 0.01, 0.1, 1);
- NumberSelected = random_num(1,10000)
- new szText[100]
- formatex(szText,99,"The Chosen Number Is:^n[ %d ]",NumberSelected)
- show_hudmessage(0,szText)
- ColorChat(0, 0, "^4[Extazza] ^1The ^4Chosen ^1Number is:^4%d",NumberSelected)
- remove_task(1992)
- }
- }
- public fwwin(id)
- {
- if(!(get_user_flags(id) & ADMIN_KICK))
- {
- client_print(id, print_chat, "[Error] Sorry you don't have access to that command")
- return
- }
- if(FW_Started == true)
- {
- if(cs_get_user_team(id) == CS_TEAM_T)
- {
- FW_Started = false
- set_hudmessage(0, 212, 255, -1.0, 0.28, 2, 0.02, 4.0, 0.01, 0.1, 1);
- new szName[32]
- get_user_name(id,szName,31)
- if(is_user_alive(id))
- cs_set_user_team(id,CS_TEAM_CT);
- ExecuteHamB(Ham_CS_RoundRespawn, id)
- show_hudmessage(0,"%s, Won The First Write Contest! ^nAnd Moved To The Guards Team.",szName)
- ColorChat(0, 0, "^4[Extazza] ^3%s^4, Won The First Write!",szName)
- }
- }
- }
- stock ColorChat( const client, const string[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "^1[^4 %s^1 ] ", Info[ 4 ] );
- vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
- if ( client )
- Players[ 0 ] = client;
- else
- get_players( Players, PNum, "ch" );
- for ( new i; i < PNum; i++ )
- {
- if( is_user_connected( Players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
- write_byte( Players[ i ] );
- write_string( szMsg );
- message_end( );
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement