Server Crashing (probably due to streamer)
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If I remember correctly, CallLocalFunction can crash the server if you pass an empty string so be sure it's not null before pass it as an argument.
Here are some snippets of where I used CallLocalFunction:
pawn Код:
case THREAD_LOAD_ACCOUNT:
        {
            cache_get_field_content(0, "accountindex", result); PlayerData[extra][AccountID] = strval(result);
           
            cache_get_field_content(0, "admin", result); PlayerData[extra][Admin] = strval(result);
            cache_get_field_content(0, "vip", result); PlayerData[extra][VIP] = strval(result);

            cache_get_field_content(0, "money", result); PlayerData[extra][Money] = strval(result);
            cache_get_field_content(0, "bankmoney", result); PlayerData[extra][BankMoney] = strval(result);
            cache_get_field_content(0, "score", result); PlayerData[extra][Score] = strval(result);
            cache_get_field_content(0, "tutorialcomplete", result); PlayerData[extra][TutorialCompleted] = strval(result);
           
            cache_get_field_content(0, "skin", result); PlayerData[extra][Skin] = strval(result);
            cache_get_field_content(0, "mph", result); PlayerData[extra][MPH] = strval(result);
           
            cache_get_field_content(0, "posx", result); PlayerData[extra][posX] = strval(result);
            cache_get_field_content(0, "posy", result); PlayerData[extra][posY] = strval(result);
            cache_get_field_content(0, "posz", result); PlayerData[extra][posZ] = strval(result);

            CallLocalFunction("OnPlayerLoginEx", "i", extra);
        }
pawn Код:
forward OnPlayerLogoutEx(playerid, reason);
public OnPlayerLogoutEx(playerid, reason)
{
    if (PlayerData[playerid][Logged])
    {
        CallLocalFunction("OnPlayerSave", "i", playerid);
        PlayerData[playerid][Logged] = 0;
    }
    return 1;
}
pawn Код:
public OnGameModeExit()
{
    new reason[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        CallLocalFunction("OnPlayerLogoutEx", "ii", i, reason);
    }
   
    mysql_close();
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(Anticheat[playerid]);
    KillTimer(SaveCurrent[playerid]);
    KillTimer(pTextD[playerid]);
   
    CallLocalFunction("OnPlayerLogoutEx", "ii", playerid, reason);
   
    ResetMissionData(playerid);

    PlayerTextDrawHide(playerid, HDGTextdraw0[playerid]);
    PlayerTextDrawHide(playerid, HDGTextdraw1[playerid]);
    PlayerTextDrawHide(playerid, HDGTextdraw2[playerid]);
    PlayerTextDrawHide(playerid, HDGTextdraw3[playerid]);
    PlayerTextDrawHide(playerid, HDGTextdraw4[playerid]);
    PlayerTextDrawHide(playerid, HDGTextdraw5[playerid]);
    PlayerTextDrawHide(playerid, HDGTextdraw6[playerid]);
    PlayerTextDrawHide(playerid, HDGTextdraw7[playerid]);
   
    if(IsBeingSpeced[playerid] == 1)
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i,false);
            }
        }
    }
    return 1;
}
pawn Код:
if (response)
            {
                if (strlen(inputtext) < 3)
                {
                    new dialogtitle[48], dialoginfo[197];
                    format(dialogtitle, sizeof(dialogtitle), "{FFFFFF}Project: Aviation - Register!");
                    format(dialoginfo, sizeof(dialoginfo), "{FFFFFF}Welcome to the server, %s!\n\nThis account is not registered and you may continue by registering it below.\nYou must have at least three characters in your password.\n", GetPlayerNameEx(playerid, 1));
                    return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, dialogtitle, dialoginfo, "Register", "Cancel");
                }
                WP_Hash(PlayerData[playerid][Password], 129, inputtext);

                CallLocalFunction("OnPlayerRegister", "i", playerid);
            }
I really can't see the problem.
Reply


Messages In This Thread
Server Crashing (probably due to streamer) - by Jimmy0wns - 23.03.2015, 20:33
Re: Server Crashing (probably due to streamer) - by Jimmy0wns - 23.03.2015, 20:39
Re: Server Crashing (probably due to streamer) - by Konstantinos - 23.03.2015, 21:27
Re: Server Crashing (probably due to streamer) - by Jimmy0wns - 23.03.2015, 22:15
Re: Server Crashing (probably due to streamer) - by Jimmy0wns - 23.03.2015, 22:23

Forum Jump:


Users browsing this thread: 1 Guest(s)