Squirrel/Server/Functions/Ini/ReadIniBool

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function reads a boolean value from an .ini file. == Syntax == <code>bool ReadIniBool( string filename, string section, string var )</code> == Arguments == * '''filename...)
 
(Removed 'name' from the OnPlayerJoin function)
Line 16: Line 16:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function OnPlayerJoin( player, name )
+
function OnPlayerJoin( player )
 
{
 
{
     if ( ReadIniBool( "Players.ini", "Frozen", name ) )
+
     if ( ReadIniBool( "Players.ini", "Frozen", GetPlayerName( player ) ) )
 
     {
 
     {
 
           SetPlayerFrozen( player, true );
 
           SetPlayerFrozen( player, true );

Revision as of 15:19, 4 March 2009

This function reads a boolean value from an .ini file.

Syntax

  1. bool ReadIniBool( string filename, string section, string var )

Arguments

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

Example

This example will check whether the player has been frozen earlier and if so, freezes them on join.

  1.  
  2. function OnPlayerJoin( player )
  3. {
  4. if ( ReadIniBool( "Players.ini", "Frozen", GetPlayerName( player ) ) )
  5. {
  6. SetPlayerFrozen( player, true );
  7. MessagePlayer( "Sorry, you have been frozen earlier! :)", player );
  8. }
  9. }
  10.  

Notes

The functions SetPlayerFrozen, MessagePlayer and call OnPlayerJoin 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