IsWorldSpecialPropertyEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(fixed example style)
(Added to server-side)
 
(4 intermediate revisions by 3 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===
Line 22: Line 21:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function clientCheatScan()
function clientCheatScan()
  glp = getLocalPlayer()
        glp = getLocalPlayer()
  if isWorldSpecialPropertyEnabled("aircars") then
if isWorldSpecialPropertyEnabled("aircars") then
    clientCheat()
clientCheat()
  end
end
  if isWorldSpecialPropertyEnabled("hovercars") then
if isWorldSpecialPropertyEnabled("hovercars") then
    clientCheat()
clientCheat()
  end
end
  if isWorldSpecialPropertyEnabled("extrabunny") then
if isWorldSpecialPropertyEnabled("extrabunny") then
    clientCheat()
clientCheat()
  end
end
  if isWorldSpecialPropertyEnabled("extrajump") then
if isWorldSpecialPropertyEnabled("extrajump") then
    clientCheat()
clientCheat()
  end
end
end
end
setTimer(clientCheatScan, 15000, 0)
setTimer(clientCheatScan, 15000, 0)


function clientCheat() -- This function will send them to hell.
function clientCheat() -- This function will send them to hell.
  fadeCamera(false, 1, 255, 0, 0)
fadeCamera(false, 1, 255, 0, 0)
  x,y,z = getElementPosition(glp)
x,y,z = getElementPosition(glp)
  createExplosion(x,y,z, 1)
createExplosion(x,y,z, 1)
  toggleAllControls(false, true, true)
toggleAllControls(false, true, true)
  createMarker(x,y,z, "cylinder", 1, 1, 1, 1)
createMarker(x,y,z, "cylinder", 1, 1, 1, 1)
  setTimer(clientCheat, 200, 1)
setTimer(clientCheat, 200, 1)
  outputChatBox("WELCOME TO CHEATERS HELL LMAO!")
outputChatBox("WELCOME TO CHEATERS HELL LMAO!")
end
end
</syntaxhighlight>
</syntaxhighlight>
Line 51: Line 50:


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

Latest revision as of 08:34, 9 September 2023

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

Click to collapse [-]
Clientside example

This example detects any cheaters using these cheats on your server and sends them to hell, or you could kick them if you trigger a server event which does that.

function clientCheatScan()
        glp = getLocalPlayer()
	if isWorldSpecialPropertyEnabled("aircars") then
		clientCheat()
	end
	if isWorldSpecialPropertyEnabled("hovercars") then
		clientCheat()
	end
	if isWorldSpecialPropertyEnabled("extrabunny") then
		clientCheat()
	end
	if isWorldSpecialPropertyEnabled("extrajump") then
		clientCheat()
	end
end
setTimer(clientCheatScan, 15000, 0)

function clientCheat() -- This function will send them to hell.
	fadeCamera(false, 1, 255, 0, 0)
	x,y,z = getElementPosition(glp)
	createExplosion(x,y,z, 1)
	toggleAllControls(false, true, true)
	createMarker(x,y,z, "cylinder", 1, 1, 1, 1)
	setTimer(clientCheat, 200, 1)
	outputChatBox("WELCOME TO CHEATERS HELL LMAO!")
end

See Also