if(dialogid == DIALOG_LOGIN)
{
if(!response) Kick(playerid);
new iStr[128],gTries;
if(gTries == 3)
{
new pName[30];
GetPlayerName(playerid,pName,sizeof(pName));
format(iStr,sizeof(iStr),"%s is kicked.",pName);
SendClientMessageToAll(red,iStr);
return Kick(playerid);
}
if(!strlen(inputtext))
{
gTries++;
format(iStr,sizeof(iStr),"Please input your password. Tries: %i/3",gTries);
return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Prijava",iStr,"Login","Back");
}
if(strcmp(pInfo[playerid][Pass], inputtext, true) == 0)
{
pLogged[playerid] = 1;
LoginAcc(playerid);
}
else
{
format(iStr,sizeof(iStr),"Wrong password. Tries: %i/3",gTries);
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Prijava",iStr,"Login","Back");
gTries++;
return 1;
}
return 1;
}
Are you sure that pInfo[playerid][Pass] contains any data? If it's an empty array then it will always cause strcmp to return 0. Print the contents of pInfo[playerid][Pass] in that snippet of code and make sure it contains data.
|
pInfo[playerid][Pass] = inputtext;
error 006: must be assigned to an array
enum iDetails
{
Pass,
Cash,
Admin,
Tut,
Score
};
new pInfo[MAX_PLAYERS][iDetails];
enum iDetails
{
Pass[50],
Cash,
Admin,
Tut,
Score
};
new pInfo[MAX_PLAYERS][iDetails];
error 047: array sizes do not match, or destination array is too small
pInfo[playerid][Pass] = inputtext;
if(dialogid == DIALOG_REGISTER)
{
// GetPlayerIp(playerid,pIP[playerid],16);
if(!response) Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Pass","Input password:","Register","Back");
new INI:iFile = INI_Open(PlayerPath(playerid));
INI_SetTag(iFile,"data");
INI_WriteString(iFile,"Pasword",inputtext);
#if defined AUTOLOGIN
INI_WriteString(iFile,"IP",pIP[playerid]);
#endif
INI_WriteInt(iFile,"Cash",REGISTERED_MONEY);
INI_WriteInt(iFile,"Score",1);
INI_WriteInt(iFile,"Admin",0);
INI_WriteInt(iFile,"Tut",-1);
INI_Close(iFile);
pInfo[playerid][Pass] = inputtext;
pLogged[playerid] = 1;
new iStr[128];
format(iStr,sizeof(iStr),"You have reister with password \"%s\".",inputtext);
SendClientMessage(playerid,yellow,iStr);
return 1;
}
strcat(pInfo[playerid][Pass], inputtext);
Yes it does make sense, because inputtext's size is unknown to the compiler, so it cannot assign it to an array that has a pre-set size. You need to use a function like strcat, for example:
pawn Код:
Now doesn't that make sense? |