Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <cstrike>
- #include <fakemeta>
- #define PLUGIN "First Writes Jailbreak"
- #define VERSION "1.0"
- #define AUTHOR "FuckTheSchool ( Eyal282 )"
- new FirstStarted = false, FirstMove = false, First_Chars[6], timer, cvarOn, cvarAuto;
- public plugin_init() {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_clcmd("say","HandleSay")
- register_forward(FM_Think, "CheckStatus")
- register_forward(FM_PlayerPreThink, "Client_PreThink")
- cvarOn = register_cvar("amx_fw_enable", "1")
- cvarAuto = register_cvar("amx_fw_auto", "1")
- register_cvar("amx_prefix_cvar", "PREFIX")
- }
- }
- public plugin_natives()
- {
- register_native("get_first_string", "_get_first_string")
- }
- public _get_first_string(plugin, params)
- {
- return First_Chars;
- }
- public CountDown()
- {
- if(get_pcvar_num(cvarOn)) {
- if(FirstStarted) {
- if(timer == 0) {
- FirstMove = true
- formatex(First_Chars, charsmax(First_Chars), "%i%i%i%i%i", random_num(0,9), random_num(0,9), random_num(0,9), random_num(0,9), random_num(0,9))
- set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 6.0)
- show_hudmessage(0, "[ %s ]", First_Chars)
- ColorChat(0, "First Writes Started, Answer: ^4%s", First_Chars)
- } else if(timer > 0) {
- client_cmd(0, "spk ^"fvox/bell^"")
- set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 0.9, 0.1, 0.2, 6)
- show_hudmessage(0, "First Writes Will Start In %i Second%s", timer, timer > 1 ? "s" : "")
- timer--
- set_task(1.0, "CountDown", 258)
- }
- }
- }
- }
- public HandleSay(id)
- {
- if(FirstStarted && FirstMove && cs_get_user_team(id) != CS_TEAM_CT && get_pcvar_num(cvarOn))
- {
- if(equali(SzMessage(), First_Chars))
- {
- cs_set_user_team(id, CS_TEAM_CT)
- dllfunc(DLLFunc_Spawn, id)
- client_cmd(id, "spk holo/tr_holo_nicejob")
- set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 7.0, 0.1, 0.2, 6)
- show_hudmessage(0, "The Winner Is: %s", GetUserName(id))
- ColorChat(0, "^4The Winner Is: ^3%s", GetUserName(id))
- FirstStarted = false
- FirstMove = false
- client_cmd(0, "slot10")
- return 1;
- } else
- ColorChat(id, "Your Answer Is Wrong, Answer: ^3%s", First_Chars)
- }
- if(equali(SzMessage(), "/fw") || equali(SzMessage(), "/first")) {
- if(get_pcvar_num(cvarOn)) {
- if(get_user_flags(id) & ADMIN_CVAR) {
- if(!FirstStarted) {
- timer = 5
- FirstStarted = true
- set_task(1.0, "CountDown", 258)
- ColorChat(0, "^4%s^3 Started First Writes", GetUserName(id))
- } else
- ColorChat(id, "^3 First Writes Is Already Started")
- } else
- ColorChat(id, "^3You Have No Access To This Command")
- }
- return 1;
- }
- else if(equali(SzMessage(), "/stopfw") || equali(SzMessage(), "/stopfirst")) {
- if(get_pcvar_num(cvarOn)) {
- if(get_user_flags(id) & ADMIN_CVAR) {
- if(FirstStarted) {
- FirstStarted = false
- FirstMove = false
- remove_task(258)
- ColorChat(0, "^4%s^3 Stopped First Writes", GetUserName(id))
- } else
- ColorChat(id, "^3First Writes Is Didn't Started")
- } else
- ColorChat(id, "^3You Have No Access To This Command")
- }
- return 1;
- }
- return 0;
- }
- public CheckStatus(ent)
- {
- if(!FirstStarted && !FirstMove && get_pcvar_num(cvarOn) && get_pcvar_num(cvarAuto)) {
- if(EnoughPlayers())
- {
- timer = 5
- FirstStarted = true
- set_task(5.0, "CountDown", 358)
- set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 7.0, 0.1, 0.2, 6)
- show_hudmessage(0, "First Writes Will Start In 10 Seconds")
- }
- if(OneTerror())
- ColorChat(0, "^4Need^3 2^4 Players To Start First Writes!")
- }
- }
- public Client_PreThink(id)
- {
- if(FirstStarted && FirstMove) {
- set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 6.0)
- if(cs_get_user_team(id) == CS_TEAM_T)
- show_hudmessage(id, "[ %s ]", First_Chars)
- }
- }
- stock EnoughPlayers()
- {
- new Tcount = 0, CTcount = 0;
- for(new i = 0;i <= get_maxplayers();i++)
- {
- new CsTeams:Team = cs_get_user_team(i)
- if(!is_user_connected(i))
- continue;
- switch(Team)
- {
- case CS_TEAM_CT: CTcount++
- case CS_TEAM_T: Tcount++
- }
- }
- return ((Tcount > 3 && CTcount == 0) (Tcount > 8 && CTcount == 1) (Tcount > 14 && CTcount == 2) || (Tcount > 21 && CTcount == 3)) ? true : false
- }
- stock OneTerror()
- {
- new Tcount = 0, CTcount = 0;
- for(new i = 1;i <= get_maxplayers();i++)
- {
- new CsTeams:Team = cs_get_user_team(i)
- if(!is_user_connected(i))
- continue;
- switch(Team)
- {
- case CS_TEAM_CT: CTcount++
- case CS_TEAM_T: Tcount++
- }
- }
- return (Tcount == 1 && CTcount < 1) ? true : false
- }
- stock SzMessage()
- {
- new szMessage[100];
- read_args(szMessage, charsmax(szMessage))
- remove_quotes(szMessage)
- return szMessage;
- }
- stock GetUserName(index)
- {
- new name[32]
- get_user_name(index, name, charsmax(name))
- return name;
- }
- stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
- new msg[191], players[32], count = 1, Prefix[20];
- get_cvar_string("amx_prefix_cvar", Prefix, charsmax(Prefix))
- static len
- len = formatex(msg, charsmax(msg), "^4[ %s ]^1 ", Prefix)
- vformat(msg[len], charsmax(msg) - len, string, 3)
- if(id) players[0] = id
- else get_players(players,count,"ch")
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
- write_byte(players[i])
- write_string(msg)
- message_end()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement