Scripting/Squirrel/Functions/DeleteIniSection

From Vice City Multiplayer
Revision as of 04:47, 22 June 2016 by King (talk | contribs) (Created page with "__NOTOC__ This function deletes a selected section from a ini file. == Syntax == <code>DeleteIniSection( string FileName, string Section )</code> == Arguments == * '''File...")
(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 deletes a selected section from a ini file.

Syntax

DeleteIniSection( 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 a sample ini file 'hastalavista.ini'. You can copy and paste this: [useful info] A = aaa

b = BBB

[spam] Nothing to see here = true [players] 1 = nub

2 = nab

3 = noob

Now we want to delete the '[spam]' section. Let's do this, when the server starts.

function onServerStart() {

    DeleteIniSection( "hastalavista.ini", "spam" );

}

After this check the ini file. It should look like this: [useful info]

A = aaa

b = BBB

[players]

1 = nub

2 = nab

3 = noob

Notes

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


Related Functions