17.01.2015, 02:48
NOTICE: The below code is using R39-2
Which can be found here: https://github.com/pBlueG/SA-MP-MySQL/releases
Which can be found here: https://github.com/pBlueG/SA-MP-MySQL/releases
pawn Code:
// Top of Script
enum PlayerStats // Add the below to your enumerator that stores player data.
{
pID, // Unique SQL ID - Change this to match your script.
pSkin // Player Skin
};
new P_Info[MAX_PLAYERS][PlayerStats];// Used to read from PlayerStats - Rename to your Global variable.
pawn Code:
// OnPlayerConnect
P_Info[playerid][pSkin] = 0;// Sets their skin to 0 when they connect, to avoid bugs later.
pawn Code:
// OnPlayerDisconnect
P_Info[playerid][pSkin] = GetPlayerSkin(playerid);
// Change WHERE `ID`=%d to whatever your script uses.
mysql_format(mysql, query, sizeof(query),"UPDATE `players` SET `Score`=%d WHERE `ID`=%d", P_Info[playerid][dPlate], P_Info[playerid][pID]);// Updates the Database with their skin ID.
mysql_tquery(mysql, query, "", "");
pawn Code:
// OnPlayerSpawn
SetPlayerSkin(playerid, P_Info[playerid][pSkin]);// For registered users use this. Registered users by defualt is 0 so use this accordingly in your script.
pawn Code:
// Under your User Account Load function. Usually called when they log in.
P_Info[playerid][pSkin] = cache_get_field_content_int(0, "Skin");