Advertisement
orayon

Untitled

Mar 4th, 2021
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.34 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fakemeta>
  4.  
  5. #define PLUGIN "First Writes Jailbreak"
  6. #define VERSION "1.0"
  7. #define AUTHOR "FuckTheSchool ( Eyal282 )"
  8.  
  9. new FirstStarted = false, FirstMove = false, First_Chars[6], timer, cvarOn, cvarAuto;
  10.  
  11. public plugin_init() {
  12. register_plugin(PLUGIN, VERSION, AUTHOR)
  13.  
  14. register_clcmd("say","HandleSay")
  15. register_forward(FM_Think, "CheckStatus")
  16. register_forward(FM_PlayerPreThink, "Client_PreThink")
  17. cvarOn = register_cvar("amx_fw_enable", "1")
  18. cvarAuto = register_cvar("amx_fw_auto", "1")
  19. register_cvar("amx_prefix_cvar", "PREFIX")
  20.  
  21. }
  22.  
  23. }
  24. public plugin_natives()
  25. {
  26. register_native("get_first_string", "_get_first_string")
  27. }
  28. public _get_first_string(plugin, params)
  29. {
  30. return First_Chars;
  31. }
  32. public CountDown()
  33. {
  34. if(get_pcvar_num(cvarOn)) {
  35. if(FirstStarted) {
  36. if(timer == 0) {
  37. FirstMove = true
  38. 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))
  39. set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 6.0)
  40. show_hudmessage(0, "[ %s ]", First_Chars)
  41. ColorChat(0, "First Writes Started, Answer: ^4%s", First_Chars)
  42. } else if(timer > 0) {
  43. client_cmd(0, "spk ^"fvox/bell^"")
  44. set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 0.9, 0.1, 0.2, 6)
  45. show_hudmessage(0, "First Writes Will Start In %i Second%s", timer, timer > 1 ? "s" : "")
  46. timer--
  47. set_task(1.0, "CountDown", 258)
  48. }
  49. }
  50. }
  51. }
  52. public HandleSay(id)
  53. {
  54. if(FirstStarted && FirstMove && cs_get_user_team(id) != CS_TEAM_CT && get_pcvar_num(cvarOn))
  55. {
  56. if(equali(SzMessage(), First_Chars))
  57. {
  58. cs_set_user_team(id, CS_TEAM_CT)
  59. dllfunc(DLLFunc_Spawn, id)
  60. client_cmd(id, "spk holo/tr_holo_nicejob")
  61. set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 7.0, 0.1, 0.2, 6)
  62. show_hudmessage(0, "The Winner Is: %s", GetUserName(id))
  63. ColorChat(0, "^4The Winner Is: ^3%s", GetUserName(id))
  64. FirstStarted = false
  65. FirstMove = false
  66. client_cmd(0, "slot10")
  67. return 1;
  68. } else
  69. ColorChat(id, "Your Answer Is Wrong, Answer: ^3%s", First_Chars)
  70. }
  71. if(equali(SzMessage(), "/fw") || equali(SzMessage(), "/first")) {
  72. if(get_pcvar_num(cvarOn)) {
  73. if(get_user_flags(id) & ADMIN_CVAR) {
  74. if(!FirstStarted) {
  75. timer = 5
  76. FirstStarted = true
  77. set_task(1.0, "CountDown", 258)
  78. ColorChat(0, "^4%s^3 Started First Writes", GetUserName(id))
  79. } else
  80. ColorChat(id, "^3 First Writes Is Already Started")
  81. } else
  82. ColorChat(id, "^3You Have No Access To This Command")
  83. }
  84. return 1;
  85. }
  86. else if(equali(SzMessage(), "/stopfw") || equali(SzMessage(), "/stopfirst")) {
  87. if(get_pcvar_num(cvarOn)) {
  88. if(get_user_flags(id) & ADMIN_CVAR) {
  89. if(FirstStarted) {
  90. FirstStarted = false
  91. FirstMove = false
  92. remove_task(258)
  93. ColorChat(0, "^4%s^3 Stopped First Writes", GetUserName(id))
  94. } else
  95. ColorChat(id, "^3First Writes Is Didn't Started")
  96. } else
  97. ColorChat(id, "^3You Have No Access To This Command")
  98. }
  99. return 1;
  100. }
  101. return 0;
  102. }
  103. public CheckStatus(ent)
  104. {
  105. if(!FirstStarted && !FirstMove && get_pcvar_num(cvarOn) && get_pcvar_num(cvarAuto)) {
  106. if(EnoughPlayers())
  107. {
  108. timer = 5
  109. FirstStarted = true
  110. set_task(5.0, "CountDown", 358)
  111. set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 7.0, 0.1, 0.2, 6)
  112. show_hudmessage(0, "First Writes Will Start In 10 Seconds")
  113. }
  114. if(OneTerror())
  115. ColorChat(0, "^4Need^3 2^4 Players To Start First Writes!")
  116. }
  117. }
  118. public Client_PreThink(id)
  119. {
  120. if(FirstStarted && FirstMove) {
  121. set_hudmessage(0, 255, 255, -1.0, 0.35, 1, 6.0, 6.0)
  122. if(cs_get_user_team(id) == CS_TEAM_T)
  123. show_hudmessage(id, "[ %s ]", First_Chars)
  124. }
  125. }
  126. stock EnoughPlayers()
  127. {
  128. new Tcount = 0, CTcount = 0;
  129. for(new i = 0;i <= get_maxplayers();i++)
  130. {
  131. new CsTeams:Team = cs_get_user_team(i)
  132. if(!is_user_connected(i))
  133. continue;
  134.  
  135. switch(Team)
  136. {
  137. case CS_TEAM_CT: CTcount++
  138. case CS_TEAM_T: Tcount++
  139. }
  140. }
  141. return ((Tcount > 3 && CTcount == 0) (Tcount > 8 && CTcount == 1) (Tcount > 14 && CTcount == 2) || (Tcount > 21 && CTcount == 3)) ? true : false
  142. }
  143. stock OneTerror()
  144. {
  145. new Tcount = 0, CTcount = 0;
  146. for(new i = 1;i <= get_maxplayers();i++)
  147. {
  148. new CsTeams:Team = cs_get_user_team(i)
  149. if(!is_user_connected(i))
  150. continue;
  151.  
  152. switch(Team)
  153. {
  154. case CS_TEAM_CT: CTcount++
  155. case CS_TEAM_T: Tcount++
  156. }
  157. }
  158. return (Tcount == 1 && CTcount < 1) ? true : false
  159. }
  160. stock SzMessage()
  161. {
  162. new szMessage[100];
  163. read_args(szMessage, charsmax(szMessage))
  164. remove_quotes(szMessage)
  165. return szMessage;
  166. }
  167. stock GetUserName(index)
  168. {
  169. new name[32]
  170. get_user_name(index, name, charsmax(name))
  171. return name;
  172. }
  173. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
  174. new msg[191], players[32], count = 1, Prefix[20];
  175. get_cvar_string("amx_prefix_cvar", Prefix, charsmax(Prefix))
  176.  
  177. static len
  178. len = formatex(msg, charsmax(msg), "^4[ %s ]^1 ", Prefix)
  179. vformat(msg[len], charsmax(msg) - len, string, 3)
  180.  
  181. if(id) players[0] = id
  182. else get_players(players,count,"ch")
  183.  
  184. for (new i = 0; i < count; i++)
  185. {
  186. if(is_user_connected(players[i]))
  187. {
  188. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
  189. write_byte(players[i])
  190. write_string(msg)
  191. message_end()
  192. }
  193. }
  194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement