onPlayerModInfo | Multi Theft Auto: Wiki Skip to content

onPlayerModInfo

Client-side
Server-side
Shared

This event is triggered when a player has modified certain files.

Any resource using this event should call resendPlayerModInfo for each player in onResourceStart .

Parameters

string filename, table itemlist
  • filename: a string with the filename of the modified file.
  • itemlist: a table with the details of each modification within the file. Possible keys for each sub-table are: id: GTA model or texture id. name: GTA name. sizeX, sizeY, sizeZ: the modified model size (if the item is a DFF). originalSizeX, originalSizeY, originalSizeZ: the unmodified model size (if the item is a DFF). length: length in bytes of the item. md5: md5 of the item bytes. sha256: sha256 of the item bytes. paddedLength: length in bytes of the item padded to 2048 byte boundary. paddedMd5: md5 of the item bytes padded to 2048 byte boundary. paddedSha256: sha256 of the item bytes padded to 2048 byte boundary.

Source

element: The source of this event is the player.

Code Examples

server

This example prints all modification information into the chatbox.

function handleOnPlayerModInfo ( filename, modList )
-- Print player name and file name
outputChatBox( getPlayerName(source) .. " " .. filename )
-- Print details on each modification
for idx,item in ipairs(modList) do
outputChatBox( idx .. ") id:" .. item.id .. " name:" .. item.name )
if item.sizeX then
outputChatBox( "size:" .. item.sizeX .. "," .. item.sizeY .. "," .. item.sizeZ )
outputChatBox( "originalSize:" .. item.originalSizeX .. "," .. item.originalSizeY .. "," .. item.originalSizeZ )
end
if item.length then
outputChatBox( "length:" .. item.length .. " md5:" .. item.md5 )
end
end
end
addEventHandler ( "onPlayerModInfo", getRootElement(), handleOnPlayerModInfo )
-- Ensure no one gets missed when the resource is (re)started
addEventHandler( "onResourceStart", resourceRoot,
function()
for _,plr in ipairs( getElementsByType("player") ) do
resendPlayerModInfo( plr )
end
end
)

See Also