Scripting/Squirrel/Functions/DeleteIniSection: 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
(Created page with "__NOTOC__ This function deletes a selected section from a ini file. == Syntax == <code>DeleteIniSection( string FileName, string Section )</code> == Arguments == * '''File...")
 
No edit summary
 
Line 65: Line 65:


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

Latest revision as of 18:16, 30 January 2017

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