OnPlayerChangesWorldSpecialProperty

From Multi Theft Auto: Wiki
Revision as of 19:36, 27 November 2024 by Nico834 (talk | contribs) (Add an important note)
Jump to navigation Jump to search

[[{{{image}}}|link=|]] Important Note: This event is currently not available for use, as there is no new nightly build yet. Please wait patiently and keep an eye on the page for further updates.
BETA: NEW FEATURE (BUILD: 1.6.0 r0)
This event is triggered every a player calls setWorldSpecialPropertyEnabled.

Parameters

string property, bool enabled
  • property: The name of the property
  • enabled: The property's state

Source

The source of this event is the player who changed a special property.

Canceling

This event cannot be cancelled.

Example

The example below bans the player if a cheat is activated

local cheats = {
    ["hovercars"] = true,
    ["aircars"] = true,
    ["extrabunny"] = true,
    ["extrajump"] = true
}

addEventHandler("onPlayerChangesWorldSpecialProperty", root,
    function(property, enabled)
        if not cheats[property] then
            return
        end

        if not enabled then
            return
        end

        banPlayer(source, false, false, true, "Server", "Time to take a permanent break :-)")
    end
)

See Also

Player events


Event functions