Raised This Month: $ Target: $400
 0% 

Help with read_file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-29-2012 , 22:01   Help with read_file
Reply With Quote #1

How can I read a .ini file's every line ?

For example: If the .ini file contains "abc" word, run bla bla bla

if(containi(readed_file,"abc") != -1) {
//Codes
}
akcaliberg is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 08-29-2012 , 22:18   Re: Help with read_file
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"


public plugin_init()
    
register_plugin(PLUGINVERSIONAUTHOR)

GetData() {
    
    new 
ConfigDir[64]
    
    
get_configsdir(ConfigDircharsmax(ConfigDir))
    
    
format(ConfigDircharsmax(ConfigDir), "%s/Test.ini"ConfigDir
    
    new 
Data[100], File fopen(ConfigDir"rt")
        
    if (!
File
        return;
        
    while (!
feof(File)) {
        
        
fgets(FileDatacharsmax(Data))
            
        
trim(Data)
            
        if (
Data[0] == ';' || !Data[0]) 
            continue;
            
        if(
containi(Data"abc"))
            
server_print("DATA FOUND: %s"Data)
    }
        
    
fclose(File)

__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 08-29-2012 at 22:18.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-30-2012 , 14:53   Re: Help with read_file
Reply With Quote #3

thanks
akcaliberg is offline
Reply


Thread Tools
Display Modes

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 05:49.


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