Mweather
From SA-MP Wiki
MWeather is an include that expands the weather functionalities of SA-MP by things like (moving) weather zones, and the ability to set real world weather using yahoo weather. This page explains the functions provided by the MWeather include by User:Mauzen To use the functions, you need to use at least SA-MP server version 0.3b and of course the include that you can get here: http://forum.sa-mp.com/showthread.php?t=181897
Contents |
Defines
Real weather observers use the following defines to represent the weather state of their url. Not all are used automatically in the script yet.
#define WEATHER_UNKNOWN 0 #define WEATHER_SUNNY 1 #define WEATHER_MOSTLY_SUNNY 2 #define WEATHER_PARTLY_CLOUDY 3 #define WEATHER_MOSTLY_CLOUDY 4 #define WEATHER_CLOUDY 5 #define WEATHER_LIGHT_RAIN 6 #define WEATHER_SHOWERS 7 #define WEATHER_RAIN 8 #define WEATHER_LIGHT_THUNDERSTORM 9 #define WEATHER_THUNDERSTORM 10 #define WEATHER_MIST 11 #define WEATHER_SNOWRAIN 12 #define WEATHER_LIGHT_SNOW 13
General
SetWeatherEx
Description:
weatherid | WeatherID to set. |
Return Values:
GetWeatherEx
Description:
Return Values:
SetPlayerWeatherEx
Description:
playerid | The ID of the player to change the weather for. |
weatherid | WeatherID to set. |
Return Values:
GetPlayerWeatherEx
Description:
playerid | The ID of the player to get the weather from. |
Return Values:
SetRealWeatherEx
Description:
observerid | The observerid of a valid real weather observer. |
Return Values:
GetRealWeatherEx
Description:
Return Values:
SetPlayerRealWeatherEx
Description:
playerid | The ID of the player to change the weather for. |
observerid | The observerid of a valid real weather observer. |
Return Values:
GetPlayerRealWeatherEx
Description:
playerid | The ID of the player to get the weather from. |
Return Values:
Real weather
AddWeatherObserver
Description:
url[] | The link to the wanted position from weather.yahoo.com. |
updatetime | Interval in ms in which the weather is checked (10 mins are more than enough for normal use). |
Return Values:
Note | To get the URL, go to weather.yahoo.com and search for the town/area you want.
Use the link up to the last slash (e.g. http://weather.yahoo.com/bahrain/capital/manama-1967057/) |
Example:
//This example creates a weather observer for Chicago //and sets it as global weather public OnGameModeInit() { new chicago = AddWeatherObserver("http://weather.yahoo.com/united-states/illinois/chicago-2379574/", 900000); SetRealWeatherEx(chicago); }
RemoveWeatherObserver
Description:
observerid | The ID to remove. |
Return Values:
Weather zones
AddWeatherZone
Description:
Float:x/y/z | The center position of the zone. |
Float:length/width/height | The measurement of the zone |
weatherid | The WeatherID or a valid observerid of the weather to set in the zone. |
observer | Set this to false, if weatherid is a samp WeatherID, and to true, if it is an observerid |
Return Values:
MoveWeatherZone
Description:
zoneid | The ID of the zone to move. |
Float:tox/toy/toz | The target position to move to. |
Float:speed | The speed in meters/sec (not exactly in current version) the zone moves with. |
Return Values:
Example:
//This example creates a rain weatherzone which width covers all SA in the north //and moves it down slowly. new northsouth; public OnGameModeInit() { northsouth = AddWeatherZone(0.0, 3000.0, 50.0, 6000.0, 500.0, 100.0, 8, false); MoveWeatherZone(northsouth, 0.0, 3000.0, 50.0, 20.0); }
StopWeatherZone
Description:
zoneid | The ID of the zone to stop. |
Return Values:
Callbacks
OnPlayerWeatherZoneChange
Description:
playerid | The ID of the player, who enters/leaves a zone. |
oldzone | The ID of the zone, the player was in previously (-1 means no zone). |
newzone | The ID of the zone, the player is now in (-1 means no zone). |
Return Values:
OnWeatherZoneMoved
Description:
zoneid | The ID of the zone, that stops moving. |
Return Values:
OnRealWeatherUpdate
Description:
observerid | The ID of the real weather observer. |
oldstate | The previous weather state of the observer. |
newstate | The new weather state of the observer. |
Return Values: