04.08.2010, 14:43
Hi there, I'm developing a new GM from scratch, and I am having problems with the login cmd
This is my code for it so far;
This is kinda based off of Eric_'s reg/login tut, but with sscanf and ZCMD. and also without dudb.
The problem is that if i do /login 3 it would say "[SUCESS]: You have logged in!", when thats not even the password,
anyone mind helping me?
This is my code for it so far;
pawn Код:
CMD:login(playerid, params[])
{
new str[128], password[58], tmp[256];
format(str, sizeof(str), "RCRP/Users/%s.ini", pName(playerid));
if(!fexist(str))
{
if(PlayerInfo[playerid][pLoggedIn] == 1)
{
SendClientMessage(playerid, RED, "ERROR: You are already logged in!");
return 1;
}
else
{
tmp = dini_Get(str, "Password");
if(sscanf(params, "s[58]", password))
{
return SendClientMessage(playerid, LBLUE, "USAGE: /login (password)");
}
if(!strcmp(password, tmp, false))
{
SendClientMessage(playerid, RED, "ERROR: Logged in failed, wrong password");
}
else
{
PlayerInfo[playerid][pLoggedIn] = 1;
PlayerInfo[playerid][pRegistered] = 1;
GivePlayerMoney(playerid, dini_Int(str, "Money"));
PlayerInfo[playerid][pLevel] = dini_Int(str, "Level");
SendClientMessage(playerid, LBLUE, "[SUCESSS]: You have logged in!");
}
}
}
else
{
SendClientMessage(playerid, RED, "ERROR: That name does not exist!");
}
return 1;
}
The problem is that if i do /login 3 it would say "[SUCESS]: You have logged in!", when thats not even the password,
anyone mind helping me?