27.04.2014, 10:39
As the title says, when an advisor accepts the help request, the server restarts. why ?
pawn Код:
CMD:accepthelp(playerid, params[])
{
foreach(Player, i)
{
if( GetPVarInt( i, "COMMUNITY_ADVISOR_REQUEST" ) >= 1 )
{
AdvisorCall = i;
}
}
if(AdvisorCall < 999)
{
if(IsPlayerConnected(AdvisorCall))
{
new string[128];
if(HelpingNewbie[playerid] != 999)
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are already helping someone.");
return 1;
}
if(GetPVarInt(playerid, "AdvisorDuty") == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not on duty as a community advisor.");
return 1;
}
format(string, sizeof(string), "* %s has accepted the help request from %s.",GetPlayerNameEx(playerid), GetPlayerNameEx(AdvisorCall));
SendDutyAdvisorMessage(TEAM_AZTECAS_COLOR, string);
format(string, sizeof(string), "* You have accepted %s's help request, once you are done type /finishhelp to get back to your position.",GetPlayerNameEx(AdvisorCall));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Advisor %s has accepted your help request.",GetPlayerNameEx(playerid));
SendClientMessageEx(AdvisorCall, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pAcceptedHelp]++;
new Float: x, Float: y, Float: z, Float: r, i, vw;
vw = GetPlayerVirtualWorld(playerid);
i = GetPlayerInterior(playerid);
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, r);
SetPVarFloat(playerid, "AdvisorLastx", x);
SetPVarFloat(playerid, "AdvisorLasty", y);
SetPVarFloat(playerid, "AdvisorLastz", z);
SetPVarFloat(playerid, "AdvisorLastr", r);
SetPVarInt(playerid, "AdvisorLastInt", i);
SetPVarInt(playerid, "AdvisorLastVW", vw);
GetPlayerPos(AdvisorCall, x, y, z);
vw = GetPlayerVirtualWorld(AdvisorCall);
i = GetPlayerInterior(AdvisorCall);
SetPlayerPos(playerid, x, y+2, z);
SetPlayerVirtualWorld(playerid, vw);
SetPlayerInterior(playerid, i);
HelpingNewbie[playerid] = AdvisorCall;
AdvisorCall = 999;
AddCAReportToken(playerid); // Advisor Tokens
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " No-one has requested any help yet!");
return 1;
}
return 1;
}