Squirrel/Server/Functions/Game/SetTime
From Liberty Unleashed Wiki
(Difference between revisions)
m (Squirrel/Functions/Game/SetTime moved to Squirrel/Server/Functions/Game/SetTime: Server-side scripting only) |
|||
Line 16: | Line 16: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | 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/ | + | 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
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'.
function onPlayerCommand( plr, cmd, text ) { if ( cmd == "settime" ) { local aTime = split( text, " " ); local szHour = aTime[0], szMin = aTime[1]; SetTime( szHour.tointeger(), szMin.tointeger() ); } }
Notes
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.
Related Functions
- CloseGarage
- CloseSSVBridge
- EnableTrains
- GetBoundariesLower
- GetBoundariesUpper
- GetFriendlyFire
- GetGamespeed
- GetGravity
- GetHour
- GetIslands
- GetMinute
- GetSSVBridgeLock
- GetSSVBridgeUpdateTime
- GetSurfaceTraction
- GetTimeLock
- GetWeather
- GetWeatherLock
- IsSSVBridgeUp
- OpenGarage
- OpenSSVBridge
- SetBoundaries
- SetFriendlyFire
- SetGamespeed
- SetGravity
- SetIslands
- SetSSVBridgeLock
- SetSSVBridgeUpdateTime
- SetSurfaceTraction
- SetTime
- SetTimeLock
- SetWeather
- SetWeatherLock