MySQl UPDATE on playerdisconnect ERROR ID: 1064
#1

Hey this is my first post and first gmamode im building i finally got MySQL set up but when player disocnnect is not saving all the information. I checked the Debug and this is what im getting

[12:54:42] CMySQLHandler::Query(UPDATE playerdata SET score=0, money=1999700, level=0, vip=0, kma=0, rank=0, kills=0, deaths=0, muted=0, jailed=0, frozen=0, mutedtimes=0, jailedtimes=0, frozentimes=0, banned=0, bannedby='', logins=10, posx=109.813926, posy=-120.258743, posz=1.578125, posa=315.819549 WHERE user='Bernard_Montgomer) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Bernard_Montgomer' at line 1)

this is my OnPlayerDisconnect . . if any more of the code is needed let me know

Код:
public OnPlayerDisconnect(playerid, reason)
{

    if(Logged[playerid] == 1)
    {
        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        PlayerInfo[playerid][pPosX] = x;
        PlayerInfo[playerid][pPosY] = y;
        PlayerInfo[playerid][pPosZ] = z;
        PlayerInfo[playerid][pPosA] = a;
        new score = GetPlayerScore(playerid);
        new money = GetPlayerMoney(playerid);
        new query[300], pname[24];
        GetPlayerName(playerid, pname, 24);
        format(query, sizeof(query), "UPDATE playerdata SET score=%d, money=%d, level=%d, vip=%d, kma=%d, rank=%d, kills=%d, deaths=%d, muted=%d, jailed=%d, frozen=%d, mutedtimes=%d, jailedtimes=%d, frozentimes=%d, banned=%d, bannedby='%s', logins=%d, posx=%f, posy=%f, posz=%f, posa=%f  WHERE user='%s'",
		score,
		money,
		PlayerInfo[playerid][pLevel],
		PlayerInfo[playerid][pVIP],
		PlayerInfo[playerid][pKMA],
		PlayerInfo[playerid][pRank],
		PlayerInfo[playerid][pKills],
		PlayerInfo[playerid][pDeaths],
		PlayerInfo[playerid][pMuted],
		PlayerInfo[playerid][pJailed],
		PlayerInfo[playerid][pFrozen],
		PlayerInfo[playerid][pMutedTimes],
		PlayerInfo[playerid][pJailedTimes],
		PlayerInfo[playerid][pFrozenTimes],
		PlayerInfo[playerid][pBanned],
		PlayerInfo[playerid][pBannedBy],
		PlayerInfo[playerid][pLogins],
  		PlayerInfo[playerid][pPosX],
        PlayerInfo[playerid][pPosY],
        PlayerInfo[playerid][pPosZ],
        PlayerInfo[playerid][pPosA],
		pname);
        mysql_query(query);
    }
    return 1;
}
Reply
#2

Quote:

UPDATE playerdata SET score=0, money=1999700, level=0, vip=0, kma=0, rank=0, kills=0, deaths=0, muted=0, jailed=0, frozen=0, mutedtimes=0, jailedtimes=0, frozentimes=0, banned=0, bannedby='', logins=10, posx=109.813926, posy=-120.258743, posz=1.578125, posa=315.819549 WHERE user='Bernard_Montgomer'
It's missing the last ' to close the argument. Most likely has to do with the query array size. Increase 300 to 350 so it doesn't get cut by accident.
Reply
#3

AWESOME THX for the quick reply! worked perfectly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)