21.02.2010, 20:16
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.
Now the posX, posY, posZ, posR get set when the user log's in which are working as i've test doing
Here is the actuall code
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.
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;
}
pawn Код:
printf("%f, %f, %f, %f", pInfo[playerid][posX], pInfo[playerid][poxY], pInfo[playerid][posZ], pInfo[playerid][posR]);
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;
}
}
(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.