Server crashes when making /accepthelp
#1

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;
}
Reply
#2

After the last pvar set add this:

pawn Код:
new Float: x, Float: y, Float: z, Float: r, i, vw;
Youre getting new data for the advisor.
Reply
#3

Comment out separate lines and see where the problem lies.
Reply
#4

Load crashdetect plugin.
Use debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info

Re-compile your scripts and start the server. Execute /accepthelp and if it crashes again, then post your server log.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)