SA-MP Forums Archive
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=640018)



Auto login - Loinal - 26.08.2017

PHP код:
    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?


Re: Auto login - Kane - 26.08.2017

Show OnAccountLoad and also show your MySQL logs.


Re: Auto login - Loinal - 26.08.2017

PHP код:
public OnAccountLoad(playerid)
{
    new 
score,string[143], join[100];
    
cache_get_value_int(0"SkinID"pData[playerid][Skin]);
    
cache_get_value_name_int(0"Admin"pData[playerid][Admin]); //we're getting a field 4 from row 0. And since it's an integer, we use cache_get_row_int
    
cache_get_value_name_int(0"Money"pData[playerid][Money]);//Above
    
cache_get_value_name_int(0,"Kills"pData[playerid][Kills]);
    
cache_get_value_name_int(0,"Tokens"pData[playerid][Tokens]);
    
cache_get_value_name_int(0"Deaths"pData[playerid][Deaths]);
    
cache_get_value_name_int(0"Hours"pData[playerid][pHours]);
    
cache_get_value_name_int(0"Minutes"pData[playerid][pMinutes]);
    
cache_get_value_name_int(0"RaceWon"pData[playerid][RaceWon]);
    
cache_get_value_name_int(0"Score"score);
    
cache_get_value_name_int(0"ID"pData[playerid][ID]);
    
cache_get_value_name(0"Rdate"pData[playerid][Rdate], 12);
    print(
pData[playerid][Rdate]);
    
SetPlayerScore(playeridscore);
    
GivePlayerMoney(playeridpData[playerid][Money]);//Let's set their money
//somecodes
        
return 1



Re: Auto login - Vince - 26.08.2017

"is not working" is always such a vague description. State what the intended output should be and what the actual output currently is. Add prints in every if and else block to see the program flow.


Re: Auto login - Ultraz - 26.08.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
"is not working" is always such a vague description. State what the intended output should be and what the actual output currently is. Add prints in every if and else block to see the program flow.
This guy won't understand like this, he want a code to copy and replace it, He got gangsta with this threads.


Re: Auto login - Loinal - 27.08.2017

Quote:
Originally Posted by Ultraz
Посмотреть сообщение
This guy won't understand like this, he want a code to copy and replace it, He got gangsta with this threads.
I don't need to copy and paste sir, i need to understand the code, and i got my own gamemode, iam working for that not just taking another scripts and host it


Re: Auto login - Loinal - 27.08.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
"is not working" is always such a vague description. State what the intended output should be and what the actual output currently is. Add prints in every if and else block to see the program flow.
iam just missing a code i removed by wrong and can't find that in any backups, thanks


Re: Auto login - Logic_ - 30.08.2017

Quote:
Originally Posted by Ultraz
Посмотреть сообщение
This guy won't understand like this, he want a code to copy and replace it, He got gangsta with this threads.
Abso-fucking-lutely right. I've helped him over TeamViewer before, and he understands nothing about his code. He just copies and replaces it himself or by help of someone else..


Re: Auto login - Loinal - 31.08.2017

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Abso-fucking-lutely right. I've helped him over TeamViewer before, and he understands nothing about his code. He just copies and replaces it himself or by help of someone else..
Ok i agree that you helped me, i understand the code i type well, if i don't how you can forget to type a code and don't know where the error comes from and i tell you?


Re: Auto login - Loinal - 31.08.2017

Quote:
Originally Posted by Ultraz
Посмотреть сообщение
This guy won't understand like this, he want a code to copy and replace it, He got gangsta with this threads.
Stop being fucked up, you requested me to help you more than 1 time and i refuse, if i refused you come and tell ur shits here, Go away.