Squirrel/Server/Functions/Ini/WriteIniBool
From Liberty Unleashed Wiki
(Difference between revisions)
(Updated example) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|WriteIniBool}} | |
+ | {{RequiresModule|lu_ini|Modules/Squirrel/lu_ini}} | ||
This function writes a boolean value to an .ini file. If the file does not exist, the function will create it. | This function writes a boolean value to an .ini file. If the file does not exist, the function will create it. | ||
Latest revision as of 10:28, 11 October 2010
Note: This function requires the external module lu_ini.
This function writes a boolean value to an .ini file. If the file does not exist, the function will create it.
[edit] Syntax
bool WriteIniBool( string filename, string section, string var, bool value )
[edit] 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
[edit] Example
This example will freeze a player and store the control state to an ini file when they type '/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 ); } }
[edit] 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.
[edit] Related Functions
These functions are provided by the official module lu_ini.