SA-MP Forums Archive
Server crashes when making /accepthelp - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server crashes when making /accepthelp (/showthread.php?tid=509615)



Server crashes when making /accepthelp - Ahmad45123 - 27.04.2014

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;
}



Re: Server crashes when making /accepthelp - Aerotactics - 27.04.2014

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.


Re: Server crashes when making /accepthelp - PrivatioBoni - 27.04.2014

Comment out separate lines and see where the problem lies.


Re: Server crashes when making /accepthelp - Konstantinos - 27.04.2014

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.