Raised This Month: $ Target: $400
 0% 

[Help]How to modify the configration files


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cover
New Member
Join Date: May 2007
Old 05-23-2007 , 23:05   [Help]How to modify the configration files
Reply With Quote #1

My English is very poor.So I wish you guys can understand what I said.

I will modify a configuration file like users.ini.
I use "read_file ( const file[], line, text[], len, &txtLen )" to read it.
but I don't know how to add/modify/delete a line in it.Pls help.Tks.

Last edited by Cover; 05-23-2007 at 23:20.
Cover is offline
Send a message via MSN to Cover
scrtxxcaz
Senior Member
Join Date: Feb 2007
Location: a place u cant find
Old 05-23-2007 , 23:47   Re: [Help]How to modify the configration files
Reply With Quote #2

this will replace the line found with a new line
Code:
 new text[512], line, len
 while ( read_file(file, line++, text, 511, len) ) 
 {
            new steamid[32]
            get_user_authid(id,steamid,31)
            if ( contain(text, steamid) != -1 ) 
            {
                      new msg[256]
                      format(msg,255," NEW TEXT HERE")
                      replace(text, 511, text, msg)
                      write_file(file, text, line - 1)
    
             }
 }
__________________
Please leave your name when giving me any karma

Counter Strike Freeze Tag
Status: Testing.... (bugs)

Revised Registration
Status: In Progress
scrtxxcaz is offline
Send a message via AIM to scrtxxcaz
Cover
New Member
Join Date: May 2007
Old 05-25-2007 , 08:25   Re: [Help]How to modify the configration files
Reply With Quote #3

"fisker" "vip" // in models.ini,I want replace "vip" to "leet"

I code this,but can not modify the file.........

Code:
public modifymodel(id,level,cid)
{
       if(!cmd_access(id,level,cid,3))
           {
             return PLUGIN_HANDLED
           }
 
       new configsDir[64]
       get_configsdir(configsDir, 63)
       format(configsDir, 63, "%s/models.ini", configsDir)
 
       if (file_exists(configsDir)) {
 
       new name[33],AuthData[33],Models[33],ReplaceModel[33],Text[512], len, line = 0
 
      read_argv(1,name,32)
      read_argv(2,ReplaceModel,32)
 
      while(read_file(configsDir,line++,Text,512,len)){
 
      Models[0]=0;
      AuthData[0]=0;
      parse(Text,AuthData,sizeof(AuthData)-1,Models,sizeof(Models)-1)
      if(equali(name,AuthData))
     {
         replace(Models,32,Models,ReplaceModel)
         write_file(configsDir,Text,line - 1)
         break;
     }
  }
}
}

Last edited by Cover; 05-30-2007 at 23:49.
Cover is offline
Send a message via MSN to Cover
donnie.yang
New Member
Join Date: May 2007
Old 05-25-2007 , 13:39   Re: [Help]How to modify the configration files
Reply With Quote #4

....

Last edited by donnie.yang; 07-21-2008 at 04:38.
donnie.yang is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-25-2007 , 15:16   Re: [Help]How to modify the configration files
Reply With Quote #5

Quote:
Originally Posted by donnie.yang View Post
Oh.I'm not code
What the yam?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Cover
New Member
Join Date: May 2007
Old 05-26-2007 , 01:44   Re: [Help]How to modify the configration files
Reply With Quote #6

Ohoh.nobody reply
Cover is offline
Send a message via MSN to Cover
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 10:33.


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