Skip to content

Callbacks

Ryan Lockard edited this page Jul 12, 2018 · 1 revision

Callbacks:

In addition to the various functions and configuration options found in this include, there are also two callbacks that can be used within your gamemode.

public OnWeatherObserverUpdate(observerid, oldweather, newweather)

Called whenever an observer detects that the weather has changed for a region.

observerid - The observer that has updated.

oldweather - The weather previously in that region.

newweather - The now current weather for the region.

public OnWeatherObserverUpdate(observerid, oldweather, newweather) {
    if(observerid == LS_Observer && newweather == WEATHER_CLEAR_PERIODIC_CLOUDS) {
        SendClientMessageToAll(-1, "The weather in Los Santos is now clear with periodic clouds.");
    }
    return 1;
}

public OnPlayerWeatherZoneChange(playerid, oldzone, newzone)

Called whenever a player enters/exits a zone.

playerid - The player whos zone has changed.

oldzone - The zone the player was previously standing in.

newzone - The zone the player is now standing in.

public OnPlayerWeatherZoneChange(playerid, oldzone, newzone) {
    if(newzone == LS_Zone) {
        SendClientMessageToAll(playerid, -1, "You have entered the Los Santos weather zone.");
    }
    return 1;
}

Note: If a player is not standing in any zone, oldzone/newzone will be -1.

Clone this wiki locally