MySQL Save
#3

See, I always found it better to put it in a UpdatePlayer(playerid);

However it could be different for yours, but try that, also, show me one of your cmd's that require sql? I had a similar issue once, until i put the query inside the cmd itself

Код:
public UpdatePlayer(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(gPlayerLogged[playerid])
	    {
	        MySQLCheckConnection();
			new string[256];
			format(UpdateQuery, sizeof(UpdateQuery), "UPDATE `userinfo` SET `Level`=%d",PlayerInfo[playerid][pLevel]);
			MySQLUpdatePlayerInt("Level", PlayerInfo[playerid][pLevel]);
			MySQLUpdatePlayerInt("AdminLevel",PlayerInfo[playerid][pAdmin]);
			MySQLUpdatePlayerInt("Banned",PlayerInfo[playerid][pBanned]);
            MySQLUpdatePlayerInt("Registered",PlayerInfo[playerid][pReg]);
            MySQLUpdatePlayerInt("Sex",PlayerInfo[playerid][pSex]);
            MySQLUpdatePlayerInt("Age",PlayerInfo[playerid][pAge]);
            MySQLUpdatePlayerInt("Origin",PlayerInfo[playerid][pOrigin]);
            MySQLUpdatePlayerInt("Logged", 0);
            format(string, sizeof(string), " WHERE `id`=%d;",PlayerInfo[playerid][pSQLID]);
            strcat(UpdateQuery, string);
            mysql_query(UpdateQuery);
			//Now for the strings and floats
			//format(UpdateQuery), sizeof(UpdateQuery), "UPDATE `userstrings` SET`Cash`=%d", GetPlayerMoneyEx(playerid); Save this though
			MySQLUpdatePlayerStr("Password", PlayerInfo[playerid][pKey]);
			format(string, sizeof(string), ", `Account`=%d", PlayerInfo[playerid][pAccount]);
			strcat(UpdateQuery, string);
            MySQLUpdatePlayerFlo("LogX",PlayerInfo[playerid][pLogX]);
            MySQLUpdatePlayerFlo("LogY",PlayerInfo[playerid][pLogY]);
            MySQLUpdatePlayerFlo("LogZ",PlayerInfo[playerid][pLogZ]);
            MySQLUpdatePlayerFlo("LogA",PlayerInfo[playerid][pLogA]);
            MySQLUpdatePlayerFlo("SpawnHealth",PlayerInfo[playerid][pSHealth]);
            MySQLUpdatePlayerFlo("SpawnArmor",PlayerInfo[playerid][pSArmour]);
            MySQLUpdatePlayerFlo("Birthdate",PlayerInfo[playerid][pBirthdate]);
            new year,month,day;
            getdate(year,month,day);
            format(string, sizeof(string), "%d-%d-%d", year,month,day);
            MySQLUpdatePlayerStr("LastLogin", string);
		}
	}
	return 1;
}
Reply


Messages In This Thread
MySQL Save - by Keviin - 02.05.2014, 16:07
Re: MySQL Save - by Smally - 02.05.2014, 16:47
Re: MySQL Save - by Jay_Dixon - 02.05.2014, 16:48
Re: MySQL Save - by Keviin - 03.05.2014, 09:42

Forum Jump:


Users browsing this thread: 2 Guest(s)