MySQL Save
#1

Hi to all,
Today I come to ask for help because of my system MySQL. I will detail the system in a row, and then I'll show you what's wrong.

So I have a account system, a vehicle system and a houses system with MySQL. With regard to the accounts system, when a player is registered, the system is working, his information are stored in the database, and ditto for the connection information who are charging very well. However, this is the saved system who does not working. Nothing information is backup on the disconnection. It is the same for homes and vehicles, all loads, but nothing backup ..! Here are below the stock SaveAccountInfo (playerid)

http://pastebin.com/sXpRkCy9

In OnPlayerDisconnect I've make SaveAccountInfo (playerid);

I think i have give up enought information, if it misses made ​​me know
I thank all those who help me solve this case

Sorry for my bad english, i'm french student
@ +
And good script
Reply
#2

The string length is way too small. The query without the data is 401 characters long, your max string is 128, I recommend changing the string length to 1024.
Reply
#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
#4

I found where it comes from, and it's length. I tried to format but unanswered. I do not know if that's what did it:

PHP код:
new query[1024], infos[1024], pNom[24];
           
GetPlayerName(playeridpNomsizeof(pNom));
        
infos "UPDATE email='%s', niveau='%d', admin='%d', argent='%d', CI='%d', CINumber='%d', age='%d', sexe='%d', nationnalite='%d', faction='%d', leader='%d', rang='%d', job='%d', skin='%d', cartebancaire='%d', CCB='%d', CompteBancaire='%d' code='%d',";
        
format(querysizeof(query), "permis='%d', SpawnX='%f', SpawnY='%f', SpawnZ='%f', boissons='%d', mute='%d', interieur='%d', virtualworld='%d', ReportCount='%d', prison='%d', TempsPrison='%d', nourritures='%d', maisonkey='%d', mort='%d' WHERE username='%s'",
        
PlayerInfo[playerid][pEmail],
        
PlayerInfo[playerid][pNiveau],
        
PlayerInfo[playerid][pNiveauAdmin],
        
PlayerInfo[playerid][pArgent],
        
PlayerInfo[playerid][pCI],
        
PlayerInfo[playerid][pCINumber],
        
PlayerInfo[playerid][pAge],
        
PlayerInfo[playerid][pSexe],
        
PlayerInfo[playerid][pNation],
        
PlayerInfo[playerid][pFaction],
        
PlayerInfo[playerid][pLeader],
        
PlayerInfo[playerid][pRang],
        
PlayerInfo[playerid][pJob],
        
PlayerInfo[playerid][pSkin],
        
PlayerInfo[playerid][pCarteBanc],
        
PlayerInfo[playerid][pCCB],
        
PlayerInfo[playerid][pCompteBancaire],
        
PlayerInfo[playerid][pCode],
        
PlayerInfo[playerid][pPermis],
        
PlayerInfo[playerid][pPos_X],
        
PlayerInfo[playerid][pPos_Y],
        
PlayerInfo[playerid][pPos_Z],
        
PlayerInfo[playerid][pDrink],
        
PlayerInfo[playerid][pMuted],
        
PlayerInfo[playerid][pInt],
        
PlayerInfo[playerid][pVW],
        
PlayerInfo[playerid][ReportCount],
        
PlayerInfo[playerid][pPrison],
        
PlayerInfo[playerid][TempsPrison],
        
PlayerInfo[playerid][pFood],
        
PlayerInfo[playerid][pHouseKey],
        
PlayerInfo[playerid][pDeath],
        
pNom);
        
strcat(infosquery);
        
mysql_query(query); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)