NewbieTesterBeta

NReaction System

Aug 13th, 2014
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.71 KB | None | 0 0
  1. /*
  2. This version of Reaction Test Filterscript is managaed re-created and by NewbieTester.
  3. You are not allowed to re-release it with out getting my Permission
  4. Feel free to suggest us for new updates at Wz-Gaming.com/forum
  5.  
  6. Latest Updates:
  7. - Added a Score Prize
  8.  
  9. For any Help and Support regarding hosting, scripting, etc contact me at
  10. - Samp Forum or Warzone Gaming Forums (Wz-Gaming.com/forum)
  11.  
  12. And expect more for its future version. I will be making it the best :D
  13. */
  14.  
  15. #include <a_samp>
  16.  
  17. // Main Defines
  18. #define CONTESTTIME 3
  19. #define MINIMUM_VALUE 2000000
  20. #define MAXIMUM_VALUE 8000000
  21. #define CONTENT_PRIZE (1000 + random(5000))
  22. #define CONTENT_SCORE 50
  23. forward OnFilterscriptInit();
  24. forward NewContest();
  25. forward OnPlayerWinContest(playerid);
  26. new ContestAnswer = -1; //Minus 1 (-1). We're using this to show that there's no contest running.
  27.  
  28. public OnFilterscriptInit()
  29. {
  30.     print("\n--------------------------------------");
  31.     print(" NReaction By NewbieTester");
  32.     print("--------------------------------------\n");
  33.     SetTimer("NewContest",(1000*60*CONTESTTIME),1);
  34.     return 1;
  35. }
  36.  
  37. public NewContest()
  38. {
  39.   new string[128]; //We're creating a new string here to inform players of the new number.
  40.   ContestAnswer = MINIMUM_VALUE + random(MAXIMUM_VALUE-MINIMUM_VALUE);
  41.  /* Contest Answer: The number that a player must type to win the contest.
  42.     Minimum_value: The minimum amount, so the number won't be lower then that.
  43.     'random' picks a random number, but to make sure it doesn't exceeds the maximum value, it substracts the minimum value from it.
  44.     Reason for the 'random': MAXIMUM_VALUE is defined as 8000000. MINIMUM_VALUE is defined as 2000000. The minimum number is already 2000000, and if the the 'random' function also puts out 8000000 (The max value), it'll be able to put out numbers above the MAXIMUM_VALUE. */
  45.   format(string,sizeof string,"A new contest has started. Whoever types %d as first, wins $%d.",ContestAnswer,CONTENT_PRIZE); // This formats a string. More information about strings can be found in the link under this code.
  46.   SendClientMessageToAll(0x00FFFFFF,string);
  47.   return 1;
  48. }
  49.  
  50. public OnPlayerText(playerid,text[])
  51. {
  52.   if(strval(text) == ContestAnswer && ContestAnswer != -1)
  53.   {
  54.     OnPlayerWinContest(playerid);
  55.   }
  56.   return 1;
  57. }
  58.  
  59. public OnPlayerWinContest(playerid)
  60. {
  61.   new pName[MAX_PLAYER_NAME],string[128];
  62.   GetPlayerName(playerid,pName,sizeof pName);
  63.   format(string,sizeof string,"Player %s has won the contest and has won %d and %d Scores!",pName,CONTENT_PRIZE,CONTENT_SCORE);
  64.   SendClientMessageToAll(0x00FFFFFF,string);
  65.   GivePlayerMoney(playerid,CONTENT_PRIZE);
  66.   SetPlayerScore(playerid, GetPlayerScore(playerid)+50);
  67.   ContestAnswer = -1;
  68.   return 1;
  69. }
Add Comment
Please, Sign In to add comment