Advertisement
garfield

[FS]: Advanced Reaction Test (Com níveis/Dificuldades)

May 1st, 2012
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.19 KB | None | 0 0
  1. #include a_samp
  2.  
  3. #define Dificuldade                         3                                   // Coloque aqui a dificuldade.
  4. #define Dinheiro                            1000                                // Coloque a quantidade de quantos o player receberá de recompensa.
  5. #define Minutos                             5                                   // Configure quantos minutos terá mudanças em cada palavra..
  6.  
  7. #define VERDE                           "{00FF00}"
  8. #define AZUL                            "{6495ED}"
  9. #define CINZA                           "{C0C0C0}"
  10.  
  11.  
  12.  
  13. new
  14.     synDificulting = Dificuldade
  15. ;
  16.  
  17. new
  18.     Dificult[5][2] =
  19.     {
  20.         {0x21,  0x7E},  // Amazing
  21.         {0x30,  0x7A},  // Expert
  22.         {0x41,  0x7A},  // Hard
  23.         {0   ,  0   },  // Easy (Characters Only)
  24.         {0x30,  0x39}   // Very Easy (Numbers Only)
  25.     },
  26.     string[140]     = '\0',
  27.     Acertou         = -1,
  28.     ChsTemp         = -0
  29. ;
  30.  
  31.  
  32.  
  33.  
  34.  
  35. public OnFilterScriptInit()
  36. {
  37.     ChsTemp = SetTimer("@SelectNewWord", Minutos * 10000, true);
  38.     return 1;
  39. }
  40.  
  41.  
  42.  
  43.  
  44. @SelectNewWord(); public @SelectNewWord()
  45. {
  46.     if(Acertou == -1)
  47.     {
  48.         string[0] = EOS;
  49.  
  50.         if(synDificulting != 3)
  51.         {
  52.             format(string, sizeof(string), "%c%c%c%c%c%c", RandomEx(Dificult[synDificulting][0], Dificult[synDificulting][1]),RandomEx(Dificult[synDificulting][0], Dificult[synDificulting][1]),RandomEx(Dificult[synDificulting][0], Dificult[synDificulting][1]),RandomEx(Dificult[synDificulting][0], Dificult[synDificulting][1]), RandomEx(Dificult[synDificulting][0], Dificult[synDificulting][1]) , RandomEx(Dificult[synDificulting][0], Dificult[synDificulting][1]) );
  53.         }
  54.         else
  55.         {
  56.             format(string, sizeof(string), "%c%c%c%c%c%c", RandomEx(0x41, 0x5A), RandomEx(0x61, 0x7A),RandomEx(0x41, 0x5A), RandomEx(0x61, 0x7A),RandomEx(0x41, 0x5A), RandomEx(0x61, 0x7A));
  57.         }
  58.        
  59.         new annstring[130];
  60.         format(annstring, sizeof(annstring),AZUL"[REACTION-TEST]: Novo teste de reação! Palavra: \""VERDE"%s"AZUL"\", ela vale R$: "VERDE"%d", string, Dinheiro);
  61.         SendClientMessageToAll(-1, annstring);
  62.     }
  63.     return true;
  64. }
  65.  
  66.  
  67.  
  68. public OnPlayerText(playerid, text[])
  69. {
  70.     if(!strcmp(text, string, false) && Acertou == -1)
  71.     {
  72.         Acertou = playerid;
  73.  
  74.         KillTimer(ChsTemp);
  75.        
  76.         new Nome[24]; GetPlayerName(playerid, Nome, 24);
  77.         format(string, sizeof(string), AZUL"[REACTION-TEST]: O Player: "VERDE"%s[ID:%i] "AZUL"Acertou o teste de reação, Faturou: R$: %d Palavra: "VERDE"%s", Nome, playerid, Dinheiro, text);
  78.         SendClientMessageToAll(-1, string);
  79.  
  80.         format(string, sizeof(string), CINZA"[REACTION-TEST]: O próximo teste inicia-se em "VERDE"%d "CINZA"minutos..", Minutos);
  81.         SendClientMessageToAll(-1, string);
  82.        
  83.         GivePlayerMoney(playerid, Dinheiro);
  84.         Acertou = -1;
  85.         ChsTemp = SetTimer("@SelectNewWord", Minutos * 10000, true);
  86.         return false;
  87.     }
  88.     return true;
  89. }
  90.  
  91.  
  92.  
  93. static stock RandomEx(minnum = cellmin, maxnum = cellmax) // By Y_Less
  94.     return random(maxnum - minnum + 1) + minnum;
  95.  
  96.  
  97. //////////////////////////// TESTING
  98. public OnPlayerCommandText(playerid, cmdtext[])
  99. {
  100.     if(!strcmp(cmdtext,"/iniciar", true))
  101.     {
  102.         if(!IsPlayerAdmin(playerid)) return false;
  103.         @SelectNewWord();
  104.         return true;
  105.     }
  106.     return false;
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement