Advertisement
Guest User

testreaction

a guest
Oct 6th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.29 KB | None | 0 0
  1. //==============================================================================
  2. // Reaction Test | Versiunea 1 | Create de xplor | Data creeri: 6.X.2012 | X-SET
  3. //==============================================================================
  4. #include <   a_samp   > //Thanx Kalcor :D
  5. //==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||== [Defines]
  6. #define Loop(%0,%1)    for(new %0 = 0;     %0 != %1;     %0++)
  7.         function%0(%1)  forward%0(%1);  public%0(%1)
  8.         GREEN          0x94D317FF
  9.         TIME           1221
  10.         Version        1
  11. //==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||==||== [News]
  12. new Charact[16] = "", RTimer, WinCash, WinScore, bool: ocuped,
  13.     xCharacters[][] = //Literele, cifrele si semnele folosit pentru Reactie.
  14.     {
  15.         "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
  16.         "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
  17.         "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
  18.         "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
  19.         "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "~", "!", "#",
  20.         "$", "%", "^", "&", "*", "!", ")", "(", "-", "_", "=", "+"
  21.     }
  22. ;
  23.  
  24. public OnFilterScriptInit()
  25. {
  26.     print(" [ Reaction Test ] ");
  27.     print(" [   By Xpllor   ] ");
  28.     printf(" [  Version %d   ] ", Version);
  29.     RTimer = SetTimer("ReactionTest", TIME, 1);
  30.     return 1;
  31. }
  32.  
  33. public OnFilterScriptExit()
  34. {
  35.     print(" [ Reaction Test ] ");
  36.     print(" [   By Xpllor   ] ");
  37.     print(" [    UnLoaded   ] ");
  38.     KillTimer(RTimer);
  39.     return 1;
  40. }
  41.  
  42. public OnPlayerText(playerid, text[])
  43. {
  44.     switch(ocuped)
  45.     {
  46.         case true:
  47.         {
  48.             if(!strcmp(Charatc, text, false))
  49.             {
  50.                 new string[128], pName[MAX_PLAYER_NAME];
  51.                 GetPlayerName(playerid, pName, sizeof(pName));
  52.                 format(string, sizeof(string), "{FFFFFF}« {00C0FF}%s {FFFFFF}has won the reaction test. »", pName);
  53.                 SendClientMessageToAll(GREEN, string);
  54.                 format(string, sizeof(string), "{FFFFFF}« You have earned {00C0FF}$%d {FFFFFF}+ {00C0FF}%d score points{FFFFFF}. »", WinCash, WinScore);
  55.                 SendClientMessage(playerid, GREEN, string);
  56.                 GivePlayerMoney(playerid, WinCash);
  57.                 SetPlayerScore(playerid, GetPlayerScore(playerid) + WinScore);
  58.                 RTimer = SetTimer("ReactionTest", TIME, 1);
  59.                 ocuped = false;
  60.             }
  61.         }
  62.     }
  63.     return 1;
  64. }
  65.  
  66. function ReactionProcess()
  67. {
  68.     switch(ocuped)
  69.     {
  70.         case true:
  71.         {
  72.             new string[128];
  73.             format(string, sizeof(string), "{FFFFFF}« No-one won the reaction-test. {00C0FF}New one starting in %d minutes. {FFFFFF}»", (TIME/60000));
  74.             SendClientMessageToAll(GREEN, string);
  75.             RTimer = SetTimer("ReactionTest", TIME, 1);
  76.         }
  77.     }
  78.     return 1;
  79. }
  80.  
  81. function ReactionTest()
  82. {
  83.     new xLength = (random(8) + 2), string[128];
  84.     WinCash = (random(10000) + 20000);
  85.     WinScore = (random(2)+1);
  86.     format(Charatc, sizeof(Charatc), "");
  87.     Loop(x, xLength) format(Charatc, sizeof(Charatc), "%s%s", Charatc, xCharacters[random(sizeof(xCharacters))][0]);
  88.     format(string, sizeof(string), "{FFFFFF}« Who first types {00C0FF}%s {FFFFFF}wins {00C0FF}$%d {FFFFFF}+ {00C0FF}%d score points. {FFFFFF}»", Charatc, WinCash, WinScore);
  89.     SendClientMessageToAll(GREEN, string);
  90.     KillTimer(RTimer);
  91.     ocuped = true;
  92.     SetTimer("ReactionProcess", 30000, 0);
  93.     return 1;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement