Login pass incorrect when adminlevel > 0
#1

Hi guys and this is my first post

So , i have just installed a gamemode on my linux VPS , but an error occurs when i tried to login to server with my adminlevel more than 0.
The server said that my password is incorrect, but i'm 100% sure that my password is correct.
The error didn't happen when i tried to login with my adminlevel=0 and also when i'm testing it on my localhost windows server. It's work fine and i can login and use admin commands whilst my adminlevel is more than 0.

PS : the linux server started without any error in server log ( i have already installed nativechecker and crashdetect plugin ) and i'm using whirlpool to encrypt the password.

Here is the login script :

Код:
public OnPlayerLoginAttempt(playerid, password[])
{
	new string[128], Year, Month, Day, Minute, Hour, Second, Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Name, sizeof(Name));
	format(string, sizeof(string), "Accounts/%s.ini", Name);

	if(Player[playerid][LoginAttempts] == 3)
	{
	    new hour, minute, second, day, year, month;
        gettime(hour, minute, second);
        getdate(year, month, day);
        #pragma unused second
	    new IP[21];
	    GetPlayerIp(playerid, IP, sizeof(IP));
		format(string, sizeof(string), "%d/%d/%d | %d:%d | %s | %s | THREE FAILED PASSWORD ATTEMPTS | System", day, month, year, hour, minute, IP, Name);
		AdminActionsLog(string);
	    SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
	    Kick(playerid);
	}

	getdate(Year, Month, Day);
	gettime(Hour, Minute, Second);

	if(fexist(string))
	{
		new pwhf[129];
	    WP_Hash(pwhf, sizeof (pwhf), password);
	    if(strcmp(dini_Get(string, "Password"), pwhf, false) == 0)
	    {
	        MaxLoggedIn++;
	        Player[playerid][Authenticated] = 1;
	        Player[playerid][Password] = dini_Get(string, "Password");
	        Player[playerid][AdminLevel] = dini_Int(string, "AdminLevel");
	        Player[playerid][ModeratorLevel] = dini_Int(string, "ModeratorLevel");
if(Player[playerid][AdminLevel] >= 1)
			{
				format(string, sizeof(string), "%s (Admin Level %d) has authenticated (authenticating using their character password).", GetName(playerid), Player[playerid][AdminLevel]);
				SendToAdmins(ADMINORANGE, string, 0, 1);
			}

			if(Player[playerid][ModeratorLevel] >= 1)
			{
				format(string, sizeof(string), "%s (Moderator Level %d) has authenticated (authenticating using their character password).", GetName(playerid), Player[playerid][ModeratorLevel]);
				SendToAdmins(ADMINORANGE, string, 0, 1);
			}
else
	    {
	        new Sum;
	        Sum = 3-Player[playerid][LoginAttempts];
	        SendClientMessage(playerid, ADMINORANGE, "Wrong pass.");
	        Player[playerid][LoginAttempts]++;
			format(string, sizeof(string), "You have %d chance before kicked.", Sum);
			SendClientMessage(playerid, WHITE, string);
			ShowPlayerDialog(playerid, 3894, DIALOG_STYLE_PASSWORD, "Login", "Please enter password below.", "Login", "Quit");

			if(Player[playerid][LoginAttempts] == 3)
			{
			    new hour, minute, second, day, year, month;
			    gettime(hour, minute, second);
			    getdate(year, month, day);
			    #pragma unused second
			    new IP[21];
			    GetPlayerIp(playerid, IP, sizeof(IP));
				format(string, sizeof(string), "%d/%d/%d | %d:%d | %s | %s | THREE FAILED PASSWORD ATTEMPTS | System", day, month, year, hour, minute, IP, GetNameWithUnderscore(playerid));
				AdminActionsLog(string);
			    SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
			    Kick(playerid);
			}
Any help please ?

Thanks before
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)