Gameplay::setWeatherTypeOverTime: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
Line 7: Line 7:
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==  
<syntaxhighlight lang="javascript">
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, <u>not milliseconds</u>.
// todo
 
</syntaxhighlight>
{{ClientsideCode|
<pre>
//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);
});
</pre>
}}
 
 
{{ServersideCode|
<pre>
//In a setweather command for example with params 'params.weather' and 'params.time'
 
mp.players.forEach((player) => {
    player.call('transitionWeather', [params.weather, params.time])
});
</pre>
}}
 
==See also==
==See also==
{{Gameplay_s_function_c}}
{{Gameplay_s_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Revision as of 20:26, 15 November 2020

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])
});

See also

Template:Gameplay s function c