[SOLVED]OnPlayerLogin
#1

This is my code:

pawn Код:
public OnPlayerLogin(playerid, password[])
{
  new name[MAX_PLAYER_NAME], str[128], string[MAX_STRING];
  GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/CoDS/Accounts/%s.account", name);
    string = dini_Get(str, "Password");
   
    if(strcmp(string, password, true))
    {
        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;
}
The problem is, you can log in with anything as the password. I've been playing around with it but I can't get it to work.

EDIT: You can log in with anything but the right password lol. Not quite sure how to make it the right way round.
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)