Scripting/Squirrel/Functions/SetWeather: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary |
|||
Line 10: | Line 10: | ||
== Example == | == Example == | ||
<pre> | |||
{{ | 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 ) ClientMessage( "The weather ID specified is already being used.", iPlayer, 255, 0, 0, 255 ); | |||
else { | |||
SetWeather( szArguments ); | |||
ClientMessageToAll( iPlayer.Name + " has set the weather to " + szArguments + "!", 255, 255, 255, 255 ); | |||
} | |||
break; | |||
} | |||
} | |||
</pre> | |||
=== Notes === | === Notes === | ||
Call [[onPlayerCommand]] and function [[GetWeather]] 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}} |
Revision as of 08:19, 9 March 2017
This function will set the weather of the game.
Syntax
SetWeather( weatherid )
Arguments
- int weatherid - The weather id to be set
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 ) ClientMessage( "The weather ID specified is already being used.", iPlayer, 255, 0, 0, 255 ); else { SetWeather( szArguments ); ClientMessageToAll( iPlayer.Name + " has set the weather to " + szArguments + "!", 255, 255, 255, 255 ); } break; } }
Notes
Call onPlayerCommand and function GetWeather was used in this example. More info about them in the corresponding pages.
Related Functions
- GetDeathmatchScoreboard
- GetDeathMessages
- GetDrivebyEnabled
- GetDriveOnWater
- GetFallEnabled
- GetFastSwitch
- GetFlyingCars
- GetFrameLimiter
- GetFriendlyFire
- GetGameModeName
- GetGamespeed
- GetGravity
- GetHour
- GetJoinMessages
- GetJumpSwitch
- GetKillDelay
- GetMaxHeight
- GetMaxPlayers
- GetMinute
- GetObjectCount
- GetPerfectHandling
- GetPickupCount
- GetPlayers
- GetServerName
- GetPassword
- GetShootInAir
- GetShowNametags
- GetShowOnlyTeamMarkers
- GetShowOnRadar
- GetSkinID
- GetStuntBike
- GetSyncFrameLimiter
- GetTaxiBoostJump
- GetTickCount
- GetTimeRate
- GetVehicleCount
- GetVehiclesForcedRespawnHeight
- GetWallglitch
- GetWaterLevel
- GetWeaponSync
- GetWeather
- ReloadScripts
- SetDeathmatchScoreboard
- SetDeathMessages
- SetDrivebyEnabled
- SetDriveOnWater
- SetFallEnabled
- SetFastSwitch
- SetFlyingCars
- SetFrameLimiter
- SetFriendlyFire
- SetGameModeName
- SetGamespeed
- SetGravity
- SetHour
- SetJoinMessages
- SetJumpSwitch
- SetKillDelay
- SetMaxHeight
- SetMaxPlayers
- SetMinute
- SetPerfectHandling
- SetServerName
- SetPassword
- SetShootInAir
- SetShowNametags
- SetShowOnlyTeamMarkers
- SetShowOnRadar
- SetStuntBike
- SetSyncFrameLimiter
- SetTaxiBoostJump
- SetTimeRate
- SetTime
- SetVehiclesForcedRespawnHeight
- SetWallglitch
- SetWaterLevel
- SetWeaponSync
- ShutdownServer