Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.43 KB | None | 0 0
  1. stock GiveQuestion(playerid)
  2. {
  3. if(HelperBusy[playerid] == 0 && HelperDuty[playerid] == 1)
  4. {
  5. new questionn = 0;
  6. foreach(Player, z)
  7. {
  8. if(QuestionOnHolding[z] == 1)
  9. {
  10. questionn ++;
  11. }
  12. }
  13. if(questionn == 0)return 0;
  14. new i = random(MAX_PLAYERS);
  15. while( (!IsPlayerConnected(i)) || QuestionOnHolding[i] < 1){
  16. i = random(MAX_PLAYERS);
  17. }
  18. new randomhelp = i;
  19. if(QuestionOnHolding[randomhelp] == 1 && LastAnswered[playerid] != i)
  20. {
  21. new name[25], string[1024];
  22. HelperBusy[playerid] = 1;
  23. format(string, sizeof(string), "{ff6600}**{e6b800} Question from %s(%d, level %d) {ff6600}**", name, playerid, PlayerInfo[randomhelp][pLevel]);
  24. SCM(playerid, -1, string);
  25. SCM(playerid, COLOR_YELLOW, QuestionOnHoldText[randomhelp]);
  26. PlayerInfo[randomhelp][pFirstAnswer] = 1;
  27. RaspundeLui[playerid] = playerid;
  28. format(string, sizeof(string), "%s", QuestionOnHoldText[randomhelp]);
  29. MyQuestion[playerid] = string;
  30. QuestionOnHolding[randomhelp] = 0;
  31. }
  32. }
  33. return 1;
  34. }
  35. stock SendQuestion(playerid, text[])
  36. {
  37. new name[25], string[512];
  38. GetPlayerName(playerid, name, 25);
  39. new i = random(MAX_PLAYERS);
  40. while( (!IsPlayerConnected(i)) || PlayerInfo[i][pHelper] < 1){
  41. i = random(MAX_PLAYERS);
  42. }
  43. new randomhelp = i;
  44. if(PlayerInfo[randomhelp][pHelper] >= 1)
  45. {
  46. if(HelperDuty[randomhelp] == 1)
  47. {
  48. if(HelperBusy[randomhelp] == 0)
  49. {
  50. HelperBusy[randomhelp] = 1;
  51. format(string, sizeof(string), "{ff6600}**{e6b800} Question from %s(%d, level %d) {ff6600}**", name, playerid, PlayerInfo[playerid][pLevel]);
  52. SCM(randomhelp, -1, string);
  53. SCM(randomhelp, COLOR_YELLOW, text);
  54. format(string, sizeof(string), "Newbie %s: %s", name, text);
  55. SCM(playerid, COLOR_NEWBIE, text);
  56. PlayerInfo[playerid][pFirstAnswer] = 1;
  57. RaspundeLui[randomhelp] = playerid;
  58. format(string, sizeof(string), "%s", text);
  59. MyQuestion[randomhelp] = string;
  60. }
  61. else
  62. {
  63. // Intrebare in asteptare
  64. format(PlayerInfo[playerid][pNMessage], 256, "%s", text);
  65. QuestionOnHolding[playerid] = 1;
  66. format(string, sizeof(string), "%s", text);
  67. QuestionOnHoldText[playerid] = string;
  68. format(string, sizeof(string), "Newbie %s: %s", name, text);
  69. SCM(playerid, COLOR_NEWBIE, text);
  70. }
  71. }
  72. else return SCM(playerid, -1, "In acest moment pe server nu se afla nici un helper, te rugam sa incerci mai tarziu.");
  73. }
  74. return 1;
  75. }
  76. CMD:n(playerid, params[])
  77. {
  78. new stringz[512], isahelperon = 0;
  79. if(PlayerInfo[playerid][pHelper] == 0)
  80. {
  81. if(PlayerInfo[playerid][pFirstAnswer] == 1)return SCM(playerid, -1, "Ai deja o intrebare activa");
  82. foreach(Player, z)
  83. {
  84. if(HelperDuty[playerid] == 1)
  85. {
  86. isahelperon++;
  87. }
  88. }
  89. if(isahelperon == 0)return SCM(playerid, -1, "In acest moment nu este niciun helper la datorie pe server.");
  90. if(PlayerInfo[playerid][pNewbieEnabled] == 0)
  91. {
  92. PlayerInfo[playerid][pNewbieEnabled] = 1;
  93. SCM(playerid, COLOR_PURPLE, "Chatul de ajutor activat.Foloseste /togn pentru al dezactiva.");
  94. }
  95. if(sscanf(params, "s[512]", stringz))return SCM(playerid, -1, "Syntax: /n <question>");
  96. SendQuestion(playerid, stringz);
  97. }
  98. else
  99. {
  100. new id = RaspundeLui[playerid];
  101. if(HelperBusy[playerid] == 0)return SCM(playerid, -1, "You don't have an active question.");
  102. if(!IsPlayerConnected(id))
  103. {
  104. SCM(playerid, -1, "The player has been disconnected.");
  105. HelperBusy[playerid] = 0;
  106. return 1;
  107. }
  108. if(PlayerInfo[id][pFirstAnswer] == 0)
  109. {
  110. SCM(playerid, -1, "This player don't have a question");
  111. HelperBusy[playerid] = 0;
  112. return 1;
  113. }
  114. new raspuns[1024], stringg[1024];
  115. if(sscanf(params, "s[1024]", raspuns))return SCM(playerid, -1, "Syntax: /n <answer>");
  116. new name[25];
  117. GetPlayerName(playerid, name,sizeof(name));
  118. new name2[25];
  119. GetPlayerName(id, name2, sizeof(name2));
  120. HelperBusy[playerid] = 0;
  121. PlayerInfo[playerid][pTokens] += 1;
  122. Update(playerid, pTokensx);
  123. PlayerInfo[playerid][pHelpedPlayers] += 1;
  124. Update(playerid, pHelpedPlayersx);
  125. foreach(Player, i)
  126. {
  127. if(PlayerInfo[i][pNewbieEnabled] == 1)
  128. {
  129. if(i == id)
  130. {
  131. new hsaua[25];
  132. if(PlayerInfo[playerid][pHelper] >= 1)return hsaua = "Helper";
  133. if(PlayerInfo[playerid][pAdmin] >= 1)return hsaua = "Admin";
  134. format(stringg, sizeof(stringg), "%s %s: %s",hsaua,name, raspuns);
  135. SCM(id, COLOR_YELLOW, stringg);
  136. PlayerInfo[id][pFirstAnswer] = 0;
  137. MyQuestion[playerid] = "";
  138. GiveQuestion(playerid);
  139. LastAnswered[playerid] = id;
  140.  
  141.  
  142. }
  143. else
  144. {
  145. new hsaua[25];
  146. if(PlayerInfo[playerid][pHelper] >= 1)return hsaua = "Helper";
  147. if(PlayerInfo[playerid][pAdmin] >= 1)return hsaua = "Admin";
  148. format(stringg, sizeof(stringg), "Newbie %s: %s", name2, MyQuestion[playerid]);
  149. SCM(i, COLOR_NEWBIE, stringg);
  150. format(stringg, sizeof(stringg), "%s %s: @%s, %s",hsaua, name, name2, raspuns);
  151. SCM(i, COLOR_NEWBIE, stringg);
  152. PlayerInfo[id][pFirstAnswer] = 0;
  153. MyQuestion[playerid] = "";
  154. GiveQuestion(playerid);
  155. LastAnswered[playerid] = id;
  156. }
  157.  
  158. }
  159. }
  160.  
  161. }
  162. return 1;
  163. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement