SA-MP Forums Archive
[FilterScript] Weather streamer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Weather streamer (/showthread.php?tid=170552)



Weather streamer, update v1.2 - mick88 - 23.08.2010

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


Re: Weather streamer - Brian_Furious - 23.08.2010

Incredible, i'll test it...it looks nice


Re: Weather streamer - Scenario - 23.08.2010

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


Re: Weather streamer - MisterTickle - 23.08.2010

Now thats a very unique idea, Awesome.


Re: Weather streamer - mick88 - 23.08.2010

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.


Re: Weather streamer - ScottCFR - 23.08.2010

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


Re: Weather streamer - WillyP - 23.08.2010

wow, amazing!


Re: Weather streamer - Dime - 23.08.2010

Rly nice FS


Re: Weather streamer - DiddyBop - 23.08.2010

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

Useful for RP servers like a mofucka.


Re: Weather streamer - WillyP - 23.08.2010

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: