PDA

View Full Version : [HELP] mysql acc


Luca12
19/05/2014, 07:44 PM
Hello today I was enter with few friend and all of us we are logged sucesfully and one of them can't logged in. And I go to his account and there is setted on 0 but yesterday he was enter fine if you know what I mean? Thanks

Luis-
19/05/2014, 10:02 PM
Could you possibly explain this a little better? What was set to zero?

Luca12
20/05/2014, 06:42 AM
for example he was yesterday enter as all variable fine he was lvl 5 he has skin id 7 spawnchachange on 1 registered on variable 1 tutorial on 1 and somehow all of that was become 0 when he was trying to log in to server and then I was go to his account and all of that was 0 skin leader member level money spawnchange registered tutorial admin job jobcontract ... etc. What could be a problem. Thanks

Luca12
20/05/2014, 11:30 AM
anyone? thanks

Luca12
21/05/2014, 07:48 AM
please anyone? thanks

BroZeus
21/05/2014, 07:50 AM
mind showing OnPlayerDisconnect
i think i know whats the probelm

Luca12
21/05/2014, 11:19 AM
here


mysql_format(mysql,query,sizeof(query),"UPDATE `users` SET `Level` = %d,`Money` = %d,`Registered` = %d,`SpawnChange` = %d,`Sex` = %d,`Years` = %d WHERE `ID` = '%d'",PlayerInfo[playerid][Level],
PlayerInfo[playerid][Money],PlayerInfo[playerid][Registered],PlayerInfo[playerid][SpawnChange],PlayerInfo[playerid][Sex],PlayerInfo[playerid][Years],PlayerInfo[playerid][ID]);
mysql_tquery(mysql,query,"","");

mysql_format(mysql,query,sizeof(query),"UPDATE `users` SET `Origin` = %d,`Skin` = %d,`Tutorial` = %d,`Member` = %d,`Leader` = %d WHERE `ID` = '%d'",PlayerInfo[playerid][Origin],
PlayerInfo[playerid][Skin],PlayerInfo[playerid][Tutorial],PlayerInfo[playerid][Member],PlayerInfo[playerid][Leader],PlayerInfo[playerid][ID]);
mysql_tquery(mysql,query,"","");

mysql_format(mysql,query,sizeof(query),"UPDATE `users` SET `Admin` = %d,`GameMaster` = %d,`Quiet` = %d,`AdminPlace` = %d,`Rank` = %d,`Bank` = %d WHERE `ID` = '%d'",PlayerInfo[playerid][Admin],
PlayerInfo[playerid][GameMaster],PlayerInfo[playerid][Quiet],PlayerInfo[playerid][AdminPlace],PlayerInfo[playerid][Rank],PlayerInfo[playerid][Bank],PlayerInfo[playerid][ID]);
mysql_tquery(mysql,query,"","");

BroZeus
22/05/2014, 11:00 AM
so the problem is that if player doesnt login and quits then also OnPlayerDisconnct is called so without logging in his skin and money are not loaded so it saves it as zero so solution to this is --

new bool:Logged[MAX_PLAYERS];//on top under includes

Logged[playerid]=true;//under OnPlayerSpawn

if(Logged[playerid]==true)//in OnPlayerDiscoonect
{
Logged[playerid]=false;
//now here the saving things onplayerdiscconect
}