29.10.2013, 19:54
Somehow mysql wont save my infromation, when i disconnect.
Debug says that -
Can just somebody help me, i have tried to fix this a couple of hours.
Disconnect code
Debug says that -
pawn Code:
CMySQLHandler::Query(UPDATE playerdata SET score=0, money=7000, skin=299, posx=-1899.979248, posy=212.204940, posz=37.849018, adminlvl=3434, auaste=0, grupeering=0, virtworld=0, interior=0, firmavхti=0, majavхti=0, ajail=109, ajailtime=0, rahapangas=0, atmkey=0 WHERE user='') - Successfully executed.
Disconnect code
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
if(Logged[playerid] == 1)
{
//If the player disconnects before registering,
//we want to make sure it doesn't try update
//so we check if the player is logged in.
new score = GetPlayerScore(playerid); //Gets players score
new money = GetPlayerMoney(playerid); //Gets players money
new skin = GetPlayerSkin(playerid);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new auaste = PlayerInfo[playerid][pRank];
new grupeering = PlayerInfo[playerid][pMember];
new adminlvl = PlayerInfo[playerid][pAdmin];
new virtw = GetPlayerVirtualWorld(playerid);
new inter = GetPlayerInterior(playerid);
new firv6ti = PlayerInfo[playerid][pFirmav6ti];
new majav6ti = PlayerInfo[playerid][pMajav6ti];
new ajail = PlayerInfo[playerid][pAjail];
new ajailtime = PlayerInfo[playerid][pAjailtime];
new rahapangas = PlayerInfo[playerid][pRahapangas];
new atmkey = PlayerInfo[playerid][pAtmpass];
new query[700], pname[24]; //Creates the variables
GetPlayerName(playerid, pname, 24); //Gets the players name.
format(query, sizeof(query), "UPDATE playerdata SET score=%d, money=%d, skin=%d, posx=%f, posy=%f, posz=%f, adminlvl=%d, auaste=%d, grupeering=%d, virtworld=%d, interior=%d, firmavхti=%d, majavхti=%d, ajail=%d, ajailtime=%d, rahapangas=%d, atmkey=%d WHERE user='%s'", score, money,skin, x, y, z, adminlvl,auaste, grupeering, virtw, inter,firv6ti,majav6ti, pname, ajail, ajailtime, rahapangas, atmkey);
mysql_query(query);
//No need to store a result for a update string
}
return 1;
}