Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by Mr_DjolE
Again udb...
Also
pawn Код:
if(!strcmp(udb_hash(Pass)), PlayerInfo[playerid][pPass]) { //do login }
|
Argument mismatch.
Quote:
Originally Posted by HireMe
Like tyler set make it look like:
pawn Код:
CMD:login(playerid, params[]) { new filestring[128]; new name[24]; GetPlayerName(playerid, name, 24); format(filestring, sizeof(filestring), "/Users/%s.ini", name); if(!fexist(filestring)) return SCM(playerid, COLOR_YELLOW, "You are not registered. Please /register."); new lpass[64]; if(PlayerInfo[playerid][pLogged] == 1) return SCM(playerid, COLOR_YELLOW, "You are already logged in."); if(sscanf(params, "s[64]", lpass)) return SCM(playerid, -1, "{F70505}Usage: {FFFFFF}/login [password]"); INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); if(udb_hash(lpass) == PlayerInfo[playerid][pPass]) { SetPlayerCash(playerid, PlayerInfo[playerid][pCash]); SetPlayerScore(playerid, PlayerInfo[playerid][pKills]); SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pRank]); PlayerInfo[playerid][pLogged] += 1; SCM(playerid,0x0080C0FF,"System: Account data loaded! Welcome back!"); } else { SCM(playerid,0x0080C0FF,"System: Wrong password!"); } return 1; }
an i think it'll work
|
Sometimes it works and sometimes not. I get "unknown command" at /register and /login sometimes.
I think
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
is bugged, i tried to add on OnPlayerConnect but both register and login cmds wasn't working.