Scripting/Squirrel/Functions/GetWeather: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "This function will get the weather ID of the game. == Syntax == <pre>GetWeather()</pre> == Arguments == '''N/A''' == Return value == * ''int'' '''weatherid''' - The weat...")
 
 
(5 intermediate revisions by 2 users not shown)
Line 14: Line 14:


== Example ==
== Example ==
 
<pre>
{{Scripting/Needs_Example}}
function onPlayerCommand( iPlayer, szCommand, szArguments ) {
 
switch( szCommand.tolower( ) ) {
case "setweather":
if( !szArguments ) ClientMessage( "Invalid syntax, correct usage: /" + szCommand + " [ID]", iPlayer, 255, 0, 0, 255 );
else if ( !IsNum( szArguments ) ) ClientMessage( "ID must be an integer.", iPlayer, 255, 0, 0, 255 );
else if ( GetWeather() == szArguments.tointeger( ) ) ClientMessage( "The weather ID specified is already being used.", iPlayer, 255, 0, 0, 255 );
else {
SetWeather( szArguments.tointeger( ) );
ClientMessageToAll( iPlayer.Name + " has set the weather to " + szArguments + "!", 255, 255, 255, 255 );
}
break;
}
}
</pre>
=== Notes ===
=== Notes ===
 
Call [[onPlayerCommand]] was used in this example. More info about them in the corresponding pages.


== Related Functions ==
== Related Functions ==


{{Scripting/Squirrel/Functions/Server_Settings}}
{{Scripting/Squirrel/Functions/Server_Settings}}
[[Category:Scripting/Squirrel/Functions/Server_Settings _Functions]]

Latest revision as of 08:26, 9 March 2017

This function will get the weather ID of the game.

Syntax

GetWeather()

Arguments

N/A

Return value

  • int weatherid - The weather ID of the game

Example

function onPlayerCommand( iPlayer, szCommand, szArguments ) {
	switch( szCommand.tolower( ) ) {
		case "setweather":
			if( !szArguments ) ClientMessage( "Invalid syntax, correct usage: /" + szCommand + " [ID]", iPlayer, 255, 0, 0, 255 );
			else if ( !IsNum( szArguments ) ) ClientMessage( "ID must be an integer.", iPlayer, 255, 0, 0, 255 );
			else if ( GetWeather() == szArguments.tointeger( ) ) ClientMessage( "The weather ID specified is already being used.", iPlayer, 255, 0, 0, 255 );
			else {
				SetWeather( szArguments.tointeger( ) );
				ClientMessageToAll( iPlayer.Name + " has set the weather to " + szArguments + "!", 255, 255, 255, 255 );
			}
		break;
	}	
}

Notes

Call onPlayerCommand was used in this example. More info about them in the corresponding pages.

Related Functions