Guest User

SReaction System v1.0

a guest
Oct 9th, 2016
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. /*
  2.  
  3. | SReaction System v1 |
  4.  
  5. | Made by Scripter18 |
  6.  
  7. */
  8.  
  9. //---[INCLUDES]---//
  10. #include <a_samp>
  11.  
  12. //---[INCLUDES]---//
  13. #define COLOR_RED "{F81414}"
  14. #define COLOR_GREEN "{6EF83C}"
  15. #define COLOR_ORANGE "{FF7E19}"
  16.  
  17. #define TIMEPASS (4)
  18.  
  19. #define LEAST_NUMBER (2000000)
  20. #define LARGEST_NUMBER (8000000)
  21.  
  22. #define WINNERPRICE (1000)
  23.  
  24. forward StartNewTest();
  25. forward CorrectAnswer(playerid);
  26.  
  27. new NUMBER = -1;
  28.  
  29. public OnFilterScriptInit()
  30. {
  31. SetTimer("StartNewTest",(1000*60*TIMEPASS),1);
  32. return 1;
  33. }
  34. public StartNewTest()
  35. {
  36. new string[128];
  37. NUMBER = LARGEST_NUMBER + random(LARGEST_NUMBER-LARGEST_NUMBER);
  38.  
  39. format(string,sizeof string,"[REACTION]: {FFFFFF}Who first type {F81414}%d {FFFFFF}he wins $%d$ cash.",NUMBER,WINNERPRICE);
  40. SendClientMessageToAll(0x48977996,string);
  41. }
  42. public OnPlayerText(playerid,text[])
  43. {
  44. if(strval(text) == NUMBER && NUMBER != -1)
  45. {
  46. CorrectAnswer(playerid);
  47. }
  48. return 1;
  49. }
  50.  
  51. public CorrectAnswer(playerid)
  52. {
  53. new pName[MAX_PLAYER_NAME],string[128];
  54. GetPlayerName(playerid,pName,sizeof pName);
  55. format(string,sizeof string,"[REACTION] {FFFFFF}%s has won the reaction test and won prize (%d{6EF83C}${FFFFFF}),",pName,WINNERPRICE);
  56. SendClientMessageToAll(0x48977996,string);
  57. GivePlayerMoney(playerid,WINNERPRICE);
  58. NUMBER = -1;
  59. return 1;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment