IsWorldSpecialPropertyEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client function}} Checks if a special world property (cheat) is enabled or not. ==Syntax== <syntaxhighlight lang="lua">bool isWorldSpecialPropertyEnabled ( string propname )</syntaxhighlight> ===Requir...)
 
(added example script)
 
(11 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Shared function}}
 
{{New feature/item|3.0161|1.6.0|22195|Added also as a server-side function. Previously only available as a client-side function.}}


Checks if a special world property (cheat) is enabled or not.
Checks if a special world property (cheat) is enabled or not.
Line 6: Line 8:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool isWorldSpecialPropertyEnabled ( string propname )</syntaxhighlight>
<syntaxhighlight lang="lua">bool isWorldSpecialPropertyEnabled ( string propname )</syntaxhighlight>
{{OOP||||setWorldSpecialPropertyEnabled}}


===Required Arguments===
===Required Arguments===
*'''propname:''' the name of the property to retrieve. Possible values are:
*'''propname:''' the name of the property to retrieve. Possible values are listed on [[SetWorldSpecialPropertyEnabled]].
**'''hovercars'''
**'''aircars'''
**'''extrabunny'''
**'''extrajump'''


===Returns===
===Returns===
Returns ''true'' if the property is enabled, ''false'' if it is disabled or the specified property name is invalid.
Returns ''true'' if the property is enabled, ''false'' if it is disabled or the specified property name is invalid.
==Example==
This code allows you to enable/disable aircars world property using /toggleAirCars command.
<syntaxhighlight lang="lua">
function toggleAirCars()
    setWorldSpecialPropertyEnabled( "aircars", not isWorldSpecialPropertyEnabled("aircars") )
end
addCommandHandler("toggleAirCars", toggleAirCars)
</syntaxhighlight>


==See Also==
==See Also==
{{Client world functions}}
{{World functions}}

Latest revision as of 21:39, 8 April 2025

ADDED/UPDATED IN VERSION 1.6.0 r22195:
Added also as a server-side function. Previously only available as a client-side function.

Checks if a special world property (cheat) is enabled or not.

Syntax

bool isWorldSpecialPropertyEnabled ( string propname )

OOP Syntax Help! I don't understand this!

Counterpart: setWorldSpecialPropertyEnabled


Required Arguments

Returns

Returns true if the property is enabled, false if it is disabled or the specified property name is invalid.

Example

This code allows you to enable/disable aircars world property using /toggleAirCars command.

function toggleAirCars()
    setWorldSpecialPropertyEnabled( "aircars", not isWorldSpecialPropertyEnabled("aircars") )
end
addCommandHandler("toggleAirCars", toggleAirCars)

See Also