Scripting/Squirrel/Functions/CountIniSection

From Vice City Multiplayer
Revision as of 18:15, 30 January 2017 by Thijn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

This function says, how many values/lines are in a selected section in an ini file.

Syntax

CountIniSection( string FileName, string Section )

Arguments

  • FileName - This is the file name
  • Section - The section name. Use without "[" and "]"

Example

To see how this works, let's create (oh yeah, again) a sample ini file 'hola.ini'. You can copy and paste this: [Players] 1 = TheTammer 2 = TheSpaner 3 = TheHaxor 4 = TheCheatzor [Nothing] Nothing = true

We want to know how many values/lines are in the '[Players]' section. As you can see, there are 4 values in the section. But we want, that the script will tell us this.

function onServerStart() {

    print( "There are " + CountIniSection( "hola.ini", "Players" ) + " players saved." );

}

Notes

The call OnServerStart was used in in this example. More info about this in the corresponding page.


Related Functions