12.05.2014, 03:15
(
Last edited by Deal-or-die; 12/05/2014 at 08:45 AM.
)
Cheers Mason but no go :/
I added a line to print my XYZ position On numerous cases, logged in, ran around for a bit and then logged out. Here are the results... Not good. :/
Cleaned up a lot of useless shit, made a spawning/saving stock and all works now.
I added a line to print my XYZ position On numerous cases, logged in, ran around for a bit and then logged out. Here are the results... Not good. :/
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
new query[128], Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f WHERE `ID`=%d", Player[playerid][Admin], Player[playerid][VIP], Player[playerid][Money], pos[0], pos[1], pos[2], Player[playerid][ID]);
mysql_tquery(mysql, query, "", "");
printf("OnPlayerDisconnect: X:%f Y:%f Z:%f", pos[0], pos[1], pos[2]);
return 1;
}
pawn Code:
public OnPlayerSpawn(playerid)
{
printf("OnPlayerSpawn: X:%f Y:%f Z:%f", Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ]);
// SetPlayerPos(playerid, Player[playerid][posX], Player[playerid][posZ], Player[playerid][posZ]);
//Set player's position to the last saved position.
return 1;
}
pawn Code:
public OnAccountLoad(playerid)
{
pInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin");
pInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP");
pInfo[playerid][Money] = cache_get_field_content_int(0, "Money");
pInfo[playerid][posX] = cache_get_field_content_float(0, "PosX");
pInfo[playerid][posY] = cache_get_field_content_float(0, "PosY");
pInfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");
GivePlayerMoney(playerid, pInfo[playerid][Money]);
printf("OnAccountLoad: X:%f Y:%f Z:%f", Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ]);
SendClientMessage(playerid, -1, "Successfully logged in");
return 1;
}
Code:
[12:01:39] OnAccountLoad: X:1370.969970 Y:264.326995 Z:19.566900 [12:01:39] OnPlayerSpawn: X:1370.969970 Y:264.326995 Z:19.566900 [12:02:08] OnPlayerDisconnect: X:1442.952758 Y:291.002258 Z:19.224281