Squirrel/Server/Functions/Ini/WriteIniInteger

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function writes an integer value to an .ini file. If the file does not exist, the function will create it. == Syntax == <code>bool WriteIniInteger( string filename, string...)

Revision as of 00:33, 4 March 2009

This function writes an integer value to an .ini file. If the file does not exist, the function will create it.

Syntax

  1. 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.

  1.  
  2. function OnPlayerPart( player, name, reason )
  3. {
  4. WriteIniInteger( "PlayerCash.ini", "Cash", GetPlayerName( player ), GetPlayerCash( player ) );
  5. }
  6.  

Notes

The functions GetPlayerName, GetPlayerCash and call OnPlayerPart were also used in in this example. More info about them in the corresponding pages.

Related Functions

Template:Squirrel/Functions/Ini

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox