27.08.2013, 01:08
I was wondering if anyone could show me how to change from Y_INI to Mysql. I DO NOT want you to do it for me. I want you to show me how to do one or two and explain so I can do the rest. I've never used mySQL before so please explain in details.
Y_INI Code
Enum:
Loading data
Saving on Disconnect:
MySQL Database

I was wondering if someone could show me and explain in great detail how to save a few of these with MySQL
Note: If you need any extra information just ask. I cut out my IP for security reasons.
Quote:
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. |
Enum:
pawn Код:
enum pInfo
{
pName[MAX_PLAYER_NAME],
pPass,
pCash,
pSkin,
pAdmin,
pKills,
pDeaths,
aJailed,
bool:MaterialJob,
pMaterial,
pAdress[16]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Name", PlayerInfo[playerid][pName]);
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("aJailed",PlayerInfo[playerid][aJailed]);
INI_Bool("Material_Job",PlayerInfo[playerid][MaterialJob]);
INI_Int("Materials",PlayerInfo[playerid][pMaterial]);
INI_Int("IP_Adress",PlayerInfo[playerid][pAdress]);
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File, "Name", GetName(playerid) );
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid) );
INI_WriteInt(File,"aJailed",PlayerInfo[playerid][aJailed]);
INI_WriteBool(File,"Material_Job",PlayerInfo[playerid][MaterialJob]);
INI_WriteInt(File,"Materials",PlayerInfo[playerid][pMaterial]);
INI_WriteString(File,"IP_Adress",PlayerInfo[playerid][pAdress]);
INI_Close(File);

I was wondering if someone could show me and explain in great detail how to save a few of these with MySQL
Note: If you need any extra information just ask. I cut out my IP for security reasons.