View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-23-2010 , 20:27   Re: Read data from file
Reply With Quote #20

Did you even read ot_207's post?

Quote:
Originally Posted by ot_207 View Post
PHP Code:
stock print_file()
{
    
// Open a file, path starts from cstrike folder
    
new fp fopen("server.cfg"), buffer[100]
    
    
// Foef means is it end of file?
    
while (!feof(fp))
    {
        
// Get the line
        
fgets(fpbuffercharsmax(buffer)
        
// Print it in the server console
        
server_print("FILE CONTENT: %s"buffer)
    }
    
    
// Close file handle
    
fclose(fp)

I have not tested it. Wrote it here.
Also check the funcwiki for more function details.
Don't use this code (use trim()):

Quote:
Originally Posted by Peoples Army View Post
PHP Code:
Note that fgets includes a newline if one is reachedA quick way to strip newlines is


new 
len strlen(string)
if (
string[len-1] == '^n')
   
string[--len] = 
Quote:
Originally Posted by Bugsy View Post
If you prefer to recheck every player at round start you should cache the steam id at client putinserver.
I don't see how this makes sense at all. SteamID remains unchanged.
__________________

Last edited by fysiks; 07-23-2010 at 20:42.
fysiks is offline