[SOLVED]OnPlayerLogin
#10

I think this should be right.
pawn Код:
public OnPlayerLogin(playerid, password[])
{
  new name[MAX_PLAYER_NAME], str[128];
  GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/CoDS/Accounts/%s.account", name);
    if (strlen(password) < 2)
    {
      SendClientMessage(playerid, COLOR_RED, "Password can't be less than 1 Character");
      return 1;
    }
    if(strcmp(dini_Get(str, "Password"), password, false))
    {
        SendClientMessage(playerid, COLOR_RED, "Incorrect Password.");
      return 1;
    }
    AccountInfo[playerid][AdminLevel] = dini_Int(str, "AdminLevel");
  AccountInfo[playerid][MWeap1] = dini_Int(str, "MeleeWeap1");
  AccountInfo[playerid][PWeap1] = dini_Int(str, "PrimaryWeap1");
  AccountInfo[playerid][SWeap1] = dini_Int(str, "SecondaryWeap1");
  AccountInfo[playerid][SPWeap1] = dini_Int(str, "SpecialWeap1");
  AccountInfo[playerid][MWeap2] = dini_Int(str, "MeleeWeap2");
  AccountInfo[playerid][PWeap2] = dini_Int(str, "PrimaryWeap2");
  AccountInfo[playerid][SWeap2] = dini_Int(str, "SecondaryWeap2");
  AccountInfo[playerid][SPWeap2] = dini_Int(str, "SpecialWeap2");
  AccountInfo[playerid][Rank] = dini_Int(str, "Rank");
  AccountInfo[playerid][Kills] = dini_Int(str, "Kills");
  AccountInfo[playerid][Deaths] = dini_Int(str, "Deaths");
  AccountInfo[playerid][RoundsWon] = dini_Int(str, "RoundsWon");
 
    SetPlayerScore(playerid, AccountInfo[playerid][RoundsWon]);
    SpawnPlayer(playerid);
    printf("%s has logged in", name);
    AccountInfo[playerid][Logged] = 1;
    if (AccountInfo[playerid][AdminLevel] > 0)
    {
        format(str, sizeof str, "You have successfully logged in as %s [Admin level %d]", name, AccountInfo[playerid][AdminLevel]);
        SendClientMessage(playerid, COLOR_YELLOW, str);
    }
    else
    {
      format(str, sizeof str, "You have successfully logged in as %s", name);
      SendClientMessage(playerid, COLOR_YELLOW, str);
    }
    return 1;
}

Reply


Messages In This Thread
[SOLVED]OnPlayerLogin - by Gappy - 12.09.2009, 06:15
Re: [HELP]OnPlayerLogin - by Blades - 12.09.2009, 06:28
Re: [HELP]OnPlayerLogin - by Gappy - 12.09.2009, 06:32
Re: [HELP]OnPlayerLogin - by Blades - 12.09.2009, 06:35
Re: [HELP]OnPlayerLogin - by Gappy - 12.09.2009, 06:52
Re: [HELP]OnPlayerLogin - by Blades - 12.09.2009, 06:56
Re: [HELP]OnPlayerLogin - by Gappy - 12.09.2009, 07:04
Re: [HELP]OnPlayerLogin - by Blades - 12.09.2009, 07:07
Re: [HELP]OnPlayerLogin - by Gappy - 12.09.2009, 07:09
Re: [HELP]OnPlayerLogin - by Blades - 12.09.2009, 07:13

Forum Jump:


Users browsing this thread: 3 Guest(s)