Scripting/Squirrel/Functions/ReadIniString: 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
(Created page with "__NOTOC__ This function reads a string saved to an .ini file. == Syntax == <code>string ReadIniString( string filename, string section, string var )</code> == Arguments ==...")
 
No edit summary
 
Line 33: Line 33:


{{Scripting/Squirrel/Functions/INI Functions}}
{{Scripting/Squirrel/Functions/INI Functions}}
[[Category:Scripting/Squirrel/Functions/INI_Functions]]

Latest revision as of 18:16, 30 January 2017

This function reads a string saved to an .ini file.

Syntax

string ReadIniString( 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 check whether the player connects from the same IP than earlier and auto-logs them in.

function onPlayerJoin( player ) {

    if ( ReadIniString( "IPs.ini", "IP", player.Name ) == player.IP )
    {
         /* some nice autologin stuff here */
         MessagePlayer( "You have auto-logged in successfully!", player );
    }

}

Notes

The functions player.IP, player.Name, MessagePlayer and call OnPlayerJoin were also used in in this example. More info about them in corresponding pages.

Related Functions