// To the top of your script below the #include's
native WP_Hash(buffer[], len, const str[]);
buffer - The string where your hashed password will be stored in.
len - Length of the buffer (string)
str - The string which will be hashed and stored to buffer
// Example of Usage - OnDialogResponse - Registration
new hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), inputtext);
C:\Users\gouth_000\Desktop\Server SAMP\filterscripts\GoAdmin1.0.pwn(407) : error 035: argument type mismatch (argument 3) C:\Users\gouth_000\Desktop\Server SAMP\filterscripts\GoAdmin1.0.pwn(428) : error 033: array must be indexed (variable "hashpass")
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_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new IP[22];
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
GetPlayerIp(playerid, IP, sizeof(IP));
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",hashpass);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"VIP",0);
INI_WriteString(File, "Ip", IP);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You have registered here!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(hashpass == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
if(hashpass == PlayerInfo[playerid][pPass])
if( !strcmp(hashpass, PlayerInfo[playerid][pPass], true) )
INI_WriteInt(File,"Password",hashpass); |