Scripting/Squirrel/Functions/CountIniSection: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary
No edit summary
 
Line 41: Line 41:


{{Scripting/Squirrel/Functions/INI Functions}}
{{Scripting/Squirrel/Functions/INI Functions}}
[[Category:Scripting/Squirrel/Functions/INI_Functions]]

Latest revision as of 18:15, 30 January 2017

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