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



Database bug - Lirbo - 12.04.2016

When a player is logging with the same ID as the previous player was it's loading the prev player's database instead of the right one


Re: Database bug - rappy93 - 12.04.2016

Can you show us the part of your code which handles loading player data upon log in?


Re: Database bug - Lirbo - 12.04.2016

Quote:
Originally Posted by rappy93
View Post
Can you show us the part of your code which handles loading player data upon log in?
http://pastebin.com/zQxEDiw0


Re: Database bug - Lirbo - 13.04.2016

bump


Re: Database bug - itsCody - 13.04.2016

You have to reset their stats upon disconnecting to prevent such things.


Re: Database bug - Lirbo - 13.04.2016

Quote:
Originally Posted by rappy93
View Post
Can you show us the part of your code which handles loading player data upon log in?
Quote:
Originally Posted by itsCody
View Post
You have to reset their stats upon disconnecting to prevent such things.
PHP Code:
public OnPlayerDisconnect(playeridreason)
{
    if(
Logged[playerid] == true){SavePlayerFile(playerid);}
    
ResetPlayerVariables(playerid);
    return 
1;

that's what i've currently.


Re: Database bug - itsCody - 13.04.2016

Show ResetPlayerVariables


Re: Database bug - Lirbo - 13.04.2016

Quote:
Originally Posted by itsCody
View Post
Show ResetPlayerVariables
whatchu mean?


Re: Database bug - Lirbo - 13.04.2016

Sorry for bumping again but I really need an answer asap


Re: Database bug - Godey - 13.04.2016

Quote:
Originally Posted by itsCody
View Post
Show ResetPlayerVariables
He means send the function of ResetPlayerVariables


Re: Database bug - Lirbo - 13.04.2016

Quote:
Originally Posted by Godey
View Post
He means send the function of ResetPlayerVariables
OMFG I'm so retarded I forgot to add all of the variables, btw EOS = end of string so what's End of Int? 0?

PHP Code:
stock ResetPlayerVariables(playerid)
{
    
DB[playerid][Password] = EOS;
    
Logged[playerid] = false;
    return 
1