Raised This Month: $ Target: $400
 0% 

fgets, format (general messup)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-10-2009 , 17:09   Re: fgets, format (general messup)
Reply With Quote #2

WeaponEnt contains a string. That string happens to be the text that makes up a function. This "function" will never get executed because it is just a string of characters.

Basically:
WeaponEnt[0] = "f"

Also, I don't think fgets returns a value. Here is what I use to take in two parameters (mapname and number):

PHP Code:
    new maproundsfile[64]
    
get_configsdir(maproundsfilesizeof(maproundsfile) - 1)
    
add(maproundsfilesizeof(maproundsfile) - 1"/map_rounds.ini")
    
    if( !
file_exists(maproundsfile) ) return
    
    new 
curmap[64]
    
get_mapname(curmapsizeof(curmap) - 1)
    
    new 
fopen(maproundsfile"rt")
    
    new 
data[128], map[64], rounds[16]
    while( !
feof(f) ) 
    { 
        
fgets(fdatasizeof(data) - 1)
        
// I think trim(data) needs to go here since fgets includes newline and carriage return characters.
        
if( !data[0] || data[0] == ';'
           
|| data[0] == '/' && data[1] == '/' ) continue;
         
        
parse(data
              
mapsizeof(map) - 1,
              
roundssizeof(rounds) - 1
             
)
         
        if( !
strcmp(curmapmap) )
        { 
            
set_pcvar_num(cvar_mp_maxroundsstr_to_num(rounds))
            
mapfound true
            
break
        }
    }
    
    
fclose(f
__________________

Last edited by fysiks; 04-10-2009 at 17:16.
fysiks is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:15.


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