[Help]Problem With Account System
#1

Hi SA:MP Community !
I'm using Y_INI to save player data !
nowadays i have a problem.
a player register and leave server ... after if a player join server , system load the last person who registered !
e.g. server runned !
someone join the server by " Player1 " Nick and register by 123 password !
after leave Player1 if someone that registered before join the server, server say : your password is incorrect beCause system loaded Player1 data and expects enter 123 to login !!
everywhere that i used INI_Open , after writing files , i Closed it !


pawn Код:
// My Load Function
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("BankCash",PlayerInfo[playerid][pBankCash]);
    INI_Int("HaveATM",PlayerInfo[playerid][pHaveATM]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Vip",PlayerInfo[playerid][pVip]);
    INI_Int("AdminExpire",PlayerInfo[playerid][pAdminExpireTime]);
    INI_Int("VipExpire",PlayerInfo[playerid][pVipExpireTime]);
    INI_Int("Respect",PlayerInfo[playerid][pRespect]);
    INI_Int("Playtime",PlayerInfo[playerid][pTime]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Banned",PlayerInfo[playerid][pBanned]);
    INI_Int("TempBanned",PlayerInfo[playerid][pTempBanned]);
    INI_Int("TempBanTime",PlayerInfo[playerid][pTempBanTime]);
    INI_Int("POC",PlayerInfo[playerid][pPOC]);
    INI_Int("Bombs",PlayerInfo[playerid][pBombs]);
    INI_Int("Reports",PlayerInfo[playerid][pReports]);
    INI_Int("Wanted",PlayerInfo[playerid][pWanted]);
    INI_Int("Zone",PlayerInfo[playerid][pZone]);
    INI_Int("Weed",PlayerInfo[playerid][pWeed]);
    INI_String("Email",PlayerInfo[playerid][pEmail],64);
    INI_Int("Jailed",PlayerInfo[playerid][pJailed]);
    INI_Int("JailTime",PlayerInfo[playerid][pJailTime]);
    INI_Int("PolicePunish",PlayerInfo[playerid][pPolicePunish]);
    INI_Int("CanPolice",PlayerInfo[playerid][pCanPolice]);
    INI_Int("TeamID",PlayerInfo[playerid][pTeamID]);
    INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    INI_Int("NameTag",PlayerInfo[playerid][pNameTag]);
    INI_String("DeathPM",PlayerInfo[playerid][pDeathPM],32);
    INI_String("Banreason",PlayerInfo[playerid][pBanreason],64);
    INI_Float( "LastX",PlayerInfo[playerid][pLastX]);
        INI_Float( "LastY",PlayerInfo[playerid][pLastY]);
        INI_Float( "LastZ",PlayerInfo[playerid][pLastZ]);
    INI_Int("LastInterior",PlayerInfo[playerid][pLastInterior]);
    INI_Int("LastVW",PlayerInfo[playerid][pLastVW]);
    INI_Int("PDETimeLimit",PlayerInfo[playerid][pPDETimeLimit]);
    return 1;
}

// My PATH And Stock >>

#define PATH "/Users/%s.ini"

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}

Please Help Me !
Thank you !
Reply
#2

Show OnPlayerDisconnect
Reply
#3

I Sent You Full OnPlayerDisconnect !
Check your pm!
Reply
#4

Nvm...
Reply
#5

nobody
Reply
#6

Any help
Please ? :/
Reply
#7

Show us ur OnPlayerConnect.
Reply
#8

ok i don't find anything wrong but you might want to fix this
pawn Код:
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
    INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
change to
pawn Код:
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
Only these 2, and show me your OnPlayerConnect. Just post it here so others can help too
Reply
#9

I have Server Side Money And Score and give player score or money and save to variables!

pawn Код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
   INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
   ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{C2FF33}Login To Server","{FF6633}Enter Your Password To login","Login","Exit");
}
else
{
 SendClientMessage(playerid,~0,"{FFCC00}[SERVER]: {FF3232}Register An Account!");
 ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"{339933}Registration","{C2FF33}Enter A Password Below to register","Register","Cancel");
}
if(fexist(PHousePath(playerid)))
{
  INI_ParseFile(PHousePath(playerid), "LoadPHouse_%s", .bExtra = true, .extra = playerid);
}

//>After loading user data and user house data i reset the variables and check if player banned kick him/her |

  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)