SA-MP Forums Archive
udb_hash - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: udb_hash (/showthread.php?tid=465462)



udb_hash - BoU3A - 22.09.2013

how can i remove this faking udb_hash!

i remove this
PHP код:
/*Credits to Dracoblue*/
stock udb_hash(buf[]) {
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;

and changed this
PHP код:
INI_WriteInt(File,"Password",udb_hash(inputtext)); 
to this
PHP код:
INI_WriteString(File,"Password",inputtext); 
and its fine but when i try to change this
PHP код:
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) 
to this
PHP код:
if(inputtext == PlayerInfo[playerid][pPass]) 
i got this faking error
PHP код:
pwn(200) : error 033: array must be indexed (variable "inputtext"



Re: udb_hash - DanishHaq - 22.09.2013

I had this problem once in the past, a few months back, and fixed it by putting "inputtext" in brackets, so it looked a bit like "(inputtext)".

Look at the post below for en example.


Re: udb_hash - JimmyCh - 22.09.2013

pawn Код:
if((inputtext) == PlayerInfo[playerid][pPass])
Try this.


EDIT: Too late.


Re: udb_hash - iJumbo - 22.09.2013

https://sampwiki.blast.hk/wiki/Strcmp

i don't really get what you have to do


EDIT: nevermind.. is integer


Re: udb_hash - BoU3A - 22.09.2013

Quote:
Originally Posted by JimmyCh
Посмотреть сообщение
pawn Код:
if((inputtext) == PlayerInfo[playerid][pPass])
Try this.


EDIT: Too late.
thanks for your time but i still got this error array must be indexed (variable "inputtext")


Re: udb_hash - iJumbo - 22.09.2013

Try

pawn Код:
if(!strcmp(inputtext,PlayerInfo[playerid][pPass], true))



Re: udb_hash - BoU3A - 22.09.2013

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
Try

pawn Код:
if(!strcmp(inputtext,PlayerInfo[playerid][pPass], true))
its worked.. but i can login with any password LOL!


Re: udb_hash - iJumbo - 22.09.2013

Mh maybe i fail lol

pawn Код:
if(strcmp(inputtext, PlayerInfo[playerid][pPass],true) == 0)

so you store the player password in PlayerInfo[playerid][pPass] and want check if inputtext is equal to PlayerInfo[playerid][pPass] right?


Re: udb_hash - BoU3A - 22.09.2013

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
Mh maybe i fail lol

pawn Код:
if(strcmp(inputtext, PlayerInfo[playerid][pPass],true) == 0)

so you store the player password in PlayerInfo[playerid][pPass] and want check if inputtext is equal to PlayerInfo[playerid][pPass] right?
thank you and sorry for your time but still same problem maybe not ur code problem check my code

PHP код:
public OnPlayerConnect(playerid)
{
    if(
fexist(UserPath(playerid)))
    {
       
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
       
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD""COL_WHITE"Login",""COL_ROZZ"please ENTER your password to login to your game account.","Login","Quit");
       
    }
    else
    {
       
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD,""COL_WHITE"Register",""COL_ROZZ"please ENTER your password to register a new game account.","Register","Quit");
    }
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_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(playeridCOLOR_ROZZ"Thanks for registering! have a lot of fun on our server.");
            }
        }
        case 
DIALOG_LOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                if(
strcmp(inputtextPlayerInfo[playerid][pPass],true) == 0)
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
SendClientMessage(playeridCOLOR_ROZZ"You have logged in!");
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_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;




Re: udb_hash - iJumbo - 22.09.2013

Seems that you are not loading the password.. im not familiar with INI. on login you must load the password that equals to the player name so you can check in login, then you can load the other thigns