GetPlayerACInfo

From Multi Theft Auto: Wiki
Revision as of 20:23, 25 June 2014 by Ccw (talk | contribs)
Jump to navigation Jump to search

This function returns anti-cheat info for a player. It can be used to script a white/blacklist of custom d3d9.dll files, or a white/blacklist of players with certain anti-cheat codes. The relevant anti-cheat code has to be disabled (or not enabled) in the server mtaserver.conf to be of use here.

[[{{{image}}}|link=|]] Note: The info returned by this function can change over time, so it should be called every few seconds rather than just when the player joins. See example.

Syntax

table getPlayerACInfo( element thePlayer )

Required Arguments

  • thePlayer: The player whose anti-cheat info you want to check.

Returns

Returns a table with the following entries:

  • DetectedAC: A string containing a comma separated list 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.
ADDED/UPDATED IN VERSION 1.4 :
  • d3d9SHA256: A string containing the SHA256 of any custom d3d9.dll the player may have installed.

Example

This example checks getPlayerACInfo for changes every 3 seconds

lastDetectedACList = {}

addEventHandler( "onResourceStart", resourceRoot,
    function()
        for _,plr in ipairs( getElementsByType("player") ) do
            lastDetectedACList[plr] = ""
        end
    end
)

addEventHandler( "onPlayerJoin", root,
    function()
        lastDetectedACList[source] = ""
    end
)

addEventHandler( "onPlayerQuit", root,
    function()
        lastDetectedACList[source] = nil
    end
)

function checkPlayersACInfo()
    for plr,lastAC in pairs( lastDetectedACList ) do
        local info = getPlayerACInfo(plr)
        if info.DetectedAC ~= lastAC then
            lastDetectedACList[plr] = info.DetectedAC
            outputServerLog( "AC-INFO: "
                .. " Player:" .. tostring(getPlayerName(plr))
                .. " DetectedAC:" .. tostring(info.DetectedAC)
                .. " d3d9MD5:" .. tostring(info.d3d9MD5)
                .. " d3d9Size:" .. tostring(info.d3d9Size)
                )
        end
    end
end
setTimer( checkPlayersACInfo, 3000, 0 )

Requirements

This template will be deleted.

Example

See Also