SetPlayerPos Problem
#1

Ok, so when a player disconnected, there x, y, z and rotation cord's get saved to a database, and if that player reconnects again, the x, y, z and rotation will be fetched, now this is working perfectly but when i'm setting the x, y, z on SetPlayerPos its not working.

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ]);
    SetPlayerFacingAngle(playerid, pInfo[playerid][posR]);
    pInfo[playerid][Spawned] = true;
    return 1;
}
Now the posX, posY, posZ, posR get set when the user log's in which are working as i've test doing
pawn Код:
printf("%f, %f, %f, %f", pInfo[playerid][posX], pInfo[playerid][poxY], pInfo[playerid][posZ], pInfo[playerid][posR]);
Here is the actuall code

pawn Код:
AuthPlayer(playerid)
{
    CheckMySQL();
    new
      Float: x,
      Float: y,
      Float: z,
      Float: r;
     
    format(query, 256, "SELECT firstspawn FROM `users` WHERE username = '%s'", PlayerName(playerid));
    mysql_query(query);
    mysql_store_result();
    new rows = mysql_num_rows();
    if (rows == 1)
    {
      format(query, 256, "SELECT x FROM `users` WHERE username = '%s' LIMIT 1", PlayerName(playerid));
      mysql_query(query);
      mysql_store_result();
      mysql_fetch_float(x);
     
      format(query, 256, "SELECT y FROM `users` WHERE username = '%s' LIMIT 1", PlayerName(playerid));
      mysql_query(query);
      mysql_store_result();
      mysql_fetch_float(y);
     
      format(query, 256, "SELECT z FROM `users` WHERE username = '%s' LIMIT 1", PlayerName(playerid));
      mysql_query(query);
      mysql_store_result();
      mysql_fetch_float(z);
     
      format(query, 256, "SELECT r FROM `users` WHERE username = '%s' LIMIT 1", PlayerName(playerid));
      mysql_query(query);
      mysql_store_result();
      mysql_fetch_float(r);
     
      printf("%f, %f, %f, %f", x, y, z, r); // Printing 143.452041, -68.172424, 1.429687, 267.565795 which is correct?
     
      pInfo[playerid][posX] = x;
      pInfo[playerid][posY] = y;
      pInfo[playerid][posZ] = z;
      pInfo[playerid][posR] = r;
    }
}
Am i doing anything wrong, because everything else is working perfect and to say its printing and setting the correct cords, i don't understand why it's not spawning the player in that position.
(I'm upgrading from dini!) (When the player spawns they fall through the map at 0.00000, 0.00000, 0.00000, 0.00000

And yes, my posX/Y/Z/R are floats.
Reply


Messages In This Thread
SetPlayerPos Problem - by Anwix - 21.02.2010, 20:16
Re: SetPlayerPos Problem - by Rizard - 21.02.2010, 21:16
Re: SetPlayerPos Problem - by Anwix - 21.02.2010, 23:22
Re: SetPlayerPos Problem - by Daren_Jacobson - 22.02.2010, 00:37
Re: SetPlayerPos Problem - by Anwix - 22.02.2010, 01:03
Re: SetPlayerPos Problem - by Anwix - 22.02.2010, 16:13
Re: SetPlayerPos Problem - by Anwix - 23.02.2010, 13:12

Forum Jump:


Users browsing this thread: 3 Guest(s)