Squirrel/Server/Functions/Ini/WriteIniInteger
From Liberty Unleashed Wiki
(Difference between revisions)
m (Squirrel/Functions/Ini/WriteIniInteger moved to Squirrel/Server/Functions/Ini/WriteIniInteger: Server-side scripting only) |
|||
Line 17: | Line 17: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | function onPlayerPart( player, name, reason ) |
{ | { | ||
− | WriteIniInteger( "PlayerCash.ini", "Cash", | + | WriteIniInteger( "PlayerCash.ini", "Cash", player.Name, player.Cash ); |
} | } | ||
</code> | </code> | ||
Line 25: | Line 25: | ||
=== Notes === | === Notes === | ||
− | The functions [[Squirrel/Functions/ | + | The functions [[Squirrel/Server/Functions/Players/Name|Player.Name]], [[Squirrel/Server/Functions/Players/Cash|Player.Cash]] and call [[Squirrel/Server/Events/Player/onPlayerPart|onPlayerPart]] were also used in in this example. More info about them in the corresponding pages. |
== Related Functions == | == Related Functions == | ||
− | {{Squirrel/Functions/Ini}} | + | {{Squirrel/Server/Functions/Ini}} |
Revision as of 00:55, 27 November 2009
This function writes an integer value to an .ini file. If the file does not exist, the function will create it.
Syntax
bool WriteIniInteger( string filename, string section, string var, int 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 integer value for the variable
Example
This example will save player's cash to a file 'PlayerCash.ini' when they leave the game.
function onPlayerPart( player, name, reason ) { WriteIniInteger( "PlayerCash.ini", "Cash", player.Name, player.Cash ); }
Notes
The functions Player.Name, Player.Cash and call onPlayerPart were also used in in this example. More info about them in the corresponding pages.
Related Functions
These functions are provided by the official module lu_ini.