[HELP] error 035: argument type mismatch (argument 3)
#1

Line:

PHP код:
            if ( ResetUserPasswordDatabasetNamepassword ) ) 
I have this:
PHP код:
        new
            
password       strvalparamsidx ] ); 
Help please
Reply
#2

Can you show me ResetUserPassword function? And 'tName' 'Database' variables?
Reply
#3

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
Can you show me ResetUserPassword function? And 'tName' 'Database' variables?
PHP код:
stock ResetUserPasswordDB:DatabaseName[ ], Password[ ] )
{
    new 
DBResult:Result;
    if ( 
Database )
    {
        new
            
Query    512 ],
            
Pw64 ];
        
formatQuerysizeofQuery ), "SELECT * FROM `users` WHERE `name`=lower('%s') AND `password`='%s'"NamePw );
        
Result db_queryDatabaseQuery );
        if ( 
db_num_fieldsResult ) )
        {
            
db_free_resultResult );
            
formatQuerysizeofQuery ), "UPDATE `users` SET `password`='%s' WHERE `name`=lower('%s') AND `password`='%s'"PasswordNamePw );
            
Result db_queryDatabaseQuery );
            
db_free_resultResult );
            return 
1;
        }
        else
        {
            
db_free_resultResult );
            return 
0;
        }
    }
    else
    {
        
printf"[ERROR] NO DATABASE!" );
        return 
0;
    }

Reply
#4

PHP код:
        new
            
password [69]       = strvalparamsidx ] ); 
Reply
#5

error 008: must be a constant expression; assumed zero

Line:
PHP код:
            password [69]       = strvalparamsidx ] ); 
pd: why 69?
Reply
#6

Do like this, sorry for that.
PHP код:
    new
        
password [128];
    
format(passwordsizeof(password), "%s"strvalparamsidx ] )); 
The warning says you're trying to pass a variable with type 'Integer' to arg type 'string / array' so it throws that warning.
and about 69-128 its the length of the string/array
Reply
#7

Thank you very much, however my command does not work.

For not having to create another topic. you could lend me a hand?

PHP код:
dcmd_setpasswordplayeridparams[ ] )
{
    if ( 
params] == '\0' )
        return 
SendUsageplayerid"/setname (id) (password)" );
    new
        
tNameMAX_PLAYER_NAME ],
        
tString128 ],
        
DB:Database,
        
idx;
    
printf"[ID:%d] typed setname command."playerid );
    
tName strtokparamsidx );
    if ( 
IsNumerictName ) )
    {
        new
            
pid    strvaltName ),
            
passwordlen    strlenparamsidx ] );
        if ( !
IsPlayerConnectedpid ) )
            return 
SendErrorplayerid"Not online!" );
        
GetPlayerNamepidtNameMAX_PLAYER_NAME );
        if ( !
passwordlen )
            return 
SendUsageplayerid"/setpassword (id) (pass)" );
        if ( 
passwordlen || passwordlen 16 )
            return 
SendErrorplayerid"Password must be between 3 - 16 ch." );
        
passwordlen += ( idx );
        for ( new 
idx 1passwordleni++ )
        {
            if ( 
isalnumparams] ) || params] == '_'  )
                continue;
            else
                return 
SendErrorplayerid"Only: 0-9, A-Z, a-z, _" );
        }
        
        new
        
password [128];
        
format(passwordsizeof(password), "%s"strvalparamsidx ] ));
        
Database db_openSZ_SQLITE_DB );
        if ( 
Database )
        {
            if ( 
ResetUserPasswordDatabasetNamepassword ) )
            {
                
formattStringsizeoftString ), "The new %s's password is: {FFFFFF}%s"pidpassword );
                
SendClientMessageplayeridCOLOR_REDtString );
            }
            
db_closeDatabase );
            return 
1;
        }
        return 
printf"[ERROR] NO DATABASE!" );
    }
    else
        return 
SendUsageplayerid"/setpassword (id) (password)" );

Thank you! +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)