Gameplay::setWeatherTypeOverTime
Syntax
mp.game.gameplay.setWeatherTypeOverTime(weatherType, time);
Required Arguments
- weatherType: String
- time: float
Return value
- Undefined
Example
This example will call the client-side event 'transitionWeather' for the every player, to synchronise the weather. This gradually transitions the weather over x seconds, not milliseconds.
Client-Side
//newWeather - string, any of weather / timeTaken - time taken to transition from old weather to new weather in seconds
mp.events.add('transitionWeather', (newWeather, timeTaken) => {
mp.game.gameplay.setWeatherTypeOverTime(newWeather, timeTaken);
});
Server-Side
//In a setweather command for example with params 'params.weather' and 'params.time'
mp.players.forEach((player) => {
player.call('transitionWeather', [params.weather, params.time])
});