Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Auto login

$
0
0
PHP Code:

    if(cache_num_rows() >= 1)
    {
        
cache_get_value_name(0"IP"IP[playerid], 16);
        new 
newIP[16];// query[300];
        
GetPlayerIp(playeridnewIP16);
        
IsPlayerRegistered[playerid] = 1;
        if(
strlen(IP[playerid]) != && !strcmp(IP[playerid], newIPtrue)) //Checks that the MySQL IP has a value and that they are the same.
        
{
            new 
query[150];
            
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1"pName(playerid));
            
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
        }
        else
        {
            new 
string[280];
            
cache_get_value_name(0"Password"pData[playerid][Password], 129);
            
//we will load player's password into pData[playerid][Password] to be used in logging in
            
cache_get_value_name_int(0"ID"pData[playerid][ID]); //now let's load player's ID into pData[playerid][ID] so we can use it later
            
format(string,sizeof(string),"Welcome back to ZoneX {FFFA00}%s\n{FFFFFF}\nYour UserID: %d | Your account is registered on our database\nPlease type your password to login",GetName(playerid),pData[playerid][ID]);
            
ShowPlayerDialog(playeriddLOGINDIALOG_STYLE_INPUT"Login"string"Login""Quit"); //And since we found a result from the database, which means, there is an account; we will show a login dialog
        
}
    } 

i use r41-2
the autologin is not working why?

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>