SA-MP Forums Archive
Register System Help plx.... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Register System Help plx.... (/showthread.php?tid=67221)



Register System Help plx.... - introzen - 27.02.2009

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 =)


Re: Register System Help plx.... - ICECOLDKILLAK8 - 27.02.2009

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)