12.10.2011, 02:01
My account system is using Y_INI
I wanted each player to start off with 10,000$. But its not saving, nor is the skin, i hve searched but to no avail i havent found a fix, or anything that has helped me. If someone can direct me to where i can get this fixed, or tell me or explain to me how to fix it here it would be very appreciated.
Register Dialog
OnPlayerDisconnect
SaveUserData
I wanted each player to start off with 10,000$. But its not saving, nor is the skin, i hve searched but to no avail i havent found a fix, or anything that has helped me. If someone can direct me to where i can get this fixed, or tell me or explain to me how to fix it here it would be very appreciated.
Register Dialog
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Level",1);
INI_WriteInt(File,"Cash",GivePlayerMoney(playerid, 10000));
INI_WriteInt(File,"Sex",0);
INI_WriteInt(File,"Age",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Leader",0);
INI_WriteInt(File,"Rank",0);
INI_WriteInt(File,"Team",0);
INI_WriteInt(File,"Member",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"VIP",0);
INI_WriteInt(File,"Muted",0);
INI_WriteInt(File,"Tutorial",0);
INI_WriteInt(File,"Mute Time",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
new sex[] = " Male \n Female ";
ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST, "Please selecet your Gender", sex, "Select","Quit Game");
}
}
OnPlayerDisconnect
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
GetPlayerMoney(playerid);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLeader]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Member",PlayerInfo[playerid][pMember]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted]);
INI_WriteInt(File,"Tutorial",PlayerInfo[playerid][pTut]);
INI_WriteInt(File,"Mute Time",PlayerInfo[playerid][pMuteTime]);
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pLocked]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
pawn Код:
public SaveUserData(playerid)
{
new PlayerName[MAX_PLAYERS];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Sex",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,"Leader",PlayerInfo[playerid][pLeader]);
INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
INI_WriteInt(File,"Team",PlayerInfo[playerid][pTeam]);
INI_WriteInt(File,"Member",PlayerInfo[playerid][pMember]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted]);
INI_WriteInt(File,"Tutorial",PlayerInfo[playerid][pTut]);
INI_WriteInt(File,"Mute Time",PlayerInfo[playerid][pMuteTime]);
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pLocked]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
printf("[userdata] Player Data of %s has been saved.", PlayerName);
return 1;
}