Scripting/Squirrel/Functions/WriteIniInteger: 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
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
This function writes an integer value to an .ini file. If the file does not exist, the function will NOT create it because the ini plugin is messed up.
This function writes an integer value to an .ini file. If the file does not exist, the function will NOT create it because the ini plugin is messed up, you'll manually need to create the file.


== Syntax ==
== Syntax ==

Revision as of 05:17, 12 July 2016

This function writes an integer value to an .ini file. If the file does not exist, the function will NOT create it because the ini plugin is messed up, you'll manually need to create the file.

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, 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