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...)
 
Line 16: Line 16:
===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==
<section name="Clientside example" class="client" show="true">
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.
<syntaxhighlight lang="lua">
function clientCheatScan()
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
</syntaxhighlight>
</section>


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

Revision as of 21:12, 25 April 2010

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

Syntax

bool isWorldSpecialPropertyEnabled ( string propname )

Required Arguments

  • propname: the name of the property to retrieve. Possible values are:
    • hovercars
    • aircars
    • extrabunny
    • extrajump

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()
	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