Skin saving MySQL
#2

NOTICE: The below code is using R39-2
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");
Reply


Messages In This Thread
Skin saving MySQL - by vassilis - 17.01.2015, 01:55
Re: Skin saving MySQL - by Lynn - 17.01.2015, 02:48
Re: Skin saving MySQL - by vassilis - 17.01.2015, 03:18
Re: Skin saving MySQL - by Lynn - 17.01.2015, 03:23
Re: Skin saving MySQL - by biker122 - 17.01.2015, 03:29
Re: Skin saving MySQL - by vassilis - 17.01.2015, 03:33
Re: Skin saving MySQL - by biker122 - 17.01.2015, 03:44
Re: Skin saving MySQL - by Lynn - 17.01.2015, 03:49
Re: Skin saving MySQL - by biker122 - 17.01.2015, 03:53
Re: Skin saving MySQL - by Lynn - 17.01.2015, 04:03

Forum Jump:


Users browsing this thread: 1 Guest(s)