Auto login....
#1

Any tutorial for how to make auto login? i currently using y_ini, I tried to do it but failed so
If someone gave me tutorial, would be great.
Also i searched googe/samp forums, nothing about auto logins, only MySQL tutorials, i need y_ini :/
Reply
#2

Obtain IP address upon registration, and compare it whenever a player is joining the server with the same user name and IP. If it's only the same user name but the IP changed (Logging from different PC / router restarted / whatever) the player would have to manually log in, and then you'll need to update the IP to the new one.
Reply
#3

I tried doing that but failed.. i had to loaduser ip, then compare it with current ip, if both matches, it auto logins
but it still shows login dialog, so if you can gimme a tutorial woild be great..
Reply
#4

pawn Code:
public OnPlayerConnect(playerid)
{
    if(fexist(PlayerName(playerid)) //The username is used
    {
        new plrIP[16];
        GetPlayerIp(playerid, plrIP, sizeof(plrIP));
       
        if(!strcmp(plrIP, pInfo[playerid][PlayerIP]) //The IP matches
        {
            //IP and username matches. Login player, give money, score, etc..
        }
        else //IP doesn't match
        {
            ShowPlayerDialog(//Show login dialog...)
        }
    }
    else //There is no file that has the same name as the player (Player is not registered)
    {
        //Show register dialog
    }
    return 1;
}
Reply
#5

Thanks for helping me repped:P, Heres my code it might help someone :P
PHP Code:

    
if(fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        new 
IP[16];
        
GetPlayerIp(playeridIPsizeof(IP));
        if(!
strcmp(IPPlayerInfo[playerid][pIP])) 
        {
            
IsLogged[playerid] = 1;
        }
        else
        {
            
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD,"Login","Welcome Back\nType your password to login.\nIf its not your account, Please quit the game and join with another nickname.","Login","Quit");
            
SendClientMessage(playerid,COLOR_YELLOW,"This account is registered.");
            
SendClientMessage(playerid,COLOR_RED,"If its not your account, Please exit the game and join with another nickname.");
        }
    }

    else
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD,"Register","Please register to continue\nType your password to register.\nPlease don't use easy passwords.","Register","Quit");
        
SendClientMessage(playerid,COLOR_YELLOW,"This account is not registered");
        
SendClientMessage(playerid,COLOR_YELLOW,"Please register it by typing your password in register dialog.");
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)