Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock GiveQuestion(playerid)
- {
- if(HelperBusy[playerid] == 0 && HelperDuty[playerid] == 1)
- {
- new questionn = 0;
- foreach(Player, z)
- {
- if(QuestionOnHolding[z] == 1)
- {
- questionn ++;
- }
- }
- if(questionn == 0)return 0;
- new i = random(MAX_PLAYERS);
- while( (!IsPlayerConnected(i)) || QuestionOnHolding[i] < 1){
- i = random(MAX_PLAYERS);
- }
- new randomhelp = i;
- if(QuestionOnHolding[randomhelp] == 1 && LastAnswered[playerid] != i)
- {
- new name[25], string[1024];
- HelperBusy[playerid] = 1;
- format(string, sizeof(string), "{ff6600}**{e6b800} Question from %s(%d, level %d) {ff6600}**", name, playerid, PlayerInfo[randomhelp][pLevel]);
- SCM(playerid, -1, string);
- SCM(playerid, COLOR_YELLOW, QuestionOnHoldText[randomhelp]);
- PlayerInfo[randomhelp][pFirstAnswer] = 1;
- RaspundeLui[playerid] = playerid;
- format(string, sizeof(string), "%s", QuestionOnHoldText[randomhelp]);
- MyQuestion[playerid] = string;
- QuestionOnHolding[randomhelp] = 0;
- }
- }
- return 1;
- }
- stock SendQuestion(playerid, text[])
- {
- new name[25], string[512];
- GetPlayerName(playerid, name, 25);
- new i = random(MAX_PLAYERS);
- while( (!IsPlayerConnected(i)) || PlayerInfo[i][pHelper] < 1){
- i = random(MAX_PLAYERS);
- }
- new randomhelp = i;
- if(PlayerInfo[randomhelp][pHelper] >= 1)
- {
- if(HelperDuty[randomhelp] == 1)
- {
- if(HelperBusy[randomhelp] == 0)
- {
- HelperBusy[randomhelp] = 1;
- format(string, sizeof(string), "{ff6600}**{e6b800} Question from %s(%d, level %d) {ff6600}**", name, playerid, PlayerInfo[playerid][pLevel]);
- SCM(randomhelp, -1, string);
- SCM(randomhelp, COLOR_YELLOW, text);
- format(string, sizeof(string), "Newbie %s: %s", name, text);
- SCM(playerid, COLOR_NEWBIE, text);
- PlayerInfo[playerid][pFirstAnswer] = 1;
- RaspundeLui[randomhelp] = playerid;
- format(string, sizeof(string), "%s", text);
- MyQuestion[randomhelp] = string;
- }
- else
- {
- // Intrebare in asteptare
- format(PlayerInfo[playerid][pNMessage], 256, "%s", text);
- QuestionOnHolding[playerid] = 1;
- format(string, sizeof(string), "%s", text);
- QuestionOnHoldText[playerid] = string;
- format(string, sizeof(string), "Newbie %s: %s", name, text);
- SCM(playerid, COLOR_NEWBIE, text);
- }
- }
- else return SCM(playerid, -1, "In acest moment pe server nu se afla nici un helper, te rugam sa incerci mai tarziu.");
- }
- return 1;
- }
- CMD:n(playerid, params[])
- {
- new stringz[512], isahelperon = 0;
- if(PlayerInfo[playerid][pHelper] == 0)
- {
- if(PlayerInfo[playerid][pFirstAnswer] == 1)return SCM(playerid, -1, "Ai deja o intrebare activa");
- foreach(Player, z)
- {
- if(HelperDuty[playerid] == 1)
- {
- isahelperon++;
- }
- }
- if(isahelperon == 0)return SCM(playerid, -1, "In acest moment nu este niciun helper la datorie pe server.");
- if(PlayerInfo[playerid][pNewbieEnabled] == 0)
- {
- PlayerInfo[playerid][pNewbieEnabled] = 1;
- SCM(playerid, COLOR_PURPLE, "Chatul de ajutor activat.Foloseste /togn pentru al dezactiva.");
- }
- if(sscanf(params, "s[512]", stringz))return SCM(playerid, -1, "Syntax: /n <question>");
- SendQuestion(playerid, stringz);
- }
- else
- {
- new id = RaspundeLui[playerid];
- if(HelperBusy[playerid] == 1)return SCM(playerid, -1, "You don't have an active question.");
- if(!IsPlayerConnected(id))
- {
- SCM(playerid, -1, "The player has been disconnected.");
- HelperBusy[playerid] = 0;
- return 1;
- }
- if(PlayerInfo[id][pFirstAnswer] == 0)
- {
- SCM(playerid, -1, "This player don't have a question");
- HelperBusy[playerid] = 0;
- return 1;
- }
- new raspuns[1024], stringg[1024];
- if(sscanf(params, "s[1024]", raspuns))return SCM(playerid, -1, "Syntax: /n <answer>");
- new name[25];
- GetPlayerName(playerid, name,sizeof(name));
- new name2[25];
- GetPlayerName(id, name2, sizeof(name2));
- HelperBusy[playerid] = 0;
- PlayerInfo[playerid][pHToken] += 1;
- Update(playerid, pHTokenx);
- PlayerInfo[playerid][pHelpedPlayers] += 1;
- Update(playerid, pHelpedPlayersx);
- foreach(Player, i)
- {
- if(PlayerInfo[i][pNewbieEnabled] == 1)
- {
- if(i == id)
- {
- new hsaua[25];
- if(PlayerInfo[playerid][pHelper] >= 1)return hsaua = "Helper";
- if(PlayerInfo[playerid][pAdmin] >= 1)return hsaua = "Admin";
- format(stringg, sizeof(stringg), "%s %s: %s",hsaua,name, raspuns);
- SCM(id, COLOR_YELLOW, stringg);
- PlayerInfo[id][pFirstAnswer] = 0;
- MyQuestion[playerid] = "";
- GiveQuestion(playerid);
- LastAnswered[playerid] = id;
- }
- else
- {
- new hsaua[25];
- if(PlayerInfo[playerid][pHelper] >= 1)return hsaua = "Helper";
- if(PlayerInfo[playerid][pAdmin] >= 1)return hsaua = "Admin";
- format(stringg, sizeof(stringg), "Newbie %s: %s", name2, MyQuestion[playerid]);
- SCM(i, COLOR_NEWBIE, stringg);
- format(stringg, sizeof(stringg), "%s %s: @%s, %s",hsaua, name, name2, raspuns);
- SCM(i, COLOR_NEWBIE, stringg);
- PlayerInfo[id][pFirstAnswer] = 0;
- MyQuestion[playerid] = "";
- GiveQuestion(playerid);
- LastAnswered[playerid] = id;
- }
- }
- }
- }
- return 1;
- }
- CMD:nreport(playerid, params[])
- {
- if(PlayerInfo[playerid][pHelper] >= 1)
- {
- new id, string[1024];
- if(HelperDuty[playerid] == 0)return SCM(playerid, -1, "Nu esti on-duty ca si helper.");
- if(sscanf(params, "u", id))return SCM(playerid, COLOR_FADE2, "Syntax: /nreport <id>");
- if(PlayerInfo[id][pFirstAnswer] == 0)return SCM(playerid, -1, "This player don't have a question");
- if(RaspundeLui[playerid] != id)return SCM(playerid, -1, "Acest player nu ti-a adresat tie o intrebare!");
- PlayerInfo[id][pFirstAnswer] = 0;
- new sendername[25];
- GetPlayerName(id, sendername, sizeof(sendername));
- format(string, sizeof(string), "Report from %s [%d, level %d]: %s", sendername, id, PlayerInfo[id][pLevel], MyQuestion[playerid]);
- format(reporttext[id], sizeof(string), string);
- ABroadCast(COLOR_REPORT,string,1);
- ReportTime[id] = 1;
- timerreport[id] = SetTimerEx("Reportul", 60000, 0, "%d", id);
- HelperBusy[playerid] = 0;
- GiveQuestion(playerid);
- LastAnswered[playerid] = id;
- }
- return 1;
- }
- CMD:nd(playerid, params[])
- {
- if(PlayerInfo[playerid][pHelper] >= 1)
- {
- if(HelperDuty[playerid] == 0)return SCM(playerid, -1, "Nu esti on-duty ca si helper.");
- new id = RaspundeLui[playerid];
- if(HelperBusy[playerid] == 0)return SCM(playerid, -1, "You don't have an active question.");
- if(!IsPlayerConnected(id))
- {
- SCM(playerid, -1, "The player has been disconnected.");
- HelperBusy[playerid] = 0;
- return 1;
- }
- if(PlayerInfo[id][pFirstAnswer] == 0)
- {
- SCM(playerid, -1, "This player don't have a question");
- HelperBusy[playerid] = 0;
- return 1;
- }
- new raspuns[512];
- if(sscanf(params, "s[512]", raspuns))return SCM(playerid, -1, "Syntax: /ndelete <answer>");
- new string[1024];
- format(string, sizeof(string), "(/ndelete) Raspuns trimis: %s", raspuns);
- SCM(playerid, COLOR_FADE2, string);
- new name[25];
- GetPlayerName(playerid, name, 25);
- format(string, sizeof(string), "Helper %s: %s",name, raspuns);
- SCM(id, COLOR_YELLOW, string);
- PlayerInfo[id][pFirstAnswer] = 0;
- HelperBusy[playerid] = 0;
- GiveQuestion(playerid);
- PlayerInfo[playerid][pHToken] += 1;
- Update(playerid, pHTokenx);
- LastAnswered[playerid] = id;
- PlayerInfo[playerid][pHelpedPlayers] += 1;
- Update(playerid, pHelpedPlayersx);
- }
- return 1;
- }
- CMD:ndelete(playerid, params[])
- {
- if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first!");
- return cmd_nd(playerid, params);
- }
- CMD:nskip(playerid, params[])
- {
- if(PlayerInfo[playerid][pHelper] >= 1)
- {
- if(HelperDuty[playerid] == 0)return SCM(playerid, -1, "Nu esti on-duty ca si helper.");
- new id = RaspundeLui[playerid];
- if(HelperBusy[playerid] == 0)return SCM(playerid, -1, "You don't have an active question.");
- if(!IsPlayerConnected(id))
- {
- SCM(playerid, -1, "The player has been disconnected.");
- HelperBusy[playerid] = 0;
- return 1;
- }
- if(PlayerInfo[id][pFirstAnswer] == 0)
- {
- SCM(playerid, -1, "This player don't have a question");
- HelperBusy[playerid] = 0;
- return 1;
- }
- LastAnswered[playerid] = id;
- HelperBusy[playerid] = 0;
- SCM(playerid, -1, "{ccff66}Question skipped.If there are no other questions, you will recive same question again.");
- GiveQuestion(playerid);
- SendQuestion(id, MyQuestion[playerid]);
- }
- return 1;
- }
- CMD:hduty(playerid, params[])
- {
- if (PlayerInfo[playerid][pHelper] >= 1 || PlayerInfo[playerid][pAdmin] >= 1)
- {
- if(HelperDuty[playerid] == 1)
- {
- new sendername[MAX_PLAYER_NAME], string[256];
- HelperDuty[playerid] = 0;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "Numai esti on duty ca helper.", sendername);
- SendClientMessage(playerid,COLOR_WHITE,string);
- LastAnswered[playerid] = -1;
- }
- else
- {
- new sendername[MAX_PLAYER_NAME], string[256];
- HelperDuty[playerid] = 1;
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "Acum esti on duty ca helper!", sendername);
- SendClientMessage(playerid,COLOR_WHITE,string);
- GiveQuestion(playerid);
- }
- }
- else
- {
- SendClientMessage(playerid,COLOR_GREY,"Error: You're not helper.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement