auto login
#4

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

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
Reply


Messages In This Thread
auto login - by laser50 - 07.03.2010, 12:46
Re: auto login - by laser50 - 07.03.2010, 12:56
Re: auto login - by Miguel - 07.03.2010, 13:03
Re: auto login - by Desert - 07.03.2010, 13:16
Re: auto login - by laser50 - 07.03.2010, 16:27
Re: auto login - by Desert - 07.03.2010, 16:59
Re: auto login - by laser50 - 07.03.2010, 22:28
Re: auto login - by laser50 - 08.03.2010, 06:00
Re: auto login - by bajskorv123 - 08.03.2010, 06:19
Re: auto login - by Desert - 08.03.2010, 09:45

Forum Jump:


Users browsing this thread: 1 Guest(s)