Mysql Position Save
#1

Hey Guys,
I have a problem with position save to mysql.
My DB is:
posx - Float
posy - Float
posz - Float
posarg - Float

Код:
enum pDataEnum
{
	pID,
	bool:pLoggedIn,
	pName[MAX_PLAYER_NAME],
	pPass,
	pLevel,
	pLeben,
	pHolz,
	pStein,
	pEisen,
	pMap,
	pRecht,
	pAlive,
	Float:pPosx,
	Float:pPosy,
	Float:pPosz,
	Float:pPosArg
};

public OnPlayerDisconnect(playerid, reason)
{
	SaveUserStats(playerid);
	return 1;
}

stock SaveUserStats(playerid)
{
	if(!PlayerInfo[playerid][pLoggedIn]) return 1;
	new Float:x, Float:y, Float:z, Float:ang;
	GetPlayerPos(playerid, x, y, z);
	GetPlayerFacingAngle(playerid, ang);
	PlayerInfo[playerid][pPosx] = x;
	PlayerInfo[playerid][pPosy] = y;
	PlayerInfo[playerid][pPosz] = z;
	PlayerInfo[playerid][pPosArg] = ang;
	PlayerInfo[playerid][pAlive] = 1;
	new query[256];
	mysql_format(handle, query, sizeof(query),"UPDATE users SET level = '%d', leben = '%d', holz = '%d', stein = '%d', eisen = '%d', map = '%d', recht = '%d', alive = '%d', posx = '%f', posy = '%f', posz = '%f', posarg = '%f' = WHERE id = '%d'",
		PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pLeben], PlayerInfo[playerid][pHolz], PlayerInfo[playerid][pStein], PlayerInfo[playerid][pEisen], PlayerInfo[playerid][pMap],
		PlayerInfo[playerid][pRecht], PlayerInfo[playerid][pAlive], PlayerInfo[playerid][pPosx], PlayerInfo[playerid][pPosy], PlayerInfo[playerid][pPosz], PlayerInfo[playerid][pPosArg], PlayerInfo[playerid][pID]);
 	mysql_pquery(handle, query);
	return 1;
}
Reply
#2

pawn Код:
", posz = '%f', posarg = '%f' = WHERE id = '%d'"
Error in syntax, remove = before WHERE
Reply
#3

Thanks It worked
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)