PDA

View Full Version : SQLite - Save position player


u3games
10/06/2013, 10:14 PM
Hi all ^^

My code:

new string[256];
new Float:posx;
new Float:posy;
new Float:posz;

GetPlayerPos(playerid, posx, posy, posz);
format(string, sizeof(string), "UPDATE `PLAYER` SET `POSX` = '%f' AND `POSY` = '%f' AND `POSZ` = '%f' WHERE NAME= '%s'", posx, posy, posz, DB_Escape(NamePlayer(playerid)));
db_free_result(db_query(Sqlite, string));

No save in Sqlite.db, code of table:

CREATE TABLE `PLAYER` (`NAME` VARCHAR(45), `SCORE` SMALLINT(5) DEFAULT 0, `KARMA` SMALLINT(5) DEFAULT 0, `POSX` FLOAT DEFAULT 0.0, `POSY` FLOAT DEFAULT 0.0, `POSZ` FLOAT DEFAULT 0.0, `SKIN` SMALLINT(3) DEFAULT 0);


PD: I create POSX, POSY and POSZ in table with Float. But not save, for default in db 0.0

Thx for all, waiting posible fix ;)

Knappen
10/06/2013, 10:55 PM
format(string, sizeof(string), "UPDATE `PLAYER` SET `POSX` = %f, `POSY` = %f, `POSZ` = %f WHERE `NAME`= '%s'", posx, posy, posz, DB_Escape(NamePlayer(playerid)));

u3games
10/06/2013, 11:22 PM
format(string, sizeof(string), "UPDATE `PLAYER` SET `POSX` = %f, `POSY` = %f, `POSZ` = %f WHERE `NAME`= '%s'", posx, posy, posz, DB_Escape(NamePlayer(playerid)));


Thx Knappen, work! ^^