23.05.2010, 19:26
Assuming you've set the 3 fields to be 'Floats' and not 'Ints' then it should go like this
You'd save it like this
To load it you'll need some way to parse the information, using sscanf or the split function will work
You'd save it like this
pawn Код:
new Float:x,Float:y,Float:z,query[64],pname[24];
GetPlayerPos(playerid,x,y,z);
GetPlayerName(playerid,pname,24);
format(query,64,"SELECT * FROM Table WHERE Name='%s' LIMIT 1",pname); //Check to make sure if the row already exists
mysql_query(query);
mysql_store_result();
if(mysql_num_rows()) //Row exists
{
format(query,64,"UPDATE Table SET X='%f', Y='%f', Z='%f' WHERE Name='%s'",x,y,z,pname);
}else{ //Row doesn't exist
format(query,64,"INSERT INTO Table (X,Y,Z,Name) VALUES('%f','%f','%f','%s')",x,y,z,pname);
}
mysql_query(query);