SA-MP Forums Archive
Saving - 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: Saving (/showthread.php?tid=539995)



Mysql Register issue - TakeiT - 01.10.2014

When a player registers, it inserts their data into the database, as it should. However, when they log out, the database does not update. The weird thing is, I know its not my queries, because if I log back in, everything DOES save from then on. Just the first time an account is created. I'm assuming it has to do with my register function.

pawn Код:
public OnPlayerRegister(playerid)
{
    pInfo[playerid][Level] = 1;
    pInfo[playerid][Admin] = 0;
    pInfo[playerid][Skin] = 1;
    pInfo[playerid][Cash] = 5000; //These vars do not save the first time.

    GivePlayerMoney(playerid, 5000);
   
    SpawnPlayer(playerid);

    SetPlayerSkin(playerid, 1);


    return 1;
}



Re: Saving - paulommu - 01.10.2014

Well, maybe there's something like 'if(IsPlayerLoggedIn(playerid))' before the logout function, and the variable that stores the logged-in state isn't equal to TRUE, so the logout function isn't being called.


Re: Saving - TakeiT - 01.10.2014

Quote:
Originally Posted by paulommu
Посмотреть сообщение
Well, maybe there's something like 'if(IsPlayerLoggedIn(playerid))' before the logout function, and the variable that stores the logged-in state isn't equal to TRUE, so the logout function isn't being called.
No, there is not.


Re: Saving - Rudy_ - 02.10.2014

pawn Код:
public OnPlayerRegister(playerid)
{
    pInfo[playerid][Level] = 1;
    pInfo[playerid][Admin] = 0;
    pInfo[playerid][Skin] = 1;
    pInfo[playerid][Cash] = 5000; //These vars do not save the first time.

    GivePlayerMoney(playerid, 5000);
   
    SpawnPlayer(playerid);

    SetPlayerSkin(playerid, 1);


    return 1;
}
Where are you saving these?


Re: Saving - TakeiT - 02.10.2014

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
pawn Код:
public OnPlayerRegister(playerid)
{
    pInfo[playerid][Level] = 1;
    pInfo[playerid][Admin] = 0;
    pInfo[playerid][Skin] = 1;
    pInfo[playerid][Cash] = 5000; //These vars do not save the first time.

    GivePlayerMoney(playerid, 5000);
   
    SpawnPlayer(playerid);

    SetPlayerSkin(playerid, 1);


    return 1;
}
Where are you saving these?
Under OnPlayerDisconnect, and every 5 minutes (incase of server crash)

I tried adding the SavePlayer() function there, but it did not make a difference.


Re: Saving - TakeiT - 02.10.2014

I hate to bump this but it's really bugging me :S


Re: Saving - TakeiT - 04.10.2014

Still looking for a resolution to this issue