GetPlayerACInfo: Difference between revisions
Jump to navigation
Jump to search
(→Syntax: OOP syntax added) |
(Added example) |
||
Line 58: | Line 58: | ||
.. " d3d9Size:" .. tostring(info.d3d9Size) | .. " d3d9Size:" .. tostring(info.d3d9Size) | ||
) | ) | ||
end | |||
end | |||
end | |||
setTimer( checkPlayersACInfo, 3000, 0 ) | |||
</syntaxhighlight> | |||
==Example== | |||
This example allows player serial exceptions for SD #28 (virtual machines) | |||
<syntaxhighlight lang="lua"> | |||
-- List of serials which are allowed to use virtual machines | |||
allowVM = { "0123456789012345601234567890123456" = true, | |||
"A123637892167367281632896790123456" = true, | |||
"E123456789012347839207878392123456" = true } | |||
function checkPlayersACInfo() | |||
for _,plr in ipairs( getElementsByType("player") ) do | |||
local ACInfo = getPlayerACInfo(plr) | |||
if string.find( ACInfo.DetectedAC, "28" ) then | |||
local serial = getPlayerSerial(plr) | |||
if not allowVM[serial] then | |||
kickPlayer( plr, "This server does not allow virtual machines." ) | |||
end | |||
end | end | ||
end | end | ||
Line 66: | Line 88: | ||
==Requirements== | ==Requirements== | ||
{{Requirements|1.3.3|n/a|}} | {{Requirements|1.3.3|n/a|}} | ||
==See Also== | ==See Also== | ||
{{Player_functions}} | {{Player_functions}} |
Revision as of 22:27, 18 November 2015
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.
Syntax
table getPlayerACInfo( element thePlayer )
OOP Syntax Help! I don't understand this!
- Method: player:getACInfo(...)
- Variable: .ACInfo
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.
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 )
Example
This example allows player serial exceptions for SD #28 (virtual machines)
-- List of serials which are allowed to use virtual machines allowVM = { "0123456789012345601234567890123456" = true, "A123637892167367281632896790123456" = true, "E123456789012347839207878392123456" = true } function checkPlayersACInfo() for _,plr in ipairs( getElementsByType("player") ) do local ACInfo = getPlayerACInfo(plr) if string.find( ACInfo.DetectedAC, "28" ) then local serial = getPlayerSerial(plr) if not allowVM[serial] then kickPlayer( plr, "This server does not allow virtual machines." ) end end end end setTimer( checkPlayersACInfo, 3000, 0 )
Requirements
This template will be deleted.
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState