[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
#2

Incredible, i'll test it...it looks nice
Reply
#3

Wow! Is this what's running on your server?
Reply
#4

Now thats a very unique idea, Awesome.
Reply
#5

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Wow! Is this what's running on your server?
Not yet, it will in next update. I need to finish testing it and define sets of weathers for each area.
Reply
#6

Wow, I didn't think this was possible. I'll have a look at your code to see how it works
Reply
#7

wow, amazing!
Reply
#8

Rly nice FS
Reply
#9

More simple then i thought. Can't believe nobody made this before.

Useful for RP servers like a mofucka.
Reply
#10

Quote:
Originally Posted by DiddyBop
Посмотреть сообщение
More simple then i thought. Can't believe nobody made this before.

Useful for RP servers like a mofucka.
offtopic: ure dp is shit D:
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)