Advertisement
Guest User

מערכת מתמטיקה

a guest
Sep 18th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. /*
  2. _________ _________ _
  3. | _ _ | /\ |____ ____| | |
  4. | | | | | | / \ | | | |____
  5. | | | | | | / /\ \ | | | ___ |
  6. | | | | | | / /__\ \ | | | | | |
  7. |_| |_| |_| /_/ \_\ |_| |_| |_|
  8.  
  9. =============
  10. | Match |
  11. |Sys By |
  12. | XyZoN |
  13. |Skype: |
  14. | xplor.eden|
  15. ============
  16. */
  17.  
  18. #include <a_samp>
  19.  
  20. #define TIME 1 //מתי שתחרות תתחיל
  21. #define PRIZE 3000 //זכום הכסף שהשחקן יזכה
  22. #define PRIZESCORE 5 //ניקוד ששחקן יקבל שיזכה
  23.  
  24. new answer;
  25. new endm = 0;
  26. new no1, no2, no3;
  27. new typem = -1;
  28. new timermath;
  29. new timermath2;
  30. new str[128];
  31.  
  32. forward Math();
  33. forward MathEnd();
  34.  
  35. #define COLOR_YELLOW 0xFFFF00FF
  36.  
  37. #define white "{FFFFFF}"
  38. #define red "{FF002B}"
  39. #define orange "{F2C80C}"
  40.  
  41. #define FILTERSCRIPT
  42. #if defined FILTERSCRIPT
  43.  
  44. public OnFilterScriptInit()
  45. {
  46. typem = -1;
  47. endm = 0;
  48. timermath = SetTimer("Math", 1000*60*TIME, true);
  49. return 1;
  50. }
  51.  
  52. public OnFilterScriptExit()
  53. {
  54. typem = -1;
  55. endm = 0;
  56. KillTimer(timermath);
  57. return 1;
  58. }
  59.  
  60. #endif
  61.  
  62. public Math()
  63. {
  64. typem = random(2);
  65. no1 = random(600);
  66. no2 = random(50);
  67. no3 = random(100);
  68.  
  69. endm = 1;
  70. switch(typem)
  71. {
  72. case 0:
  73. {
  74. answer = no1 + no2 + no3;
  75. format(str, sizeof(str), "{00FCFF}$3,000 + 5 score: :זכום זכייה || {F3FF00}%d+%d+%d=?:שאלה", no1, no2, no3);
  76. SendClientMessageToAll(COLOR_YELLOW, str);
  77. }
  78. case 1:
  79. {
  80. answer = no1 - no2 - no3;
  81. format(str, sizeof(str), "{00FCFF}$3,000 + 5 score: :זכום זכייה || {F3FF00}%d-%d-%d=?:שאלה", no1, no2, no3);
  82. SendClientMessageToAll(COLOR_YELLOW, str);
  83. }
  84. case 2:
  85. {
  86. answer = no1 * no2 * no3;
  87. format(str, sizeof(str), "{00FCFF}$3,000 + 5 score: :זכום זכייה || {F3FF00}%d X %d X %d=?:שאלה", no1, no2, no3);
  88. SendClientMessageToAll(COLOR_YELLOW, str);
  89. }
  90. }
  91. SendClientMessageToAll(-1, "{00FCFF}!!!{F3FF00}יש לכם 30 שניות לענות על השאלה");
  92. timermath2 = SetTimer("MathEnd", 1000*30, false);
  93. return 1;
  94. }
  95.  
  96. public MathEnd()
  97. {
  98. switch(typem)
  99. {
  100. case 0:
  101. {
  102. format(str, sizeof(str), "{00FCFF}%d:{00FCFF}אף אחד לא ענה נכון על השאלה,התשובה היא", answer);
  103. SendClientMessageToAll(COLOR_YELLOW, str);
  104. }
  105. case 1:
  106. {
  107. format(str, sizeof(str), "{00FCFF}%d:{00FCFF}אף אחד לא ענה נכון על השאלה,התשובה היא", answer);
  108. SendClientMessageToAll(COLOR_YELLOW, str);
  109. }
  110. case 2:
  111. {
  112. format(str, sizeof(str), "{00FCFF}%d:{00FCFF}אף אחד לא ענה נכון על השאלה,התשובה היא", answer);
  113. SendClientMessageToAll(COLOR_YELLOW, str);
  114. }
  115. }
  116. endm = 0;
  117. KillTimer(timermath2);
  118. return 1;
  119. }
  120.  
  121. public OnPlayerText(playerid, text[])
  122. {
  123. if(strval(text) == answer && endm == 1)
  124. {
  125. format(str, sizeof(str), "{00FCFF}Winner:{00FCFF}%s(%d) {00FCFF}Money:{00FCFF}%d {00FCFF}Score:{00FCFF}%d {00FCFF}Answer:{00FCFF}%d", GetName(playerid), playerid, PRIZE, PRIZESCORE, answer);
  126. SendClientMessageToAll(COLOR_YELLOW, str);
  127. GivePlayerMoney(playerid, PRIZE);
  128. SetPlayerScore(playerid, GetPlayerScore(playerid) + PRIZESCORE);
  129. KillTimer(timermath2);
  130. endm = 0;
  131. return 0;
  132. }
  133. return 1;
  134. }
  135.  
  136. stock GetName(playerid)
  137. {
  138. new pName[24];
  139. GetPlayerName(playerid, pName, 24);
  140. return pName;
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement