garfield

[FS] Teste de reação 2.0

Sep 4th, 2011
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.16 KB | None | 0 0
  1. /*
  2.  
  3.     @Author: [iPs]SuYaNw / eu mesmo xD
  4.     @For: iPs TeaM
  5. */
  6.  
  7.  
  8. #include <a_samp>
  9. #define MAX_CHAR_FOR_REACTION           (7)          
  10. #define TIME_FOR_NEW_REACTION           (15000)
  11. #define MONEY_RECEIV_REACTION           (1000)
  12.  
  13. LoadReaction();
  14.  
  15. new
  16.     string[100],
  17.     _stri[128],
  18.     Acertou,
  19.     stchar,
  20.     chars[] =
  21.     {
  22.         "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R",
  23.         "S","T","U","V","W","X","Y","1","2","3","4","5","6","7","8","9","0",
  24.         "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r",
  25.         "s","t","u","v","w","x","y","Z","z"
  26.     }
  27. ;
  28.    
  29.  
  30. public OnFilterScriptInit()
  31. {
  32.     print("--------------------- Teste de Reação ---------------------");
  33.     print(" Por: [iPs]SuYaNw' \n\n");
  34.     print("Configuração:");
  35.     printf( " - Máximo Caratere por reação: %d\n - Tempo para nova reação: %d\n - Dinheiro a cada reação: %d", MAX_CHAR_FOR_REACTION, TIME_FOR_NEW_REACTION, MONEY_RECEIV_REACTION);
  36.     print("--------------------- Teste de Reação ---------------------");
  37.    
  38.     SetTimer("LoadReaction", TIME_FOR_NEW_REACTION, true);
  39.     return true;
  40. }
  41.  
  42.  
  43. public LoadReaction()
  44. {
  45.     _stri[0] = EOS;
  46.     stchar = -1;
  47.     for(new i; i < MAX_CHAR_FOR_REACTION; ++i) strcat(_stri, chars[random(sizeof(chars))]);
  48.     format(string, sizeof(string),"{FF00FF}[TEST-REAÇÃO]{FFFFFF}: Quem digitar primeiro {FF0000}%s{FFFFFF} ganha %d de grana!", _stri, MONEY_RECEIV_REACTION);
  49.     SendClientMessageToAll(-1, string);
  50.     Acertou = 0xFFFFFF;
  51.     stchar = strlen(_stri);
  52.     return true;
  53. }
  54.  
  55. public OnPlayerText(playerid, text[])
  56. {
  57.     if(!(strlen(_stri) < stchar))
  58.     {
  59.         if(!strcmp(text, _stri, false))
  60.         {
  61.            
  62.             if(Acertou != -1)
  63.             {
  64.                 GetPlayerName(Acertou, string, 24);
  65.                 format(string, sizeof(string),"Desculpe, mais o %s já acertou a palavra: %s",  string, _stri);
  66.                 SendClientMessage(playerid, -1, string);
  67.                 return false;
  68.             }
  69.             GetPlayerName(playerid, string, 24);
  70.             format(string, sizeof(string),"%s[%i] Acertou no teste de Reação!!, palavra: %s",string, playerid, _stri);
  71.             SendClientMessageToAll(-1, string);
  72.             Acertou = playerid;
  73.             return false;
  74.         }
  75.     }
  76.     return 1;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment