Scripting/Squirrel/Functions/WriteIniBool: 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 writes a boolean value to an .ini file. If the file does not exist, the function will create it. == Syntax == <code>bool WriteIniBool( string filenam...")
 
No edit summary
 
Line 36: Line 36:


{{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 writes a boolean value to an .ini file. If the file does not exist, the function will create it.

Syntax

bool WriteIniBool( string filename, string section, string var, bool value )

Arguments

  • filename This is the name of the file
  • section The section that contains the value you want to create/edit
  • var The name of the variable
  • value The boolean true/false

Example

This example will freeze a player and store the control state to an ini file when they type '/c freezeme'.

function onPlayerCommand( player, command, text ) {

    if ( command = "freezeme" )
    {
         player.IsFrozen = true;
         WriteIniBool( "Players.ini", "Frozen", player.Name, true );
         MessagePlayer( "Buhaha! You can't move anymore!", player );
    }

}

Notes

The functions player.IsFrozen, player.Name, MessagePlayer and call OnPlayerCommand were also used in in this example. More info about them in the corresponding pages.

Related Functions