Squirrel/Server/Functions/Game/GetHour
From Liberty Unleashed Wiki
(Difference between revisions)
m (Squirrel/Functions/Game/GetHour moved to Squirrel/Server/Functions/Game/GetHour: Server-side scripting only) |
m (Updated with the latest functions) |
||
Line 15: | Line 15: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | function onPlayerCommand( plr, cmd, text ) |
{ | { | ||
if ( cmd == "time" ) | if ( cmd == "time" ) | ||
{ | { | ||
− | MessagePlayer( "Server time is: " + GetHour() + ":" + GetMinute(), | + | MessagePlayer( "Server time is: " + GetHour() + ":" + GetMinute(), plr ); |
} | } | ||
} | } | ||
Line 26: | Line 26: | ||
=== Notes === | === Notes === | ||
− | The functions [[Squirrel/Functions/ | + | The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]], [[Squirrel/Server/Functions/Game/GetMinute|GetMinute]] and call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in in this example. More info about them in corresponding pages. |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Functions/Game}} | {{Squirrel/Functions/Game}} |
Revision as of 23:13, 26 November 2009
Returns the current hour in the server.
Syntax
int GetHour()
Arguments
- None
Example
This command will tell player the current time in the server when they type '/time'.
function onPlayerCommand( plr, cmd, text ) { if ( cmd == "time" ) { MessagePlayer( "Server time is: " + GetHour() + ":" + GetMinute(), plr ); } }
Notes
The functions MessagePlayer, GetMinute and call onPlayerCommand were used in in this example. More info about them in corresponding pages.