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] == 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[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][pTokens] += 1;
- Update(playerid, pTokensx);
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement