Squirrel/Server/Functions/Ini/ReadIniString
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function reads a string saved to an .ini file. == Syntax == <code>string ReadIniString( string filename, string section, string var )</code> == Arguments == * '''filenam...) |
m |
||
Line 9: | Line 9: | ||
* '''filename''' This is the name of the file | * '''filename''' This is the name of the file | ||
− | * '''section''' The section that contains the value you want read | + | * '''section''' The section that contains the value you want to read |
* '''var''' The name of the variable | * '''var''' The name of the variable | ||
Line 28: | Line 28: | ||
=== Notes === | === Notes === | ||
− | The functions [[Squirrel/Functions/Player/GetPlayerIP|GetPlayerIP]], [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]] and call [[Squirrel/Events/Player/OnPlayerJoin|OnPlayerJoin]] were also used in in this example. More info about them in | + | The functions [[Squirrel/Functions/Player/GetPlayerIP|GetPlayerIP]], [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]] and call [[Squirrel/Events/Player/OnPlayerJoin|OnPlayerJoin]] were also used in in this example. More info about them in corresponding pages. |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Functions/Ini}} | {{Squirrel/Functions/Ini}} |
Revision as of 01:02, 4 March 2009
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, name ) { if ( ReadIniString( "IPs.ini", "IP", name ) == GetPlayerIP( player ) ) { /* some nice autologin stuff here */ MessagePlayer( "You have auto-logged in successfully!", player ); } }
Notes
The functions GetPlayerIP, MessagePlayer and call OnPlayerJoin were also used in in this example. More info about them in corresponding pages.