Guest User

vRT

a guest
Sep 19th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.38 KB | None | 0 0
  1. /*
  2. ________________________________________________________________________________
  3. ________________________________________________________________________________
  4. ________________________________________vRT_____________________________________
  5. ___________________________________________Reaction Test System_________________
  6. ___________________________________________________Credits:_____________________
  7. ________________________________________________________Vege____________________
  8. ________________________________________________________COD5 GangWars Scripter's
  9. _________________________DO NOT REMOVE THE CREDITS______________________________
  10. ________________________________________________________________________________
  11. */
  12.  
  13. #include <a_samp>
  14.  
  15. #if !defined Loop
  16. #define Loop(%0,%1) \
  17.     for(new %0 = 0; %0 != %1; %0++)
  18. #endif
  19.  
  20. #if !defined function
  21. #define function%0(%1) \
  22.     forward%0(%1); public%0(%1)
  23. #endif
  24.  
  25. #if !defined PURPLE
  26. #define PURPLE \
  27.     0xBF60FFFF
  28. #endif
  29.  
  30. #if !defined GREEN
  31. #define GREEN \
  32.     0x94D317FF
  33. #endif
  34.  
  35. #if !defined TIME
  36. #define TIME \
  37.     180000
  38. #endif
  39.  
  40. new
  41.     vCharacters[][] =
  42.     {
  43.         "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
  44.         "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
  45.         "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
  46.         "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
  47.         "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
  48.     },
  49.     vChars[16] = "",
  50.     vReactionTimer,
  51.     vCash,
  52.     vScore,
  53.     bool: vTestBusy
  54. ;
  55.  
  56. public OnFilterScriptInit()
  57. {
  58.     vReactionTimer = SetTimer("vReactionTest", TIME, 1);
  59.     return 1;
  60. }
  61.  
  62. public OnFilterScriptExit()
  63. {
  64.     KillTimer(vReactionTimer);
  65.     return 1;
  66. }
  67.  
  68. public OnPlayerText(playerid, text[])
  69. {
  70.     switch(vTestBusy)
  71.     {
  72.         case true:
  73.         {
  74.             if(!strcmp(vChars, text, false))
  75.             {
  76.                 new
  77.                     string[128],
  78.                     pName[MAX_PLAYER_NAME]
  79.                 ;
  80.                 GetPlayerName(playerid, pName, sizeof(pName));
  81.                 format(string, sizeof(string), \%s\" has won the reaction test. »", pName);
  82.                 SendClientMessageToAll(GREEN, string);
  83.                 format(string, sizeof(string), "« You have earned $%d + %d score. »", vCash, vScore);
  84.                 SendClientMessage(playerid, GREEN, string);
  85.                 GivePlayerMoney(playerid, vCash);
  86.                 SetPlayerScore(playerid, GetPlayerScore(playerid) + vScore);
  87.                 vReactionTimer = SetTimer("vReactionTest", TIME, 1);
  88.                 vTestBusy = false;
  89.             }
  90.         }
  91.     }
  92.     return 1;
  93. }
  94.  
  95. function vReactionTest()
  96. {
  97.     new
  98.         vLength = (random(8) + 2),
  99.         string[128]
  100.     ;
  101.     vCash = (random(1000) + 4000);
  102.     vScore = (random(2)+1);
  103.     format(vChars, sizeof(vChars), "");
  104.     Loop(v, vLength) format(vChars, sizeof(vChars), "%s%s", vChars, vCharacters[random(sizeof(vCharacters))][0]);
  105.     format(string, sizeof(string), "« Who first types %s wins $%d + %d score. »", vChars, vCash, vScore);
  106.     SendClientMessageToAll(PURPLE, string);
  107.     KillTimer(vReactionTimer);
  108.     vTestBusy = true;
  109.     SetTimer("vReactionProgress", 30000, 0);
  110.     return 1;
  111. }
  112.  
  113. function vReactionProgress()
  114. {
  115.     switch(vTestBusy)
  116.     {
  117.         case true:
  118.         {
  119.             new
  120.                 string[128]
  121.             ;
  122.             format(string, sizeof(string), "« No-one won the reaction-test. New one starting in %d minutes. »", (TIME/60000));
  123.             SendClientMessageToAll(PURPLE, string);
  124.             vReactionTimer = SetTimer("vReactionTest", TIME, 1);
  125.         }
  126.     }
  127.     return 1;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment