AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help]How to modify the configration files (https://forums.alliedmods.net/showthread.php?t=55532)

Cover 05-23-2007 23:05

[Help]How to modify the configration files
 
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.

scrtxxcaz 05-23-2007 23:47

Re: [Help]How to modify the configration files
 
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)
   
            }
 }


Cover 05-25-2007 08:25

Re: [Help]How to modify the configration files
 
"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;
    }
  }
}
}


donnie.yang 05-25-2007 13:39

Re: [Help]How to modify the configration files
 
....

Zenith77 05-25-2007 15:16

Re: [Help]How to modify the configration files
 
Quote:

Originally Posted by donnie.yang (Post 480480)
Oh.I'm not code

What the yam?

Cover 05-26-2007 01:44

Re: [Help]How to modify the configration files
 
:oops: :cry: :cry: Ohoh.nobody reply


All times are GMT -4. The time now is 10:33.

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