Don't like ads? PRO users don't see any ads ;-)
Guest

test reakcije by:_IcE_

By: a guest on Sep 15th, 2012  |  syntax: None  |  size: 2.70 KB  |  hits: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*Ovo je FS Test reakcije by:IcE*/
  2.  
  3. #include <a_samp>
  4.  
  5. #if !defined Loop
  6. #define Loop(%0,%1) \
  7.         for(new %0 = 0; %0 != %1; %0++)
  8. #endif
  9.  
  10. #if !defined function
  11. #define function%0(%1) \
  12.         forward%0(%1); public%0(%1)
  13. #endif
  14.  
  15. #if !defined PURPLE
  16. #define PURPLE \
  17.     0xBF60FFFF
  18. #endif
  19.  
  20. #if !defined GREEN
  21. #define GREEN \
  22.     0x94D317FF
  23. #endif
  24.  
  25. #if !defined TIME
  26. #define TIME \
  27.     180000
  28. #endif
  29.  
  30. new
  31.         xCharacters[][] =
  32.         {
  33.             "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
  34.                 "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
  35.             "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
  36.                 "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
  37.             "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
  38.         },
  39.         xChars[16] = "",
  40.         xReactionTimer,
  41.         xCash,
  42.         xScore,
  43.         bool: xTestBusy
  44. ;
  45.  
  46. public OnFilterScriptInit()
  47. {
  48.         xReactionTimer = SetTimer("xReactionTest", TIME, 1);
  49.         return 1;
  50. }
  51.  
  52. public OnFilterScriptExit()
  53. {
  54.         KillTimer(xReactionTimer);
  55.         return 1;
  56. }
  57.  
  58. public OnPlayerText(playerid, text[])
  59. {
  60.         switch(xTestBusy)
  61.         {
  62.             case true:
  63.             {
  64.                         if(!strcmp(xChars, text, false))
  65.                         {
  66.                             new
  67.                                 string[128],
  68.                                 pName[MAX_PLAYER_NAME]
  69.                                 ;
  70.                                 GetPlayerName(playerid, pName, sizeof(pName));
  71.                                 format(string, sizeof(string), "« \%s\" Je pobijedio u testu reakcije. »", pName);
  72.                             SendClientMessageToAll(GREEN, string);
  73.                             format(string, sizeof(string), "« Ti si dobio $%d + %d scora!Cestitamo. »", xCash, xScore);
  74.                             SendClientMessage(playerid, GREEN, string);
  75.                             GivePlayerMoney(playerid, xCash);
  76.                                 SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);
  77.                                 xReactionTimer = SetTimer("xReactionTest", TIME, 1);
  78.                             xTestBusy = false;
  79.                         }
  80.                 }
  81.         }
  82.         return 1;
  83. }
  84.  
  85. function xReactionProgress()
  86. {
  87.     switch(xTestBusy)
  88.         {
  89.             case true:
  90.             {
  91.                     new
  92.                         string[128]
  93.                         ;
  94.                         format(string, sizeof(string), "« Niko nije osvojio test reakcije sljedeci pocinje za %d minute. »", (TIME/60000));
  95.                     SendClientMessageToAll(PURPLE, string);
  96.                 xReactionTimer = SetTimer("xReactionTest", TIME, 1);
  97.         }
  98.         }
  99.         return 1;
  100. }
  101.  
  102. function xReactionTest()
  103. {
  104.         new
  105.                 xLength = (random(8) + 2),
  106.                 string[128]
  107.         ;
  108.         xCash = (random(10000) + 20000);
  109.         xScore = (random(2)+1);
  110.         format(xChars, sizeof(xChars), "");
  111.         Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);
  112.         format(string, sizeof(string), "« Ko prvi upise %s dobiva $%d + %d scora!. »", xChars, xCash, xScore);
  113.         SendClientMessageToAll(PURPLE, string);
  114.         KillTimer(xReactionTimer);
  115.         xTestBusy = true;
  116.         SetTimer("xReactionProgress", 30000, 0);
  117.         return 1;
  118. }