Save position in MYSQL
#2

pawn Код:
new Float:x, Float:y, Float:z, query[200];
GetPlayerPos(playerid, x, y, z);
format(query, sizeof(query), "INSERT INTO `positions` (`x`, `y`, `z`) VALUES (%f, %f, %f)", x, y, z);
mysql_query(query);
NOTE: edit the "positions" to your db table name... and add the "float" value to the table rows..

edit: to update a certain row
pawn Код:
new Float:x, Float:y, Float:z, query[250], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerPos(playerid, x, y, z);
format(query, sizeof(query), "UPDATE `positions` SET `x`=%f AND `y`=%f AND `z`=%f WHERE `name`='%s'", x, y, z, name);
mysql_query(query);
^ This would update the positions of a certain name.. you can ofc also use IDs or w/e
Reply


Messages In This Thread
Save position in MYSQL - by Stefans94 - 01.07.2011, 10:28
Re: Save position in MYSQL - by Sascha - 01.07.2011, 10:31
[No subject] - by Stefans94 - 01.07.2011, 11:17
Re: Save position in MYSQL - by Sascha - 01.07.2011, 11:47
Re: Save position in MYSQL - by Stefans94 - 01.07.2011, 12:55
Re: Save position in MYSQL - by Stefans94 - 01.07.2011, 16:32
Re: Save position in MYSQL - by Sascha - 01.07.2011, 16:33
Re: Save position in MYSQL - by Stefans94 - 01.07.2011, 16:35
Re: Save position in MYSQL - by Sascha - 01.07.2011, 16:41
Re: Save position in MYSQL - by Stefans94 - 01.07.2011, 16:47

Forum Jump:


Users browsing this thread: 1 Guest(s)