Squirrel/Server/Functions/Ini/ReadIniBool

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
Line 16: Line 16:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function OnPlayerJoin( player )
+
function onPlayerJoin( player )
 
{
 
{
     if ( ReadIniBool( "Players.ini", "Frozen", GetPlayerName( player ) ) )
+
     if ( ReadIniBool( "Players.ini", "Frozen", player.Name ) )
 
     {
 
     {
           SetPlayerFrozen( player, true );
+
           player.IsFrozen = true;
 
           MessagePlayer( "Sorry, you have been frozen earlier! :)", player );
 
           MessagePlayer( "Sorry, you have been frozen earlier! :)", player );
 
     }
 
     }
Line 28: Line 28:
 
=== Notes ===
 
=== Notes ===
  
The functions [[Squirrel/Functions/Player/SetPlayerFrozen|SetPlayerFrozen]], [[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 corresponding pages.
+
The functions [[Squirrel/Server/Functions/Players/IsFrozen|Player.IsFrozen]], [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and call [[Squirrel/Server/Events/Player/onPlayerJoin|onPlayerJoin]] were also used in in this example. More info about them in the corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
{{Squirrel/Functions/Ini}}
+
{{Squirrel/Server/Functions/Ini}}

Revision as of 01:08, 27 November 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", player.Name ) )
  5. {
  6. player.IsFrozen = true;
  7. MessagePlayer( "Sorry, you have been frozen earlier! :)", player );
  8. }
  9. }
  10.  

Notes

The functions Player.IsFrozen, MessagePlayer and call onPlayerJoin were also used in in this example. More info about them in the corresponding pages.

Related Functions

These functions are provided by the official module lu_ini.

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox