Register System Help plx....
#1

I got this code:

pawn Код:
if(strcmp("/register",cmdtext,9,true) == 0)
    {
      new pName[MAX_PLAYER_NAME], File[256];
      GetPlayerName(playerid,pName,sizeof(pName));
      format(File,sizeof(File),"EQRP//Players//%s.ini",pName);
      if(dini_Exists(File)) return SendClientMessage(playerid,COLOR_DARKRED,"Account Already exists");
      if(!cmdtext[10]) return SendClientMessage(playerid,COLOR_DARKRED,"USAGE: /Register [password]");
      dini_Create(File);
      dini_Set(File,"Password",cmdtext[10]);
      dini_IntSet(File,"Money",20000);
      dini_IntSet(File,"Faction",0);
      dini_IntSet(File,"DriverLic",0);
      dini_IntSet(File,"FlyLic",0);
      dini_IntSet(File,"Bank",50000);
      PlayerInfo[playerid][pRegged] = 1;
      PlayerInfo[playerid][pLogged] = 1;
      SendClientMessage(playerid,COLOR_LIGHTBLUE,"Account registered, use /login [password]");
      return 1;
    }
    if(strcmp("/login",cmdtext,6,true) == 0)
    {
      new pName[MAX_PLAYER_NAME], string[256];
      GetPlayerName(playerid,pName,sizeof(pName));
      format(string,sizeof(string),"EQRP//Players//%s.ini",pName);
      if(PlayerInfo[playerid][pRegged] != 1) return SendClientMessage(playerid,COLOR_DARKRED,"Account doesn't exist");
      if(!cmdtext[7]) return SendClientMessage(playerid,COLOR_DARKRED,"USAGE: /login [password]");
      if(!dini_Set(string,"Password",cmdtext[7])) return SendClientMessage(playerid,COLOR_DARKRED,"Wrong Password");
      PlayerInfo[playerid][pLogged] = 1;
      SendClientMessage(playerid,COLOR_LIGHTBLUE,"Logged in");
      return 1;
    }
And this problem:

When i type /register it says: Registered, use /login
When /login [password] it says: Account already exists...

Why? plx help =)
Reply
#2

1) Use strtok
2) Use
pawn Код:
if(strcmp("/register",cmdtext,true) == 0)
if(strcmp("/login",cmdtext,6,true) == 0)
instead of
pawn Код:
if(strcmp("/register",cmdtext,9,true) == 0)
if(strcmp("/login",cmdtext,true) == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)