Auto login.... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Auto login.... (
/showthread.php?tid=589891)
Auto login.... -
karemmahmed22 - 23.09.2015
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 :/
Re: Auto login.... -
[XST]O_x - 23.09.2015
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.
Re: Auto login.... -
karemmahmed22 - 23.09.2015
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..
Re: Auto login.... -
[XST]O_x - 23.09.2015
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;
}
Re: Auto login.... -
karemmahmed22 - 23.09.2015
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(playerid, IP, sizeof(IP));
if(!strcmp(IP, PlayerInfo[playerid][pIP]))
{
IsLogged[playerid] = 1;
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_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(playerid, DIALOG_REGISTER, DIALOG_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.");
}