How to get the X, Y, Z floats and set the players position?
#4

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
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);
To load it you'll need some way to parse the information, using sscanf or the split function will work
Reply


Messages In This Thread
How to get the X, Y, Z floats and set the players position? - by NewTorran - 23.05.2010, 18:48
Re: How to get the X, Y, Z floats and set the players position? - by dice7 - 23.05.2010, 19:21
Re: How to get the X, Y, Z floats and set the players position? - by NewTorran - 23.05.2010, 19:22
Re: How to get the X, Y, Z floats and set the players position? - by Joe Staff - 23.05.2010, 19:26
Re: How to get the X, Y, Z floats and set the players position? - by Miguel - 23.05.2010, 19:54

Forum Jump:


Users browsing this thread: 1 Guest(s)