Quote:
Originally Posted by Riddick94
pawn Код:
stock OnPlayerLogin(playerid, password[]) { INI_ParseFile(PlayerFile(playerid), "GetPlayerPassword"); new PlayerPass[129], buf[150]; GetPVarString(playerid, "pPass", PlayerPass, 129); WP_Hash(buf, sizeof(buf), password); if(strcmp(PlayerPass, buf)) { new INI:Account; Account = INI_Open(PlayerFile(playerid));
INI_Close(Account);
PlayerInfo[playerid][pLogged] = true; TogglePlayerClock(playerid, true);
SendDeathMessage(INVALID_PLAYER_ID, playerid, ICON_CONNECT); SendFormattedMessageToAll(COLOR_WHITE, "*** %s [{FF003F}ID{FFFFFF}: {FF003F}%d{FFFFFF}] dołączył do serwera.", PlayerName(playerid), playerid); SendFormattedMessage(playerid, COLOR_LIMON, "{1BE03F}* Zalogowany jako {EDBC6D}%s {FFFFFF}[{FF003F}ID{FFFFFF}: {FF003F}%d{FFFFFF}]{1BE03F}. Witamy spowrotem na Polskim eXtra Serwerze!", PlayerName(playerid), playerid); }else{ new string[128]; format(string,sizeof(string),"{9EB8E8}Witamy ponownie {F2EE0C}%s{9EB8E8}. Proszę wpisać poniżej swoje hasło, aby zalogować się i grać:", PlayerName(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGOWANIE, DIALOG_STYLE_INPUT, "Logowanie", string, "Zaloguj", "Wyjdź"); GameTextForPlayer(playerid, " ~n~ ~n~ ~n~ ~n~ ~n~ ~r~Nieprawidlowe haslo!", SECONDS(3), 3); } return true; }
When i type good password (for sure) it's sending me a GameTextForPlayer. When i type bad password it's sending GameText too. Why?
P.S
I'm learning from the ready code. After that i'll analize Y_Ini fully you got my word. It's my first time when i'm making script with other script than DINI, so.. : )
|
I got my mouth shut by Y_Less, damn.
However, this happens because Password string is null.
Also, why are you doing this here? You don't write in file on login, you retrieve it.
pawn Код:
new INI:Account;
Account = INI_Open(PlayerFile(playerid));
INI_Close(Account);
Shouldn't this return 0? I mean it should have a ! in front so it matches!
pawn Код:
if(!strcmp(PlayerPass, buf))
Check first if the password has been retrieved from file successfully.