OnPlayerACInfo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table acCodelist, int d3dSize, string d3dMd5, string d3dSha256
table detectedACList, int d3d9Size, string d3d9MD5, string d3d9SHA256
</syntaxhighlight>  
</syntaxhighlight>  


*'''acCodelist''': A table of tripped AC codes represented as numbers
*'''detectedACList''': A table of [[Anti-cheat_guide|anti-cheat]] codes the player has triggered.
*'''d3dsize''': File size of detected d3d9.dll  
*'''d3d9Size''': A number representing the file size of any custom d3d9.dll the player may have installed.
*'''d3dmd5''': MD5 of detected d3d9.dll  
*'''d3d9MD5''': A string containing the MD5 of any custom d3d9.dll the player may have installed.
*'''d3dsha356''': SHA256 of detected d3d9.dll  
*'''d3d9SHA256''': A string containing the SHA256 of any custom d3d9.dll the player may have installed.


==Source==
==Source==
Line 22: Line 22:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">


function handleOnPlayerACInfo( acCodelist, d3dSize, d3dMd5, d3dSha256 )
function handleOnPlayerACInfo( detectedACList, d3d9Size, d3d9MD5, d3d9SHA256 )
     outputChatBox( "ACInfo for " .. getPlayerName(source)
     outputChatBox( "ACInfo for " .. getPlayerName(source)
                 .. " acCodelist:" .. table.concat(acCodelist,",")
                 .. " detectedACList:" .. table.concat(detectedACList,",")
                 .. " d3dSize:" .. d3dSize
                 .. " d3d9Size:" .. d3d9Size
                 .. " d3dSha256:" .. d3dSha256
                 .. " d3d9SHA256:" .. d3d9SHA256
                 )
                 )
end
end
Line 42: Line 42:
</syntaxhighlight>
</syntaxhighlight>


==Example==
This example allows player serial exceptions for SD #14 (virtual machines)
<syntaxhighlight lang="lua">
-- List of serials which are allowed to use virtual machines
allowVM = { ["0123456789012345601234567890123456"] = true,
            ["A123637892167367281632896790123456"] = true,
            ["E123456789012347839207878392123456"] = true }
function handleOnPlayerACInfo( detectedACList, d3d9Size, d3d9MD5, d3d9SHA256 )
    for _,acCode in ipairs( detectedACList ) do
        if acCode == 14 then
            local serial = getPlayerSerial(source)
            if not allowVM[serial] then
                kickPlayer( source, "This server does not allow virtual machines." )
            end
        end
    end
end
addEventHandler( "onPlayerACInfo", root, handleOnPlayerACInfo )
-- Ensure no one gets missed when the resource is (re)started
addEventHandler( "onResourceStart", resourceRoot,
    function()
        for _,plr in ipairs( getElementsByType("player") ) do
            resendPlayerACInfo( plr )
        end
    end
)
</syntaxhighlight>


{{See also/Server event|Player events}}
{{See also/Server event|Player events}}

Revision as of 21:34, 3 December 2015

This event is triggered when a player trips anti-cheat detections.

[[{{{image}}}|link=|]] Note: Any resource using this event should call resendPlayerACInfo for each player in onResourceStart

Parameters

table detectedACList, int d3d9Size, string d3d9MD5, string d3d9SHA256
  • detectedACList: A table of anti-cheat codes the player has triggered.
  • d3d9Size: A number representing the file size of any custom d3d9.dll the player may have installed.
  • d3d9MD5: A string containing the MD5 of any custom d3d9.dll the player may have installed.
  • d3d9SHA256: A string containing the SHA256 of any custom d3d9.dll the player may have installed.

Source

The source of this event is the player

Example

This example prints all information into the chatbox


function handleOnPlayerACInfo( detectedACList, d3d9Size, d3d9MD5, d3d9SHA256 )
    outputChatBox( "ACInfo for " .. getPlayerName(source)
                .. " detectedACList:" .. table.concat(detectedACList,",")
                .. " d3d9Size:" .. d3d9Size
                .. " d3d9SHA256:" .. d3d9SHA256
                )
end
	
addEventHandler( "onPlayerACInfo", root, handleOnPlayerACInfo )

-- Ensure no one gets missed when the resource is (re)started
addEventHandler( "onResourceStart", resourceRoot,
    function()
        for _,plr in ipairs( getElementsByType("player") ) do
            resendPlayerACInfo( plr )
        end
    end
)

Example

This example allows player serial exceptions for SD #14 (virtual machines)

-- List of serials which are allowed to use virtual machines
allowVM = { ["0123456789012345601234567890123456"] = true,
            ["A123637892167367281632896790123456"] = true,
            ["E123456789012347839207878392123456"] = true }

function handleOnPlayerACInfo( detectedACList, d3d9Size, d3d9MD5, d3d9SHA256 )
    for _,acCode in ipairs( detectedACList ) do
        if acCode == 14 then
            local serial = getPlayerSerial(source)
            if not allowVM[serial] then
                kickPlayer( source, "This server does not allow virtual machines." )
            end
        end
    end
end
addEventHandler( "onPlayerACInfo", root, handleOnPlayerACInfo )

-- Ensure no one gets missed when the resource is (re)started
addEventHandler( "onResourceStart", resourceRoot,
    function()
        for _,plr in ipairs( getElementsByType("player") ) do
            resendPlayerACInfo( plr )
        end
    end
)

See Also

Player events


Event functions