OnPlayerModInfo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
**'''originalSizeX,originalSizeY,originalSizeZ''': The unmodified 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 | **'''length''': Length in bytes of the item | ||
**'''md5''': | **'''md5''': md5 of the item bytes | ||
**'''sha256''': sha256 of the item bytes | **'''sha256''': sha256 of the item bytes | ||
**'''paddedLength''': Length in bytes of the item padded to 2048 byte boundary | **'''paddedLength''': Length in bytes of the item padded to 2048 byte boundary | ||
Line 35: | Line 35: | ||
-- Print details on each modification | -- Print details on each modification | ||
for idx, | 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 | end | ||
end | end | ||
Line 54: | Line 57: | ||
function handleOnPlayerModInfo ( filename, modList ) | function handleOnPlayerModInfo ( filename, modList ) | ||
for _, | for _,item in ipairs(modList) do -- Check each modified item | ||
for _,checkName in ipairs(checkModels) do | for _,checkName in ipairs(checkModels) do | ||
if | if item.name == checkName then -- See if modified item is in our check list | ||
outputChatBox ( "Not allowed to used modified weapons. Please restore " .. filename ) | outputChatBox ( "Not allowed to used modified weapons. Please restore " .. filename ) | ||
end | end |
Revision as of 18:50, 28 October 2014
This event is triggered when a player has modified certain files.
Parameters
string filename, table itemlist
- filename: An 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
Source
The source of this event is the player
Example
This example prints all 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 )
This example checks modified files against a list and prints a warning in the chatbox
checkModels = { "m4.dff", "ak47.dff" } function handleOnPlayerModInfo ( filename, modList ) for _,item in ipairs(modList) do -- Check each modified item for _,checkName in ipairs(checkModels) do if item.name == checkName then -- See if modified item is in our check list outputChatBox ( "Not allowed to used modified weapons. Please restore " .. filename ) end end end end addEventHandler ( "onPlayerModInfo", getRootElement(), handleOnPlayerModInfo )
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled