02.06.2013, 20:16
Hi. I'm trying to make my gamemode save player coordinates when they leave. When a player leaves, it saves everything BUT the coordinates. I tried checking if it actually got the coordinates, and it does. I used format & printf to print the coordinates, and it does indeed print the coordinates. In the MySQL database, I've tried using INT & Float datatypes, but neither of those worked.
pawn Код:
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);
new money = GetPlayerMoney(playerid);
new query[300], pname[24], string[35];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "UPDATE `playerdata` SET money='%d', vip='%d', posx='%i', posy='%i', posz='%i', posa='%i' WHERE user='%s'",
money,
PlayerInfo[playerid][pVip],
pname,
x,
y,
z,
a,
pname);
mysql_query(query);
format(string,sizeof(string),"%i, %i, %i, %i",x,y,z,a);
print(string);
}
return 1;
}