Help with login dialog
#1

So basically, when i register a new account and then give my self level 3, then when i disconnect, and login with the same id different nickname it detects me as admin level 3 like i did on the previous nickname which is really werid lol.

There might be something wrong on this

PHP код:
if(dialogid == dlogin)
    {
//then
        
if(!response){
        
SendClientMessage(playerid, -1 , "{FF0000}* You have been kicked for not logging in !");
        
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
        }
        if(
response)
        {
//then
            
new hashpass[129];
            
WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!
strcmp(hashpass,pInfo[playerid][Pass]))
            {
//then
                
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
                
SetPlayerScore(playerid,pInfo[playerid][Score]);
                new 
str[500], name[MAX_PLAYER_NAME];
                
GetPlayerName(playerid, name,sizeof(name));
                 
format(str,sizeof(str),"{00FFFF}(INFO) Successfully logged in! Welcome back {FFFFFF}%s",name);
                
SendClientMessage(playerid, -1, str);
                 
format(str,sizeof(str),"{00FFFF}* Points: {FFFFFF}%i {00FFFF}| Score: {FFFFFF}%i {00FFFF}| Deaths: {FFFFFF}%i {00FFFF}| Kills: {FFFFFF}%i",pInfo[playerid][Points],pInfo[playerid][Score], pInfo[playerid][Deaths], pInfo[playerid][Kills]);
                
SendClientMessage(playerid, -1, str);
                if(
pInfo[playerid][Admin] == 1)
                {
                
SendClientMessage(playerid, -1 , "{00FFFF}* Admin Level: {FFFFFF}1 (Moderator)");
                }
                if(
pInfo[playerid][Admin] == 2)
                {
                
SendClientMessage(playerid, -1 , "{00FFFF}* Admin Level: {FFFFFF}2 (Admin)");
                }
                if(
pInfo[playerid][Admin] == 3)
                {
                
SendClientMessage(playerid, -1 , "{00FFFF}* Admin Level: {FFFFFF}3 (Server Owner)");
                }
                
TogglePlayerSpectating(playerid, 0);
            }
            else
            {
//then
                
SendClientMessage(playerid, -1 , "{FF0000}* You didn't entered any password or you entered wrong password, for security purposes you must relog fool!");
                
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
                return 
1;
            }
        }
    } 
playerid = id 0 right? how do i tell it to check only the player's config and not with id XD
Reply
#2

replace your code with this
PHP код:
stock AdminRanks(playerid)
{
    new 
strings[270];
    switch(
pInfo[playerid][Admin])
    {
        case 
0: strings = "Normal Player";
        case 
1: strings = "Trial Moderator";
        case 
2: strings = "Server Owner";
    }
    return 
strings;
}
if(
dialogid == dlogin)
    {
//then
        
if(!response){
        
SendClientMessage(playerid, -1 , "{FF0000}* You have been kicked for not logging in !");
        
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
        }
        if(
response)
        {
//then
            
new hashpass[129];
            
WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!
strcmp(hashpass,pInfo[playerid][Pass]))
            {
//then
                
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
                
SetPlayerScore(playerid,pInfo[playerid][Score]);
                new 
str[500], name[MAX_PLAYER_NAME];
                
GetPlayerName(playerid, name,sizeof(name));
                 
format(str,sizeof(str),"{00FFFF}(INFO) Successfully logged in! Welcome back {FFFFFF}%s",name);
                
SendClientMessage(playerid, -1, str);
                 
format(str,sizeof(str),"{00FFFF}* Points: {FFFFFF}%i {00FFFF}| Score: {FFFFFF}%i {00FFFF}| Deaths: {FFFFFF}%i {00FFFF}| Kills: {FFFFFF}%i",pInfo[playerid][Points],pInfo[playerid][Score], pInfo[playerid][Deaths], pInfo[playerid][Kills]);
                
SendClientMessage(playerid, -1, str);
                if (
pInfo[playerid][Admin] != 0)
                {
                    
format(string, 16, "* Admin Level: %d [%s]", pInfo[playerid][Admin], AdminRanks(playerid));
                    
SendClientMessage2(playerid, COLOR_RED, string);
                    
format(tmp2, sizeof(tmp2), "* %s (Id%d) has logged in as admin level %d.", playername, playerid, pInfo[playerid][Admin]);
                    for (new 
i = 0; i < PLAYERS; i++)
                    {
                        if (!
IsPlayerConnected(i)) continue;
                        if (
pInfo[i][Admin] != 0 && i != playerid) SendClientMessage(i, -1, tmp2);
                    }
                }
                
TogglePlayerSpectating(playerid, 0);
            }
            else
            {
//then
                
SendClientMessage(playerid, -1 , "{FF0000}* You didn't entered any password or you entered wrong password, for security purposes you must relog fool!");
                
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
                return 
1;
            }
        }
    } 
rep if helped ok
Reply
#3

Your code is totally different from what i've did and by the way thanks for helping, i just fixed it by myself
Reply
#4

Quote:
Originally Posted by Wallenstein111
Посмотреть сообщение
Your code is totally different from what i've did and by the way thanks for helping, i just fixed it by myself
by the code which i used better then your and fast too
because mine method is also easy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)