Advertisement
CheezPuff

[2013] JB Auto FirstWrite system [New version pasted!]

Dec 3rd, 2013 (edited)
1,004
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.45 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < amxmisc >
  3. #include < cstrike >
  4. #include < hamsandwich >
  5. #include < ColorChat > // amx 1.9.0 this include not support anymore
  6.  
  7. #define FW_ACCESS ADMIN_KICK
  8.  
  9. new CTRounds[33] = 0
  10.  
  11. new bool: FW_Started = false
  12. new FWTime
  13. new NumberSelected
  14.  
  15. public plugin_init()  
  16. {
  17.     register_clcmd("say","HandleSay")
  18.     RegisterHam(Ham_Spawn,"player","PlayerRespawned", 1)
  19.     set_task(10.0,"Ratio",_,_,_,"b")
  20. }
  21.  
  22. public client_disconnect( id ) // if you running server with lastest amx version 1.9.0 change this line - client_disconnect ->
  23. {
  24.     CTRounds[ id ] = 0;
  25. }
  26.  
  27. public Ratio()
  28. {
  29.     new CTCounter, TCounter
  30.     new players[32],pnum
  31.     get_players(players,pnum)
  32.     for(new i = 0;i<pnum;i++)
  33.     {
  34.         new cid = players[i]
  35.         switch(cs_get_user_team(cid))
  36.         {
  37.             case CS_TEAM_T:
  38.             {
  39.                 TCounter++
  40.             }
  41.             case CS_TEAM_CT:
  42.             {
  43.                 CTCounter++
  44.             }
  45.         }
  46.     }
  47.      
  48.      
  49.     if(CTCounter == 0 && TCounter >= 2)
  50.     {
  51.         StartFWRatio()
  52.     }
  53.     else if(CTCounter == 1 && TCounter >= 11)
  54.     {
  55.         StartFWRatio()
  56.     }
  57.     else if(CTCounter == 2 && TCounter >= 16)
  58.     {
  59.         StartFWRatio()
  60.     }
  61.     else if(CTCounter == 3 && TCounter >= 21)
  62.     {
  63.         StartFWRatio()
  64.     }
  65. }
  66.  
  67.  
  68. public PlayerRespawned(id)
  69. {
  70.     if(!is_user_alive(id))
  71.     {
  72.         return 1;
  73.     }
  74.     if(cs_get_user_team(id) == CS_TEAM_CT)
  75.     {
  76.         if(CTRounds[id] == 9)
  77.         {
  78.             cs_set_user_team(id,CS_TEAM_T)
  79.             ExecuteHamB(Ham_CS_RoundRespawn, id)
  80.             new szName[32];
  81.             get_user_name(id,szName,31)
  82.             ColorChat(0,TEAM_COLOR,"^4[Jailbreak] ^3%s^1 his was^4 10 ^1rounds in CT.",szName)
  83.             CTRounds[id] = 0
  84.             StartFWRounds
  85.         }
  86.         else
  87.         {    
  88.             CTRounds[id]++
  89.             ColorChat(id,TEAM_COLOR,"^4[Jailbreak] ^1You have been CT [^4%d^1/10] Rounds!",CTRounds[id])
  90.              
  91.         }
  92.     }
  93.     else
  94.     {
  95.         CTRounds[id] = 0
  96.     }
  97.     return 0;
  98. }
  99.  
  100. public HandleSay(id)
  101. {
  102.     new StrNumberSelected[22]
  103.     num_to_str(NumberSelected,StrNumberSelected,21)
  104.     new szMessage[128], szArg1[38],szArg2[38];
  105.     read_argv(1, szMessage, charsmax(szMessage));
  106.     parse(szMessage, szArg1, charsmax(szArg1),szArg2,charsmax(szArg2));
  107.     if(equali(szArg1,"/fw") || equali(szArg1,"/first")|| equali(szArg1,"!first") || equali(szArg1,"!fw"))
  108.     {
  109.         if(get_user_flags(id) & FW_ACCESS)
  110.         {
  111.             StartFW(id)
  112.         }
  113.     }
  114.     else if(equali(szArg1,"/stopfw") || equali(szArg1,"!stopfw"))
  115.     {
  116.         if(get_user_flags(id) & FW_ACCESS)
  117.         {
  118.             StopFW(id)
  119.         }
  120.     }
  121.     else if(equali(szArg1,StrNumberSelected))
  122.     {
  123.         if(FW_Started == true)
  124.         {
  125.             if(cs_get_user_team(id) == CS_TEAM_T)
  126.             {
  127.                 FW_Started = false
  128.                 set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255))
  129.                 new szName[32]
  130.                 get_user_name(id,szName,31)
  131.                 if(is_user_alive(id))
  132.                 cs_set_user_team(id,CS_TEAM_CT);
  133.                 ExecuteHamB(Ham_CS_RoundRespawn, id)
  134.                 show_hudmessage(0,"%s has won the first write!",szName)
  135.                 ColorChat(0,TEAM_COLOR,"^4[Jailbreak] ^3%s^4 Won ^1the ^4first writes^1!",szName)
  136.                  
  137.             }
  138.             else
  139.             {
  140.                 ColorChat(id,TEAM_COLOR,"^4[Jailbreak] ^1You are a^4 Guard^1 already!")
  141.             }
  142.         }
  143.     }
  144.     else if(equali(szArg1,"/rounds"))
  145.     {
  146.         new player = cmd_target(id, szArg2, 0)
  147.         if(!(player))
  148.         {
  149.             ColorChat(id,TEAM_COLOR,"^4[Jailbreak] ^1There is no player named^3 %s^1",szArg2)
  150.             return 1;
  151.         }
  152.         new szName[32]
  153.         get_user_name(player,szName,31)
  154.         if(cs_get_user_team(player) != CS_TEAM_CT)
  155.         {
  156.             ColorChat(id,TEAM_COLOR,"^4[Jailbreak] ^1The player^3 %s^1 is not in CT team!",szName)
  157.             return 1;
  158.         }
  159.         ColorChat(id,TEAM_COLOR,"^4[Jailbreak] ^1The player^3 %s^1 Left^4 Rounds ^1[^4%d^1/10]^4 rounds!",szName,CTRounds[player])
  160.     }
  161.     return 0;
  162.      
  163. }
  164.  
  165. public StartFW(id)
  166. {
  167.     if(!FW_Started)
  168.     {
  169.         FW_Started = true
  170.         FWTime = 6
  171.         set_task(1.0,"CheckTime",1992,_,_,"b")
  172.         new szAdmin[32]
  173.         get_user_name(id,szAdmin,31)
  174.         ColorChat(0,TEAM_COLOR,"^4[Jailbreak] ^1Admin^3 %s ^4started ^1the first writes",szAdmin)
  175.     }
  176.     else
  177.     {
  178.         ColorChat(id,TEAM_COLOR,"^4[Jailbreak] ^1First writes is already ^4activated!")
  179.     }
  180.     return 1;
  181. }
  182. public StartFWRatio()
  183. {
  184.     if(!FW_Started)
  185.     {
  186.         FW_Started = true
  187.         FWTime = 6
  188.         set_task(1.0,"CheckTime",1992,_,_,"b")
  189.         ColorChat(0,TEAM_COLOR,"^4[Jailbreak] ^1Auto^4 FirstWrite ^1started")
  190.     }
  191. }
  192. public StartFWRounds()
  193. {
  194.     if(!FW_Started)
  195.     {
  196.         FW_Started = true
  197.         FWTime = 9
  198.         set_task(1.0,"CheckTime",1992,_,_,"b")
  199.     }
  200. }
  201. public StopFW(id)
  202. {
  203.     if(FW_Started)
  204.     {
  205.         FW_Started = false
  206.          
  207.         new szName[32]
  208.         get_user_name(id,szName,31)
  209.         ColorChat(0,TEAM_COLOR,"^4[Jailbreak] ^1Admin ^3%s ^4stopped ^1first writes!",szName)
  210.          
  211.     }
  212.     else
  213.     {
  214.          
  215.         ColorChat(id,TEAM_COLOR,"^4[Jailbreak] ^1FirstWrite is not ^4activated!")
  216.     }
  217.     return 1;
  218. }
  219.  
  220. public CheckTime()
  221. {
  222.      
  223.     if(FWTime > 1)
  224.     {
  225.         if(FW_Started)
  226.         {
  227.             FWTime--
  228.             set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, 0.30, 0, 4.0, 4.0)
  229.             show_hudmessage(0,"The first writes will start in %d seconds!",FWTime)
  230.             new Num[10]
  231.             num_to_word(FWTime,Num,9)
  232.             client_cmd(0,"spk fvox/%s",Num)
  233.         }
  234.         else
  235.         {
  236.             remove_task(1992)
  237.         }
  238.     }
  239.     else if(FWTime == 1)
  240.     {
  241.         FWTime--
  242.         set_hudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, 0.30, 0, 4.0, 4.0)
  243.         NumberSelected = random_num(1,10000)
  244.         new szText[100]
  245.         formatex(szText,99,"The chosen number is: %d",NumberSelected)
  246.         show_hudmessage(0,szText)
  247.         ColorChat(0,TEAM_COLOR,"^4[Jailbreak] ^1The ^4chosen ^1number is:^4%d",NumberSelected)
  248.         remove_task(1992)
  249.     }
  250. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement