public OnPlayerLogin(playerid,password[])
{
  new string2[64];
  new playername3[MAX_PLAYER_NAME];
  GetPlayerName(playerid, playername3, sizeof(playername3));
  format(string2, sizeof(string2), "/Users/%s.ini", playername3);
  if (dini_Exists(string2))
  {
    new password2 = num_hash(password);
    if(dini_Int(string2,"Password") == password2)
    {
      pInfo[playerid][Pass] = dini_Int(string2,"Password");
      pInfo[playerid][Admin] = dini_Int(string2,"Admin");
      pInfo[playerid][Cash] = dini_Int(string2,"Cash");
      pInfo[playerid][Vip] = dini_Int(string2,"Vip");
      pInfo[playerid][Scores] = dini_Int(string2,"Scores");
      pInfo[playerid][Deaths] = dini_Int(string2,"Deaths");
      pInfo[playerid][Nopm] = dini_Int(string2,"Nopm");
      pInfo[playerid][Muted] = dini_Int(string2,"Muted");
      pInfo[playerid][Vip] = dini_Int(string2,"Vip");
      pInfo[playerid][Banned] = dini_Int(string2,"Banned");
      pInfo[playerid][Cookies] = dini_Int(string2,"Cookies");
      pInfo[playerid][Warn] = dini_Int(string2,"Warn");
      pInfo[playerid][Jailed] = dini_Int(string2,"Jailed");
      pInfo[playerid][Logged] = dini_Int(string2,"Logged");
      pInfo[playerid][AdminActions] = dini_Int(string2,"AdminActions");
      pInfo[playerid][Rank] = dini_Int(string2,"Rank");
      pInfo[playerid][TempBan] = dini_Int(string2,"TempBan");
      GivePlayerMoney(playerid, pInfo[playerid][Cash]);
      SetPlayerScore(playerid, pInfo[playerid][Scores]);
      pInfo[playerid][Logged] = 1;
      SetTimerEx("CheckBan", 1500, false, "i", playerid);
      SetTimerEx("CheckTempBan", 1500, false, "i", playerid);
      new string[150];
      format(string,sizeof(string),"System: Logged in as {F70505}%s {FFFFFF}- Level: {F70505}%d",AdminLevelToName(playerid),pInfo[playerid][Admin]);
      SCM(playerid,-1,string);
    }
    else
    {
      new Year, Month, Day, Hour, Minute, Second;
      getdate(Year, Month, Day);
      gettime(Hour, Minute, Second);
      new echo[270];
      new kname[24];
      GetPlayerName(playerid, kname, 24);
      new IP[16];
      GetPlayerIp(playerid, IP, 16);
      format(echo,sizeof(echo),"0,3%s (%d) (IP: %s) failed to login in his account - %02d:%02d:%02d - %02d:%02d:%02d",kname,playerid,IP,Day,Month,Year,Hour,Minute,Second);
      FailedLogins(echo);
      gPlayerLogTries[playerid] += 1;
      ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,"Login","Incorrect password.","Login","Quit");
      if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
      return 1;
    }
  }
  return 1;
}
if(pInfo[playerid][Logged] == 1)
  {
    new file[64];
    new playername3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));
    format(file, sizeof(file), "/Users/%s.ini", playername3);
    dini_IntSet(file, "Admin",pInfo[playerid][Admin]);
    dini_IntSet(file, "Cash",pInfo[playerid][Cash]);
    dini_IntSet(file, "Vip",pInfo[playerid][Vip]);
    dini_IntSet(file, "Scores",pInfo[playerid][Scores]);
    dini_IntSet(file, "Deaths",pInfo[playerid][Deaths]);
    dini_IntSet(file, "Nopm",pInfo[playerid][Nopm]);
    dini_IntSet(file, "Muted",pInfo[playerid][Muted]);
    dini_IntSet(file, "Vip",pInfo[playerid][Vip]);
    dini_IntSet(file, "Banned",pInfo[playerid][Banned]);
    dini_IntSet(file, "Cookies",pInfo[playerid][Cookies]);
    dini_IntSet(file, "Warn",pInfo[playerid][Warn]);
    dini_IntSet(file, "Jailed",pInfo[playerid][Jailed]);
    dini_IntSet(file, "Logged",pInfo[playerid][Logged]);
    dini_IntSet(file, "AdminActions",pInfo[playerid][AdminActions]);
    dini_IntSet(file, "Rank",pInfo[playerid][Rank]);
    dini_IntSet(file, "TempBan",pInfo[playerid][TempBan]);
    return 1;
  }
public OnPlayerConnect(playerid)
{
  if(fexist(UserPath(playerid)))
  {
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
  }
  else
  {
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
  }
  return 1;
}
new string[128];
  new plname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, plname, sizeof(plname));
  format(string, sizeof(string), "/Users/%s.ini", plname);
 Â
  if (dini_Exists(string))
  {
  ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,"Login","This account is registered, please input your password to login.","Login","Quit");
  }
  else
  {
  ShowPlayerDialog(playerid, 1246, DIALOG_STYLE_INPUT,"Register","Please insert your password to create a new account.","Register","Quit");
  }
if(pInfo[playerid][Logged] == 1)
  {
    new file[64];
    new playername3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));
    format(file, sizeof(file), "/Users/%s.ini", playername3);
    dini_IntSet(file, "Admin",pInfo[playerid][Admin]);
    dini_IntSet(file, "Cash",GetPlayerMoney(playerid));
    dini_IntSet(file, "Vip",pInfo[playerid][Vip]);
    dini_IntSet(file, "Scores",GetPlayerScore(playerid));
    dini_IntSet(file, "Deaths",pInfo[playerid][Deaths]);
    dini_IntSet(file, "Nopm",pInfo[playerid][Nopm]);
    dini_IntSet(file, "Muted",pInfo[playerid][Muted]);
    dini_IntSet(file, "Vip",pInfo[playerid][Vip]);
    dini_IntSet(file, "Banned",pInfo[playerid][Banned]);
    dini_IntSet(file, "Cookies",pInfo[playerid][Cookies]);
    dini_IntSet(file, "Warn",pInfo[playerid][Warn]);
    dini_IntSet(file, "Jailed",pInfo[playerid][Jailed]);
    dini_IntSet(file, "Logged",pInfo[playerid][Logged]);
    dini_IntSet(file, "AdminActions",pInfo[playerid][AdminActions]);
    dini_IntSet(file, "Rank",pInfo[playerid][Rank]);
    dini_IntSet(file, "TempBan",pInfo[playerid][TempBan]);
    return 1;
  }
use GetPlayerMoney(playerid) to get the money of the player, and GetPlayerScore(playerid) for the score, for the rest the code seems fine.
|
dini_IntSet(file, "Cash",pInfo[playerid][Cash]);
dini_IntSet(file, "Scores",pInfo[playerid][Scores]);
dini_IntSet(file, "Cash",GetPlayerMoney(playerid));
dini_IntSet(file, "Scores",GetPlayerScore(playerid));
dini_IntSet(file, "Cash",GetPlayerMoney(playerid));
forward playerGiveMoney(playerid, amount);
public playerGiveMoney(playerid, amount)
{
  pInfo[playerid][Cash] += amount;
  GivePlayerMoney(playerid, amount);
}
dini_IntSet(file, "Cash", pInfo[playerid][Cash]);