MySQL Problems ...
#1

Hello,

I have a huge problem with my script.
Everything goes fine with the saving to database, loading and all other, BUT, there is a problem: on the server, id 1 and id 2 are connected to the server (this is an example). If id 1 quits, and someone else (or the same player) joins (it'll take id 1, ofc), the player with id 2 loses his stats (level, adminlevel, etc... they all get 0). This happens if any id with 1 lower connects, the next id loses his stats.
Why is that ?

This is a part of the script:

Код:
// mysql table = playerleveling
public LoadPlayerLeveling(playerid)
{
	new cereresql[80], row[512], pdata[9][32];
	format(cereresql, sizeof(cereresql), "SELECT * FROM playerleveling WHERE id=%d", PlayerInfo[playerid][pSQLID]);
	samp_mysql_query(cereresql);
	SQLLog(cereresql);
	samp_mysql_store_result();
	if (samp_mysql_num_rows() != 0)
	{
	    samp_mysql_fetch_row(row);
	    split(row, pdata, '|');
	    PlayerInfo[playerid][pLevel] = strvalEx(pdata[1]); //Level
	    PlayerInfo[playerid][pAdmin] = strvalEx(pdata[2]); ///AdminLevel
		PlayerInfo[playerid][pUpgrade] = strvalEx(pdata[3]); //UpgradePoints
		PlayerInfo[playerid][pConnectTime] = strvalEx(pdata[4]); //ConnectedTime
		PlayerInfo[playerid][pExp] = strvalEx(pdata[5]); //Respect
		PlayerInfo[playerid][pPayDay] = strvalEx(pdata[6]); //PayDay
		PlayerInfo[playerid][pPayDayHad] = strvalEx(pdata[7]); //PayDayHad
	    PlayerInfo[playerid][pPayCheck] = strvalEx(pdata[8]); //Paycheck
	}
	return 1;
}

public SavePlayerLeveling(playerid)
{
    new query[512],name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	format(query, sizeof(query), "UPDATE playerleveling SET PlayerLevel=%d, AdminLevel=%d, UpgradePoints=%d, ConnectedTime=%d, Respect=%d, PayDay=%d, PayDayHad=%d, Paycheck=%d WHERE id=%d",
	PlayerInfo[playerid][pLevel],//Level
	PlayerInfo[playerid][pAdmin], ///AdminLevel
	PlayerInfo[playerid][pUpgrade], //UpgradePoints
	PlayerInfo[playerid][pConnectTime], //ConnectedTime
	PlayerInfo[playerid][pExp], //Respect
	PlayerInfo[playerid][pPayDay], //PayDay
	PlayerInfo[playerid][pPayDayHad], //PayDayHad
    PlayerInfo[playerid][pPayCheck],//Paycheck
    PlayerInfo[playerid][pSQLID]);
    samp_mysql_query(query);
	SQLLog(query);
	printf("SavePlayerLeveling for %s", name);
	return 1;
}
Can someone help me, please ?
Reply


Messages In This Thread
MySQL Problems ... - by FlashInTheNighT - 24.10.2010, 08:44
Re: MySQL Problems ... - by Retardedwolf - 24.10.2010, 08:46
Re: MySQL Problems ... - by iJumbo - 24.10.2010, 08:46
Re: MySQL Problems ... - by FlashInTheNighT - 24.10.2010, 08:55
Re: MySQL Problems ... - by iJumbo - 24.10.2010, 09:06
Re: MySQL Problems ... - by FlashInTheNighT - 24.10.2010, 14:09
Re: MySQL Problems ... - by vection - 24.10.2010, 15:01
Re: MySQL Problems ... - by FlashInTheNighT - 24.10.2010, 15:42
Re: MySQL Problems ... - by FlashInTheNighT - 24.10.2010, 16:28
Re: MySQL Problems ... - by FlashInTheNighT - 28.10.2010, 20:48

Forum Jump:


Users browsing this thread: 1 Guest(s)