Advertisement
97fresh

fasteventsamp

May 10th, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.20 KB | None | 0 0
  1. //sistem fastevent//
  2. #include <a_samp>
  3. #if !defined Loop
  4. #define Loop(%0,%1) for(new %0 = 0; %0 != %1; %0++)
  5. #endif
  6. #if !defined function
  7. #define function%0(%1) forward%0(%1); public%0(%1)
  8. #endif
  9. #if !defined PURPLE
  10. #define PURPLE 0xBF60FFFF
  11. #endif
  12. #if !defined GREEN
  13. #define GREEN 0x94D317FF
  14. #endif
  15. #if !defined TIME
  16. #define TIME 180000
  17. #endif
  18. new
  19.         xCharacters[][] =
  20.         {
  21.             "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
  22.                 "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
  23.             "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
  24.                 "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
  25.             "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
  26.         },
  27.         xChars[16] = "",
  28.         xReactionTimer,
  29.         xCash,
  30.         xScore,
  31.         bool: xTestBusy
  32. ;
  33. public OnFilterScriptInit(){
  34.         xReactionTimer = SetTimer("xReactionTest", TIME, 1);
  35.         return 1;
  36. }
  37. public OnFilterScriptExit(){
  38.         KillTimer(xReactionTimer);
  39.         return 1;
  40. }
  41. public OnPlayerText(playerid, text[]){
  42.         switch(xTestBusy)
  43.         {
  44.             case true:
  45.             {
  46.                         if(!strcmp(xChars, text, false))
  47.                         {
  48.                             new string[128],
  49.                             pName[MAX_PLAYER_NAME];
  50.                             GetPlayerName(playerid, pName, sizeof(pName));
  51.                             format(string, sizeof(string), \%s\" has won the reaction test. »", pName);
  52.                             SendClientMessageToAll(GREEN, string);
  53.                             format(string, sizeof(string), "« You have earned $%d + %d score points. »", xCash, xScore);
  54.                             SendClientMessage(playerid, GREEN, string);
  55.                             GivePlayerMoney(playerid, xCash);
  56.                             SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);
  57.                             xReactionTimer = SetTimer("xReactionTest", TIME, 1);
  58.                             xTestBusy = false;
  59.         }}}
  60.         return 1;
  61. }
  62. function xReactionProgress(){
  63.     switch(xTestBusy)
  64.         {
  65.             case true:
  66.             {
  67.                     new string[128];
  68.                     format(string, sizeof(string), "« No-one won the reaction-test. New one starting in %d minutes. »", (TIME/60000));
  69.                     SendClientMessageToAll(PURPLE, string);
  70.                     xReactionTimer = SetTimer("xReactionTest", TIME, 1);
  71.     }}
  72.     return 1;
  73. }
  74. function xReactionTest(){
  75.         new                xLength = (random(8) + 2),
  76.                 string[128];
  77.         xCash = (random(10000) + 20000);
  78.         xScore = (random(2)+1);
  79.         format(xChars, sizeof(xChars), "");
  80.         Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);
  81.         format(string, sizeof(string), "« Who first types %s wins $%d + %d score points. »", xChars, xCash, xScore);
  82.         SendClientMessageToAll(PURPLE, string);
  83.         KillTimer(xReactionTimer);
  84.         xTestBusy = true;
  85.         SetTimer("xReactionProgress", 30000, 0);
  86.         return 1;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement