Squirrel/Server/Functions/Game/SetTime

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
Line 16: Line 16:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function OnPlayerCommand( id, cmd, text )
+
function onPlayerCommand( plr, cmd, text )
 
{
 
{
 
     if ( cmd == "settime" )
 
     if ( cmd == "settime" )
Line 22: Line 22:
 
           local aTime = split( text, " " );
 
           local aTime = split( text, " " );
 
           local szHour = aTime[0], szMin = aTime[1];
 
           local szHour = aTime[0], szMin = aTime[1];
 +
         
 
           SetTime( szHour.tointeger(), szMin.tointeger() );
 
           SetTime( szHour.tointeger(), szMin.tointeger() );
 
     }
 
     }
Line 29: Line 30:
 
=== Notes ===
 
=== Notes ===
  
The call [[Squirrel/Events/Player/OnPlayerCommand|OnPlayerCommand]] was used in in this example. More info about this in the corresponding page.
+
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
{{Squirrel/Functions/Game}}
+
{{Squirrel/Server/Functions/Game}}

Revision as of 00:04, 27 November 2009

Changes the server world time. This affects all players.

Syntax

  1. bool SetTime( int hour, int min )

Arguments

  • hour - The number of hours you want to change the server time to
  • min - The number of minutes you want to change the server time to

Example

This command will change the server time to 12:00 when somebody types '/settime 12 00'.

  1.  
  2. function onPlayerCommand( plr, cmd, text )
  3. {
  4. if ( cmd == "settime" )
  5. {
  6. local aTime = split( text, " " );
  7. local szHour = aTime[0], szMin = aTime[1];
  8. SetTime( szHour.tointeger(), szMin.tointeger() );
  9. }
  10. }
  11.  

Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox