SA-MP Forums Archive
error 017: undefined symbol "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: error 017: undefined symbol "udb_hash" (/showthread.php?tid=346672)



error 017: undefined symbol "udb_hash" - lewismichaelbbc - 29.05.2012

Код:
error 017: undefined symbol "udb_hash"
How can I define that symbol?? Its for a register system:

Код:
    if(dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256],string[227];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{FFFFFF}", ""COL_RED"[ERROR]{FFFFFF}Incorrect Password!", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp)  // HERE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        {
            format(string, sizeof (string), "{FFFFFF}Welcome "COL_BLUE"%s(%d){FFFFFF}.You're registered\n\nPlease log in by inserting your password.\n"embed_red"Wrong password!", name,playerid);
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD,"{FFFFFF}Login", string,"Login","Kick");
            PlayerInfo[playerid][pFailLogins]++;
            if(PlayerInfo[playerid][pFailLogins] >= MAX_FAIL_LOGINS)
            {
            	SendClientMessage(playerid, red, "[ERROR]"embed_grey"Failed to login!");
            	Kick(playerid);
            	return 1;
            }
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdmin] = dini_Int(file, "AdminLevel");
            PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
            PlayerInfo[playerid][pBank] = dini_Int(file, "Bank");
            PlayerInfo[playerid][pFaction] = dini_Int(file, "Faction");
            PlayerInfo[playerid][pRank] = dini_Int(file, "FactionRank");
            PlayerInfo[playerid][pSkin] = dini_Int(file, "Skin");
            PlayerInfo[playerid][pNeons] = dini_Int(file, "Neons");
            PlayerInfo[playerid][pPot] = dini_Int(file, "Pot");
            PlayerInfo[playerid][pPhone] = dini_Int(file, "Phone");
            PlayerInfo[playerid][pLevel] = dini_Int(file, "Level");
            PlayerInfo[playerid][pUpgradePoints] = dini_Int(file, "UpgradePoints");
            PlayerInfo[playerid][pJob] = dini_Int(file, "Job");

            SendClientMessage(playerid,0xFFFFFFF,""embed_blue"[INFO]{FFFFFF}You have been {8CF051}succesfully {FFFFFF}logged in.");
        }
    }



Re: error 017: undefined symbol "udb_hash" - TzAkS. - 29.05.2012

#include <dudb>


Re: error 017: undefined symbol "udb_hash" - Aprezt - 29.05.2012

pawn Код:
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;
}