05.02.2013, 14:37
I'm having trouble with my login CMD. Whenever a player logs into an account and he types /login [somerandomshithere], he's logged in, even if the password is incorrect. What's the problem here?
My full login CMD:
Code that should check if the pass equals to the players pass:
Anybody know how to fix this issue?
My full login CMD:
pawn Код:
CMD:login(playerid, params[])
{
new file[32], pass[40];
format(file,sizeof(file),"/Users2/%s.ini", GetName(playerid));
if(sscanf(params,"s[40]",pass)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /login [password]");
if(fexist(file))
{
if(IsLogged[playerid] == 0)
{
if(PlayerInfo[playerid][pPass] == strval(pass))
{
SendClientMessage(playerid, COLOR_ORANGE, "You've succesfully logged in. Enjoy your stay!");
IsLogged[playerid] = 1;
TogglePlayerControllable(playerid, true);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Wrong password! Please try again.");
pTurns[playerid]++;
if(pTurns[playerid] == 1) { SendClientMessage(playerid, COLOR_RED, "You can try 2 more times."); }
else if(pTurns[playerid] == 2) { SendClientMessage(playerid, COLOR_RED, "You can try 1 more time."); }
else if(pTurns[playerid] == 3)
{
new str[150];
format(str,sizeof(str),"SERVER: %s has been kicked by Security Guard, reason: Wrong password.", GetName(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, str);
pTurns[playerid] = 0;
Kick(playerid);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You're already logged in.");
}
}
return 1;
}
pawn Код:
if(PlayerInfo[playerid][pPass] == strval(pass))
{
SendClientMessage(playerid, COLOR_ORANGE, "You've succesfully logged in. Enjoy your stay!");
IsLogged[playerid] = 1;
TogglePlayerControllable(playerid, true);
}