stock SaveStats(playerid) { new query[156]; new Float:pX, Float:pY, Float:pZ; GetPlayerPos(playerid, pX, pY, pZ); format(query, sizeof(query), "UPDATE playerdata SET PosX=%f AND PosY=%f AND PosZ=%f WHERE Name='%s'", pX, pY, pZ, GetName(playerid)); mysql_query(query); printf("Player Saved"); return 1; }
stock LoadStats(playerid) { new Query[80]; format(Query, sizeof(Query), "SELECT * FROM playerdata WHERE Name = '%s'", GetName(playerid)); mysql_query(Query); mysql_store_result(); mysql_fetch_row_format(Query, "|"); sscanf(Query, "e<p<|>s[24]s[23]iiiiiii>", PlayerInfo[playerid]); mysql_free_result(); GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]); SetPlayerScore(playerid, PlayerInfo[playerid][Level]); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][Skin], PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z], 0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); return 1; }
public OnPlayerDisconnect( playerid, reason )
{
GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
GetPlayerFacingAngle( playerid, Angle[ playerid ] );
new INI:File = INI_Open( user_ini_file( playerid ) );
INI_SetTag( File, "position" );
INI_WriteFloat( File, "PositionX", PosX[ playerid ] );
INI_WriteFloat( File, "PositionY", PosY[ playerid ] );
INI_WriteFloat( File, "PositionZ", PosZ[ playerid ] );
INI_WriteFloat( File, "Angle", Angle[ playerid ] );
INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) );
INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) );
INI_Close( File );
return ( 1 );
}
format(query, sizeof(query), "UPDATE playerdata SET PosX=%f, PosY=%f, PosZ=%f WHERE Name='%s'", pX, pY, pZ, GetName(playerid));
[21:40:02] Number of vehicle models: 0 [21:40:22] Incoming connection: 127.0.0.1:63873 [21:40:22] [join] Jason_Smith has joined the server (0:127.0.0.1) [21:40:26] sscanf warning: String buffer overflow. [21:40:26] [debug] Run time error 6: "Invalid instruction" [21:40:26] [debug] Unknown opcode 0x1000000 at address 0x0000004D [21:40:26] [debug] AMX backtrace: [21:40:26] [debug] #0 0000004d in public OnDialogResponse () from RP_Mysql.amx [21:40:38] Player Saved [21:40:38] [part] Jason_Smith has left the server (0:1) |