07.03.2010, 13:16
Haiho laser hope you remember me :P
10 minutes is not 12 hours and double post is a bad thing
Eitherway heres my auto login using dini
As you can see i save the 2 IPs in enum because i think it was easier. Also theres "pip" and "rip" pip is player IP (The players IP) and rip is real IP (The IP which i have saved in the ini file) It checks if they are the same. If they are the same hes automatically logged in and if its not the same he has to login manually. As a safety that other people with same name don't get your stats
10 minutes is not 12 hours and double post is a bad thing
Eitherway heres my auto login using dini
pawn Код:
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME],file[23];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file))
{
SendClientMessage(playerid,COLOUR_RED,"You have not registered yourself! Use /register so your stats will be saved!");
return 1;
}
else
{
GetPlayerIp(playerid,pi[playerid][pip],16);
pi[playerid][rip] = dini_Int(file,"IP");
if(strcmp(pi[playerid][pip],pi[playerid][rip]))
{
new string[72];
pi[playerid][Adminlevel] = dini_Int(file,"Adminlevel");
SetPlayerScore(playerid,dini_Int(file,"Stat"));
logged[playerid] = 1;
format(string,sizeof(string),"Welcome back %s! You have been automatically logged in",name);
SendClientMessage(playerid,COLOUR_GREEN,string);
return 1;
}
else
{
SendClientMessage(playerid,COLOUR_GREEN,"An account in that name is registered! Use /login to regain your previous stats!");
return 1;
}
}
}
As you can see i save the 2 IPs in enum because i think it was easier. Also theres "pip" and "rip" pip is player IP (The players IP) and rip is real IP (The IP which i have saved in the ini file) It checks if they are the same. If they are the same hes automatically logged in and if its not the same he has to login manually. As a safety that other people with same name don't get your stats