Squirrel/Server/Functions/Ini/ReadIniInteger

From Liberty Unleashed Wiki
Revision as of 01:03, 27 November 2009 by Juppi (Talk | contribs)

Jump to: navigation, search

This function reads an integer value from an .ini file.

Syntax

  1. int ReadIniInteger( string filename, string section, string var )

Arguments

  • filename This is the name of the file
  • section The section that contains the value you want to read
  • var The name of the variable

Example

This example will restore the cash amount player had on a previous visit.

  1.  
  2. function OnPlayerJoin( player )
  3. {
  4. local cash = ReadIniInteger( "PlayerCash.ini", "Cash", GetPlayerName( player ) );
  5.  
  6. if ( cash )
  7. {
  8. SetPlayerCash( player, cash );
  9. }
  10. }
  11.  

Notes

The function SetPlayerCash and call OnPlayerJoin were also used in in this example. More info about them in corresponding pages.

Related Functions

Template:Squirrel/Functions/Ini

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox