Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Опубликовано:

First of all:

This is NOT a Mod, it is a tool for Mod-Creators.

 

I made this to sum up every config for a mod into one File. Also it is now reall easy to read from text-files.

Also because it was a great function in the ServerAddon @itsmods

 

 

How to use it(Instructions for the File-Layout):

  • There is only one File: mod_config.ini . It is located in the admin Folder of your Server
  • If there is none, create it
  • Use the following Layout:
    [section]
    Variablename=Value
    Variablename2=Value45
    
    [MyHighJumpMod]
    JumpHeight=453
    PlayerSpeed=53453
    
    [YourAwsomeMod]
    YourMoreAwsomeVariableName=1337
    

 

How to add it in your Mod:

  • Copy this code inside your class:
    /**Searched through the mod_config.ini.
     *@ param Section The Section where the Variablename is located
     *@ param VariableName The Variablename
     *@ param DefaultValue This Value is beeing returned when there is no mod_config.ini or the Section could not be found or the VariableName could not be found
    */
    static public String getServerConfig(String Section, String VariableName, String DefaultValue)
           {
               string Path = "admin\\mod_config.ini";
    
               if (!File.Exists(Path))
                   return DefaultValue;
    
               StreamReader sr = new StreamReader(Path);
    
               bool InSection = false;
               for (String line = sr.ReadLine(); line != null; line = sr.ReadLine())
               {
                   //***** SEARCHING THE CORRECT SECTION
                   if (!InSection && line.StartsWith("["))
                   {
                       line = line.Substring(1, line.Length - 2);
                       if (line.CompareTo(Section) != 0)
                           continue;
                       InSection = true;
                       continue;
                   }
                   //***** SEARCHING THE CORRECT SECTION
    
                   if (!InSection)
                       continue;
    
                   //***** EXITING WHEN ANOTHER SECTION BEGINS
                   if (InSection && line.StartsWith("["))
                   {
                       return DefaultValue;
                   }
                   //***** EXITING WHEN ANOTHER SECTION BEGINS
    
                   //***** SEARCHING FOR THE VARIABLE NAME AND GRABBING THE VALUE
                   if (InSection)
                   {
                       String[] splitted = line.Split('=');
                       if (splitted.Length != 2)
                           continue;
    
                       if (splitted[0].CompareTo(VariableName) != 0)
                           continue;
    
                       return splitted[1];
                   }
                   //***** SEARCHING FOR THE VARIABLE NAME AND GRABBING THE VALUE
               }
               return DefaultValue;
           }


  • Usage in your code:
    int jumpheight=getServerConfig("MyHighJumpMod","JumpHeight","45");

Featured Replies

Опубликовано:
  • Автор

It is to get some some Variables for the Configuration of a MOD.

 

So if somebody want to develop a MOD where the Serveradmin can change between Sniper with knifing or Sniper without knifing.

 

E.G:

 

  • [sniperMod]
    KnifingEnabled=0

Опубликовано:
It is to get some some Variables for the Configuration of a MOD.

 

So if somebody want to develop a MOD where the Serveradmin can change between Sniper with knifing or Sniper without knifing.

 

E.G:

 

  • [sniperMod]
    KnifingEnabled=0

And how would that be impossible with dvars?

 

- script:

this._enableKnife = (Call("getDvarInt", "omgsnipe_knife", 0) != 0);

 

- server.cfg:

seta omgsnipe_knife 1

 

This also allows multiple server instances running your plugin to have different settings from each other.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Account

Navigation

Поиск

Поиск

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.