AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   array must be indexed (https://forums.alliedmods.net/showthread.php?t=87779)

xPaw 03-16-2009 09:16

array must be indexed
 
PHP Code:

public fnUpdateTop_pro10idszClimbTime[] ) {
    new 
szVault[64], szMap[32];
    
get_mapnameszMap31 );
    
formatszVault63"kz_%s_pro10"szMap );
    
    new 
iVault nvault_openszVault );
    
    if( 
iVault != -) {
        new 
szKey[8];
        
        new 
szTime1[3], szTime2[3], szTime3[7];
        
parseszClimbTimeszTime12szTime22szTime3);
        
        for( new 
1<= 10i++ ) {
            new 
szReturn[128], iArg1[26], iArg2[19], szTimeArg1[3], szTimeArg2[3], szTimeArg3[7];
            
formatszKey8"%d");
            
nvault_getiVaultszKeyszReturn128 );
            
            if( 
parseszReturniArg125iArg219 ) == ) {
                
parseiArg2szTimeArg12szTimeArg22szTimeArg3);
                if( 
szTime1 <= szTimeArg1 && szTime2 <= szTimeArg2 && szTime3 szTimeArg3 ) {
                    new 
szNew[128], szName[26];
                    
get_user_name(idszName25 );
                    
                    
formatszNew128"^"%s^" ^"%s^""szNameszClimbTime );
                    
                    if( 
10 ) {
                        for( new 
10ix-- ) {
                            new 
szTemp[128], szTempKey[8];
                            
formatszTempKey8"%d"x-);
                            
nvault_getiVaultszTempKeyszTemp128 );
                            
                            if( !
equalszTemp"" ) ) {
                                
formatszTempKey8"%d");
                                
nvault_psetiVaultszTempKeyszTemp );
                            }
                        }
                    }
                    
                    
nvault_psetiVaultszKeyszNew );
                    
                    if( 
== )
                        
ColorChat(0RED"%s^x04 %s^x01 has established a new record."PREFIXszName);
                    
                    break;
                }
            }
        }
        
nvault_closeiVault );
    }


the error on line
PHP Code:

if( szTime1 <= szTimeArg1 && szTime2 <= szTimeArg2 && szTime3 szTimeArg3 ) { 

then func called like
PHP Code:

fnUpdateTop_pro10id"00:45:232347" ); 

how i can compare 2 lines like that, and also those top code a bit horrible, someone can optimize it :) ?

Arkshine 03-16-2009 09:19

Re: array must be indexed
 
szTime1 , szTime2, szTimeArg1, szTimeArg2 and szTimeArg3 are strings. And you want to compare directly a string like that ? ^^

Use str_to_float() before.

xPaw 03-16-2009 09:20

Re: array must be indexed
 
do you have other idea how to compare
PHP Code:

if ( .... || szClimbTime iArg2 ) { 


Arkshine 03-16-2009 09:21

Re: array must be indexed
 
Like I've said ; Use str_to_float() before.

xPaw 03-16-2009 09:25

Re: array must be indexed
 
its compiled fine, now i need to test it in game :)

jim_yang 03-16-2009 09:38

Re: array must be indexed
 
strcmp

Arkshine 03-16-2009 09:40

Re: array must be indexed
 
It will compare if string are the same or not, not if x value is < or > to y value.


All times are GMT -4. The time now is 08:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.