SA-MP Forums Archive
Crashing[Urgent help please] - 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: Crashing[Urgent help please] (/showthread.php?tid=469513)



Crashing[Urgent help please] - TonyII - 13.10.2013

Hey, everytime my players crash they lose their weapons and spawn at different locations, what can the cause be? Everything saves and loads well when they logout and log back in later ;S


Re: Crashing[Urgent help please] - PT - 13.10.2013

maybe, can be cheat's, or bad script


Re: Crashing[Urgent help please] - TonyII - 13.10.2013

Can you describe bad script?


Re: Crashing[Urgent help please] - PT - 13.10.2013

Quote:
Originally Posted by TonyII
View Post
Can you describe bad script?
something in GameMode, may be poorly made and crash players.

and the most probable it's be hack, i think


Re: Crashing[Urgent help please] - TonyII - 13.10.2013

Quote:
Originally Posted by PT
View Post
something in GameMode, may be poorly made and crash players.

and the most probable it's be hack, i think
What would be the main scripting failure to cause this do you have any idea?


Re: Crashing[Urgent help please] - Twizted - 13.10.2013

Can you show us the code you use to save weapons and last location?


Re: Crashing[Urgent help please] - JamesH - 13.10.2013

The main public is OnPlayerDisconnect
its splitted for 3 cases :

case 0 : timeout / crash

case 1 : leaving / /q

case 2 : kicked

Check out the public and try to figure out what's wrong.
You can post it here and I'll try to help more.


Re: Crashing[Urgent help please] - TonyII - 13.10.2013

Loading it
LoadUserData
pawn Code:
INI_Int("Weapon",PlayerInfo[playerid][pWeapon][0]);
    INI_Int("Ammo",PlayerInfo[playerid][pAmmo][0]);
    INI_Int("Weapon1",PlayerInfo[playerid][pWeapon][1]);
    INI_Int("Ammo1",PlayerInfo[playerid][pAmmo][1]);
    INI_Int("Weapon2",PlayerInfo[playerid][pWeapon][2]);
    INI_Int("Ammo2",PlayerInfo[playerid][pAmmo][2]);
    INI_Int("Weapon3",PlayerInfo[playerid][pWeapon][3]);
    INI_Int("Ammo3",PlayerInfo[playerid][pAmmo][3]);
    INI_Int("Weapon4",PlayerInfo[playerid][pWeapon][4]);
    INI_Int("Ammo4",PlayerInfo[playerid][pAmmo][4]);
    INI_Int("Weapon5",PlayerInfo[playerid][pWeapon][5]);
    INI_Int("Ammo5",PlayerInfo[playerid][pAmmo][5]);
    INI_Int("Weapon6",PlayerInfo[playerid][pWeapon][6]);
    INI_Int("Ammo6",PlayerInfo[playerid][pAmmo][6]);
    INI_Int("Weapon7",PlayerInfo[playerid][pWeapon][7]);
    INI_Int("Ammo7",PlayerInfo[playerid][pAmmo][7]);
    INI_Int("Weapon8",PlayerInfo[playerid][pWeapon][8]);
    INI_Int("Ammo8",PlayerInfo[playerid][pAmmo][8]);
    INI_Int("Weapon9",PlayerInfo[playerid][pWeapon][9]);
    INI_Int("Ammo9",PlayerInfo[playerid][pAmmo][9]);
    INI_Int("Weapon10",PlayerInfo[playerid][pWeapon][10]);
    INI_Int("Ammo10",PlayerInfo[playerid][pAmmo][10]);
    INI_Int("Weapon11",PlayerInfo[playerid][pWeapon][11]);
//POSITONS
    INI_Float("X", PlayerInfo[playerid][pPosX]);
    INI_Float("Y", PlayerInfo[playerid][pPosY]);
    INI_Float("Z", PlayerInfo[playerid][pPosZ]);
Saving under onplayerdisconnect
pawn Code:
GetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
    GetPlayerPos(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
    GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
    GetPlayerArmour(playerid,PlayerInfo[playerid][pArmor]);
    GetPlayerWeaponData(playerid,0,PlayerInfo[playerid][pWeapon][0],PlayerInfo[playerid][pAmmo][0]);
    GetPlayerWeaponData(playerid,1,PlayerInfo[playerid][pWeapon][1],PlayerInfo[playerid][pAmmo][1]);
    GetPlayerWeaponData(playerid,2,PlayerInfo[playerid][pWeapon][2],PlayerInfo[playerid][pAmmo][2]);
    GetPlayerWeaponData(playerid,3,PlayerInfo[playerid][pWeapon][3],PlayerInfo[playerid][pAmmo][3]);
    GetPlayerWeaponData(playerid,4,PlayerInfo[playerid][pWeapon][4],PlayerInfo[playerid][pAmmo][4]);
    GetPlayerWeaponData(playerid,5,PlayerInfo[playerid][pWeapon][5],PlayerInfo[playerid][pAmmo][5]);
    GetPlayerWeaponData(playerid,6,PlayerInfo[playerid][pWeapon][6],PlayerInfo[playerid][pAmmo][6]);
    GetPlayerWeaponData(playerid,7,PlayerInfo[playerid][pWeapon][7],PlayerInfo[playerid][pAmmo][7]);
    GetPlayerWeaponData(playerid,8,PlayerInfo[playerid][pWeapon][8],PlayerInfo[playerid][pAmmo][8]);
    GetPlayerWeaponData(playerid,9,PlayerInfo[playerid][pWeapon][9],PlayerInfo[playerid][pAmmo][9]);
    GetPlayerWeaponData(playerid,10,PlayerInfo[playerid][pWeapon][10],PlayerInfo[playerid][pAmmo][10]);
    GetPlayerWeaponData(playerid,11,PlayerInfo[playerid][pWeapon][11],PlayerInfo[playerid][pAmmo][11]);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Weapon",PlayerInfo[playerid][pWeapon][0]);
    INI_WriteInt(File,"Ammo",PlayerInfo[playerid][pAmmo][0]);
    INI_WriteInt(File,"Weapon1",PlayerInfo[playerid][pWeapon][1]);
    INI_WriteInt(File,"Ammo1",PlayerInfo[playerid][pAmmo][1]);
    INI_WriteInt(File,"Weapon2",PlayerInfo[playerid][pWeapon][2]);
    INI_WriteInt(File,"Ammo2",PlayerInfo[playerid][pAmmo][2]);
    INI_WriteInt(File,"Weapon3",PlayerInfo[playerid][pWeapon][3]);
    INI_WriteInt(File,"Ammo3",PlayerInfo[playerid][pAmmo][3]);
    INI_WriteInt(File,"Weapon4",PlayerInfo[playerid][pWeapon][4]);
    INI_WriteInt(File,"Ammo4",PlayerInfo[playerid][pAmmo][4]);
    INI_WriteInt(File,"Weapon5",PlayerInfo[playerid][pWeapon][5]);
    INI_WriteInt(File,"Ammo5",PlayerInfo[playerid][pAmmo][5]);
    INI_WriteInt(File,"Weapon6",PlayerInfo[playerid][pWeapon][6]);
    INI_WriteInt(File,"Ammo6",PlayerInfo[playerid][pAmmo][6]);
    INI_WriteInt(File,"Weapon7",PlayerInfo[playerid][pWeapon][7]);
    INI_WriteInt(File,"Ammo7",PlayerInfo[playerid][pAmmo][7]);
    INI_WriteInt(File,"Weapon8",PlayerInfo[playerid][pWeapon][8]);
    INI_WriteInt(File,"Ammo8",PlayerInfo[playerid][pAmmo][8]);
    INI_WriteInt(File,"Weapon9",PlayerInfo[playerid][pWeapon][9]);
    INI_WriteInt(File,"Ammo9",PlayerInfo[playerid][pAmmo][9]);
    INI_WriteInt(File,"Weapon10",PlayerInfo[playerid][pWeapon][10]);
    INI_WriteInt(File,"Ammo10",PlayerInfo[playerid][pAmmo][10]);
    INI_WriteInt(File,"Weapon11",PlayerInfo[playerid][pWeapon][11]);
    INI_WriteInt(File,"Ammo11",PlayerInfo[playerid][pAmmo][11]);
This works perfectly fine when they are not forcing disconnection with the server.

pawn Code:
stock SendDisconnectMsg(playerid,reason)
{

    new string[128];
    switch(reason)
    {

        case 0:
        {
            format(string,sizeof(string),"%s has crashed from the server.",RPN(playerid));
            ProxDetector(30, playerid, string, COLOR_YELLOW);

        }
        case 1:
        {
            format(string,sizeof(string),"%s has left the server.",RPN(playerid));
            ProxDetector(30, playerid, string, COLOR_YELLOW);
        }
        case 2:
        {
            format(string,sizeof(string),"%s has been kicked..",RPN(playerid));
            ProxDetector(30, playerid, string, COLOR_YELLOW);
        }

    }
}