error 017 : undefined "WP_Hash"
#1

I am scripting a SQLite login/register system right now, and when I comply it, I get this error on certain lines
PHP код:
Current directoryC:\Users\harvey\Documents\Server test\gamemodes
rp2
.pwn(115) : error 017undefined symbol "WP_Hash"
rp2.pwn(142) : error 017undefined symbol "WP_Hash"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors
.
================ 
READY ================ 
Line 115:
PHP код:
WP_Hash(User[playerid][USER_PASSWORD], 129inputtext); 
Line 142:
PHP код:
WP_Hash(buf129inputtext); 
Whole snippet of 142:
PHP код:
case DIALOG_LOGIN
        { 
            if (!
response) return Kick(playerid); 
             
            new 
                
buf[129]; 
            
WP_Hash(buf129inputtext); 
            if (
strcmp(bufUser[playerid][USER_PASSWORD]))
            { 
                
SendClientMessage(playerid0xFF0000FF"[ERROR]: Incorrect password");
                
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Login""Type in your password below to log in.""Login""Leave" );
                return 
1
            } 
             
    
            new 
                
DBResultResult;
            
format(bufsizeof buf"SELECT * FROM users WHERE username = '%q' LIMIT 1"User[playerid][USER_NAME]);
            
Result db_query(Databasebuf); result later 
             
            
if (db_num_rows(Result))
            { 
               
                
User[playerid][USER_ID] = db_get_field_assoc_int(Result"userid"); 
                
User[playerid][USER_ADMIN] = db_get_field_assoc_int(Result"admin"); 
                
                
SendClientMessage(playerid0x00FF00FF"[SERVER]: You have successfully logged in to your account!");
            } 
            
db_free_result(Result); 
        } 
Whole snippet of 115:
PHP код:
case DIALOG_REGISTER
        { 
            
// if the player did not response to the dialog, meaning pressed either Esc or ckicked on "Leave" button, will be kicked 
            
if (!response) return Kick(playerid); 
             
            if (!(
<= strlen(inputtext) <= 20)) 
            { 
// if the length of the desired password is not beetween 3-20 characters 
                
SendClientMessage(playerid0xFF0000FF"[ERROR]: Invalid length on the password. It should be between 3-20 characters" );// send the message error for the valid lenght of the password 
                
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Register""Type in a password below to register an account.""Register""Leave" );// re-show the register dialog 
                
return 1// stop the code below from being executed 
            

             
            new 
// a query, remember to change the size of it if you add more stuff 
                
Query[208]; 
                 
            
WP_Hash(User[playerid][USER_PASSWORD], 129inputtext); // Hash the password from the inputtext and store it to User[playerid][USER_PASSWORD] 
            
format(Querysizeof Query"INSERT INTO users (username, password) VALUES ('%q', '%s')"User[playerid][USER_NAME], User[playerid][USER_PASSWORD]);// Insert into users the name and the password. The userid gets increased automatically and the admin is by default 0 value. We don't have to escape password as the hashed output provided by Whirlpool contains only alphabet characters and numbers. 
            
db_query(DatabaseQuery);// execute the SQL query 
            
SendClientMessage(playerid0x00FF00FF"[SERVER]: You have just registered to our server! You have been automatically logged in!");//send a message just to inform the player that he's now registered! 
            // We have to retrieve the value generated from the Auto Increment for the "userid" field. 
            // last_insert_rowid() function returns the last inserted row in the last session as its name suggests already. 
            
new 
                
DBResultResult
                 
            
Result db_query(Database"SELECT last_insert_rowid()"); // it will return the value for field "userid" generated 
            
User[playerid][USER_ID] = db_get_field_int(Result); // The difference in this function except that it doesn't support the name of the field but the field ID instead, it is that returns an integer directly without having to store it to a temporary string and then use strval function to convert string to integer. 
            // There is a second parameter "field" which is by default 0. We know that only 1 row and 1 field will be selected so we may not specify it. 
            // REMEMBER! Fields starts from 0. 
            
db_free_result(Result); // Last, we free the result memory 
        

NOTE: I have whirlpool in my plugins folder.
Reply
#2

Add under includes (#include <a_samp> etc.):
pawn Код:
native WP_Hash(buffer[], len, const str[]);
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Add under includes:
pawn Код:
native WP_Hash(buffer[], len, const str[]);
Well I already have one though http://imgur.com/a/aUgnY
Reply
#4

You wrote WP_hash. It's WP_Hash
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You wrote WP_hash. It's WP_Hash
Its working now, Thank you Konstantinos! Didnt know that lower cases matter

//Its from your tutorial, by the way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)