/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteString(File,"Password",inputtext);
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
if(inputtext == PlayerInfo[playerid][pPass])
pwn(200) : error 033: array must be indexed (variable "inputtext")
if((inputtext) == PlayerInfo[playerid][pPass])
pawn Код:
EDIT: Too late. |
if(!strcmp(inputtext,PlayerInfo[playerid][pPass], true))
Try
pawn Код:
|
if(strcmp(inputtext, PlayerInfo[playerid][pPass],true) == 0)
Mh maybe i fail lol
pawn Код:
so you store the player password in PlayerInfo[playerid][pPass] and want check if inputtext is equal to PlayerInfo[playerid][pPass] right? |
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Login",""COL_ROZZ"please ENTER your password to login to your game account.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Register",""COL_ROZZ"please ENTER your password to register a new game account.","Register","Quit");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Register",""COL_RED"invalid password!.\n"COL_ROZZ"please ENTER your password to register a new game account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Password",inputtext);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SendClientMessage(playerid, COLOR_ROZZ, "Thanks for registering! have a lot of fun on our server.");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(strcmp(inputtext, PlayerInfo[playerid][pPass],true) == 0)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SendClientMessage(playerid, COLOR_ROZZ, "You have logged in!");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered wrong password.\n"COL_WHITE"Please enter you password to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}