Advertisement
biccup

asdasdasdasd

Jan 24th, 2017
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.75 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] == 1)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][pHToken] += 1;
  122.         Update(playerid, pHTokenx);
  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. }
  164. CMD:nreport(playerid, params[])
  165. {
  166.     if(PlayerInfo[playerid][pHelper] >= 1)
  167.     {
  168.         new id, string[1024];
  169.         if(HelperDuty[playerid] == 0)return SCM(playerid, -1, "Nu esti on-duty ca si helper.");
  170.         if(sscanf(params, "u", id))return SCM(playerid, COLOR_FADE2, "Syntax: /nreport <id>");
  171.         if(PlayerInfo[id][pFirstAnswer] == 0)return SCM(playerid, -1, "This player don't have a question");
  172.         if(RaspundeLui[playerid] != id)return SCM(playerid, -1, "Acest player nu ti-a adresat tie o intrebare!");
  173.         PlayerInfo[id][pFirstAnswer] = 0;
  174.         new sendername[25];
  175.         GetPlayerName(id, sendername, sizeof(sendername));
  176.         format(string, sizeof(string), "Report from %s [%d, level %d]: %s", sendername, id, PlayerInfo[id][pLevel], MyQuestion[playerid]);
  177.         format(reporttext[id], sizeof(string), string);
  178.         ABroadCast(COLOR_REPORT,string,1);
  179.         ReportTime[id] = 1;
  180.         timerreport[id] = SetTimerEx("Reportul", 60000, 0, "%d", id);
  181.         HelperBusy[playerid] = 0;
  182.         GiveQuestion(playerid);
  183.         LastAnswered[playerid] = id;
  184.     }
  185.     return 1;
  186. }
  187. CMD:nd(playerid, params[])
  188. {
  189.     if(PlayerInfo[playerid][pHelper] >= 1)
  190.     {
  191.         if(HelperDuty[playerid] == 0)return SCM(playerid, -1, "Nu esti on-duty ca si helper.");
  192.         new id = RaspundeLui[playerid];
  193.         if(HelperBusy[playerid] == 0)return SCM(playerid, -1, "You don't have an active question.");
  194.         if(!IsPlayerConnected(id))
  195.         {
  196.             SCM(playerid, -1, "The player has been disconnected.");
  197.             HelperBusy[playerid] = 0;
  198.             return 1;
  199.         }
  200.         if(PlayerInfo[id][pFirstAnswer] == 0)
  201.         {
  202.             SCM(playerid, -1, "This player don't have a question");
  203.             HelperBusy[playerid] = 0;
  204.             return 1;
  205.         }
  206.         new raspuns[512];
  207.         if(sscanf(params, "s[512]", raspuns))return SCM(playerid, -1, "Syntax: /ndelete <answer>");
  208.         new string[1024];
  209.         format(string, sizeof(string), "(/ndelete) Raspuns trimis: %s", raspuns);
  210.         SCM(playerid, COLOR_FADE2, string);
  211.         new name[25];
  212.         GetPlayerName(playerid, name, 25);
  213.         format(string, sizeof(string), "Helper %s: %s",name, raspuns);
  214.         SCM(id, COLOR_YELLOW, string);
  215.         PlayerInfo[id][pFirstAnswer] = 0;
  216.         HelperBusy[playerid] = 0;
  217.         GiveQuestion(playerid);
  218.         PlayerInfo[playerid][pHToken] += 1;
  219.         Update(playerid, pHTokenx);
  220.         LastAnswered[playerid] = id;
  221.         PlayerInfo[playerid][pHelpedPlayers] += 1;
  222.         Update(playerid, pHelpedPlayersx);
  223.     }
  224.     return 1;
  225. }
  226. CMD:ndelete(playerid, params[])
  227. {
  228.     if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first!");
  229.     return cmd_nd(playerid, params);
  230. }
  231. CMD:nskip(playerid, params[])
  232. {
  233.     if(PlayerInfo[playerid][pHelper] >= 1)
  234.     {
  235.         if(HelperDuty[playerid] == 0)return SCM(playerid, -1, "Nu esti on-duty ca si helper.");
  236.         new id = RaspundeLui[playerid];
  237.         if(HelperBusy[playerid] == 0)return SCM(playerid, -1, "You don't have an active question.");
  238.         if(!IsPlayerConnected(id))
  239.         {
  240.             SCM(playerid, -1, "The player has been disconnected.");
  241.             HelperBusy[playerid] = 0;
  242.             return 1;
  243.         }
  244.         if(PlayerInfo[id][pFirstAnswer] == 0)
  245.         {
  246.             SCM(playerid, -1, "This player don't have a question");
  247.             HelperBusy[playerid] = 0;
  248.             return 1;
  249.         }
  250.         LastAnswered[playerid] = id;
  251.         HelperBusy[playerid] = 0;
  252.         SCM(playerid, -1, "{ccff66}Question skipped.If there are no other questions, you will recive same question again.");
  253.         GiveQuestion(playerid);
  254.         SendQuestion(id, MyQuestion[playerid]);
  255.  
  256.     }
  257.     return 1;
  258. }
  259. CMD:hduty(playerid, params[])
  260. {
  261.     if (PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >= 1)
  262.     {
  263.         if(HelperDuty[playerid] == 1)
  264.         {
  265.             new sendername[MAX_PLAYER_NAME], string[256];
  266.             HelperDuty[playerid] = 0;
  267.             GetPlayerName(playerid, sendername, sizeof(sendername));
  268.             format(string, sizeof(string), "Numai esti on duty ca helper.", sendername);
  269.             SendClientMessage(playerid,COLOR_WHITE,string);
  270.             LastAnswered[playerid] = -1;
  271.         }
  272.         else
  273.         {
  274.             new sendername[MAX_PLAYER_NAME], string[256];
  275.             HelperDuty[playerid] = 1;
  276.             GetPlayerName(playerid, sendername, sizeof(sendername));
  277.             format(string, sizeof(string), "Acum esti on duty ca helper!", sendername);
  278.             SendClientMessage(playerid,COLOR_WHITE,string);
  279.             GiveQuestion(playerid);
  280.         }
  281.     }
  282.     else
  283.     {
  284.         SendClientMessage(playerid,COLOR_GREY,"Error: You're not helper.");
  285.     }
  286.     return 1;
  287. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement