14.01.2014, 18:10
Well if you want to save his position under OnPlayerConnect, you can do this:
orm_addvar_float(ormid, pInfo[playerid][LastX], "LastX"); - Make sure ormid is defined correctly.
Alternatively you can use mysql_tquery, I'll let you see a snippet of my /savepos command (same concept):
There's a tutorial somewhere on how to use MySQL r34, look up "MySQL R34 ORM Usage".
If you want to -load- the co-ordinates, do this:
SELECT * FROM `accounts` WHERE `PosX` = '%f', `PosY` = '%f' AND `PosZ` = '%f' WHERE `Name` = '%s'
orm_addvar_float(ormid, pInfo[playerid][LastX], "LastX"); - Make sure ormid is defined correctly.
Alternatively you can use mysql_tquery, I'll let you see a snippet of my /savepos command (same concept):
pawn Код:
new query[256];
GetPlayerPos(playerid, Player[playerid][PosX], Player[playerid][PosY], Player[playerid][PosZ]);
GetPlayerFacingAngle(playerid, Player[playerid][PosA]);
format(query, sizeof(query), "UPDATE `players` SET `PosX` = '%f', `PosY` = '%f', `PosZ` = '%f', `PosA` = '%f' WHERE `username` = '%s' LIMIT 1", Player[playerid][PosX], Player[playerid][PosY], Player[playerid][PosZ], Player[playerid][PosA], getName(playerid));
printf("\n %s", query); // printing to make sure the co-ords are being sent.
mysql_tquery(SQL, query, "", "");
If you want to -load- the co-ordinates, do this:
SELECT * FROM `accounts` WHERE `PosX` = '%f', `PosY` = '%f' AND `PosZ` = '%f' WHERE `Name` = '%s'

