[FilterScript] Weather streamer
#1

This is my third release after the cruise control and the cb system. This filterscript allows you to set different weather to all parts of San Andreas (9 areas). The weather streams to player whenever they enter the area. Very simple and brings a lot to the game play. The FS sports 2 public functions that you can call from your gamemode:

Код:
stock SetAreaWeather(areaid, weatherid);
stock GetPlayerWeatherArea(playerid);
The first functions is the main function of the FS, it allows you to set weather in the chosen area. The second function is more for internal use of FS, but you may find use for it in your gamemode too.

There is also a callback:

Код:
OnPlayerEnterWeatherArea(playerid, areaid, weatherid);
It gets called whenever player enters new weather area. This callback may be a bit inaccurate, since FS checks for player position only once every 10 seconds - this is to prevent weather changing instantly when player balances on border of two areas. You don't need to use this callback, but if you want you can use it to inform player whenever they enter an area and tell them weather forecast like "Welcome to Whetstone, be careful there is heavy rain today". It doesn't matter what this callback returns.

The area ids are defined as follows:

Код:
#define WEATHER_AREA_NONE 0
#define WEATHER_AREA_LOS_SANTOS 1
#define WEATHER_AREA_LAS_VENTURAS 2
#define WEATHER_AREA_BONE_COUNTY 3
#define WEATHER_AREA_TIERRA_ROBADA 4
#define WEATHER_AREA_SAN_FIERRO 5
#define WEATHER_AREA_RED_COUNTY 6
#define WEATHER_AREA_FLINT_COUNTY 7
#define WEATHER_AREA_WHETSTONE 8
the WEATHER_AREA_NONE means player is outside San Andreas like on an island or in the sea. When player enters an interior, their weather is set to 0.

How to install:
* place WeatherStreamer.amx in your filterscripts folder
* Add WeatherStreamer to the filterscripts line in server.cfg
* place WeatherStreamer.inc in your pawno\include folder
* Put #include <WeatherStreamer> on top of your gamemode script

I recommend that you enable player clock in your GM - TogglePlayerClock(playerid, 1) to make weather changes smoother.

Example of use:
Код:
SetBoneCountyWeather(sandstorm)
{
	if (sandstorm) SetAreaWeather(WEATHER_AREA_BONE_COUNTY, 19);
	else SetAreaWeather(WEATHER_AREA_BONE_COUNTY, 1);
}
UPDATE 1.1: Fixed bug with Whetstone area not streaming in
UPDATE 1.2:
* Added public functions GetAreaWeather() and GetPlayerWeather()
* Changed default timer interval to 5000 ms
Reply


Messages In This Thread
Weather streamer, update v1.2 - by mick88 - 23.08.2010, 13:17
Re: Weather streamer - by Brian_Furious - 23.08.2010, 13:30
Re: Weather streamer - by Scenario - 23.08.2010, 13:48
Re: Weather streamer - by MisterTickle - 23.08.2010, 13:57
Re: Weather streamer - by mick88 - 23.08.2010, 14:09
Re: Weather streamer - by ScottCFR - 23.08.2010, 14:20
Re: Weather streamer - by WillyP - 23.08.2010, 14:59
Re: Weather streamer - by Dime - 23.08.2010, 15:38
Re: Weather streamer - by DiddyBop - 23.08.2010, 16:13
Re: Weather streamer - by WillyP - 23.08.2010, 17:11

Forum Jump:


Users browsing this thread: 2 Guest(s)