IsGlitchEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 21: Line 21:
local adminsGroup = aclGetGroup ( "Admin" )
local adminsGroup = aclGetGroup ( "Admin" )
local playerName = getPlayerName ( human )
local playerName = getPlayerName ( human )
        -- check player's admin rights
if ( isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) ) then
if ( isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) ) then
if (isGlitchEnabled( "quickreload" ) and isGlitchEnabled( "fastfire" ) == true) then
                -- check is quickreaload and fastfire glitches enabled
setGlitchEnabled ( "quickreload", false )
if (isGlitchEnabled( "quickreload" ) and isGlitchEnabled( "fastfire" ) == true) then  
                        -- if they are glitches are enabled then we need to disable them
                        setGlitchEnabled ( "quickreload", false )
setGlitchEnabled ( "fastfire", false )
setGlitchEnabled ( "fastfire", false )
outputChatBox ( "Anti-Glitch is turned off!" )
outputChatBox ( "Anti-Glitch is turned off!" )

Revision as of 07:58, 12 March 2010

This function retrieves whether San Andreas game glitches are enabled or not, set by using setGlitchEnabled

Syntax

bool isGlitchEnabled ( string glitchName )

Required Arguments

  • glitchName: the name of the property to set. Possible values are:
    • quickreload - This is the glitch where switching weapons auto-reloads your weapon, without actually performing the reload animation.
    • fastmove - This is the glitch that can be achieved by a certain key combinations whilst standing up after crouching, which allows you to move quickly with slow weapons (e.g. deagle).
    • fastfire - This is the glitch that can be achieved by cancelling the full fire animation, allowing you to shoot with slow-fire weapons (e.g. deagle) much faster.

Returns

Returns true if if the glitch was enabled, or false if it is disabled.

Example

This example shows how to create command which changes setGlitchEnabled status.

function antiGlitch ( human )
local adminsGroup = aclGetGroup ( "Admin" )
local playerName = getPlayerName ( human )
        -- check player's admin rights
	if ( isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) ) then
                -- check is quickreaload and fastfire glitches enabled
		if (isGlitchEnabled( "quickreload" ) and isGlitchEnabled( "fastfire" ) == true) then 
                        -- if they are glitches are enabled then we need to disable them
                        setGlitchEnabled ( "quickreload", false )
			setGlitchEnabled ( "fastfire", false )
			outputChatBox ( "Anti-Glitch is turned off!" )
		elseif (isGlitchEnabled( "quickreload" ) and isGlitchEnabled( "fastfire" ) == false) then
			setGlitchEnabled ( "quickreload", true )
			setGlitchEnabled ( "fastfire", true )
			outputChatBox ( "Anti-Glitch is turned on!" )
		end
	else 
		outputChatBox ( "You don't have access to this command", human )
	end
end
addCommandHandler( "antiglitch", antiGlitch )

See Also