12.09.2009, 06:15
This is my code:
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.
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;
}
EDIT: You can log in with anything but the right password lol. Not quite sure how to make it the right way round.