auto login
#1

Could someone give me an example of an Auto login using Dini please?
(or just make the whole code :P)

Also, how do i make a Textdra above the character in the character seletion?
Like, Soldier skin, with a textdraw USA above him..
Reply
#2

Anyone?
Reply
#3

Look for a textdraw editor.
Reply
#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
#5

its not really working,...

Do you maybe have sumthin Easier? as most of these things, are not in my script xD

(Hey Desert :P)


Reply
#6

Well you can just change the pi's

The importent thing is to make 2 diffrent IP saves. 1 thats saved in the ini file and 1 thats set to the playerid's IP


You could also keep it simple and just check if fexist then autologin. But that would make it easy to hack others account
Reply
#7

I still dont really get it...
if their a simpeler way? witch checks the ip??
Reply
#8

come on, some1?
Reply
#9

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
  if(classid = 0)//The first class that got added at GameModeInit()
  {
    GameTextForPlayer(playerid, "Usa", 3000, 4);
  }
  else if(classid = 1)//The second class that got added at GameModeInit()
  {
    GameTextForPlayer(playerid, "Japan", 3000, 4);
  }
  else if(classid = 2)//The third class that got added at GameModeInit()
  {
    GameTextForPlayer(playerid, "Russia", 3000, 4);
  }
  return 1;
}
If you have more than 3 classes, just add the "else if(classid...)" loop...
Reply
#10

Im currently not at home so im not sure if this might work

put this on top of your script: new pip[MAX_PLAYERS][16],rip[MAX_PLAYERS][16];

You put this under OnPlayerConnect

pawn Код:
new file[23],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(fexist(file))
{
GetPlayerIp(playerid,pip[playerid],16);
rip[playerid] = dini_Int(file,"IP");
if(strcmp(pip[playerid],rip[playerid]))
{
//Load the players stats
return 1;
}
else return SendClientMessage(playerid,0xFFFFFF,"You need to login first");
}
else return SendClientMessage(playerid,0xFFFFFF,"Please register first");

And add this save under your register and login

pawn Код:
GetPlayerIp(playerid,rip[playerid],16);
dini_Set(file,"IP",rip[playerid]);

As said im not sure if it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)