Raised This Month: $ Target: $400
 0% 

fgets, format (general messup)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
marky_uk
Junior Member
Join Date: Aug 2008
Old 04-10-2009 , 17:16   Re: fgets, format (general messup)
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
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)
         
        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

fgets stores data into the second parameter and returns 0 on error

EDIT: OR DOES IT :p
EDIT2: NO IT DOESNT >.<

Last edited by marky_uk; 04-10-2009 at 17:18.
marky_uk 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