Skip to content

Instantly share code, notes, and snippets.

@DemmyDemon
Created September 19, 2018 12:06
Show Gist options
  • Save DemmyDemon/464ee50fdfef37ea2b5f57d983a865e7 to your computer and use it in GitHub Desktop.
Save DemmyDemon/464ee50fdfef37ea2b5f57d983a865e7 to your computer and use it in GitHub Desktop.
local known = {
CEventNetworkEntityDamage = {[1] = 'target entity',[2] = 'source entity',[4] = 'fatal damage', [5] = 'weapon used'},
CEventNetworkVehicleUndrivable = {},
}
AddEventHandler('gameEventTriggered',function(name,args)
local me = PlayerId()
local myPed = PlayerPedId()
local myVehicle = GetVehiclePedIsIn(myPed)
if known[name] then
local components = {}
local unknown = {}
for i,value in ipairs(args) do
if known[name][i] then
table.insert(components,string.format('%s: %s',known[name][i],value))
else
table.insert(components,string.format('(unknown %i): %s',i,value))
table.insert(unknown,i..'='..value)
end
end
print(name..': '..table.concat(components,", "))
for i,unk in pairs(unknown) do
TriggerEvent('chat:addMessage',{color={255,0,255},args = {name,unk}})
end
--[[
if DoesEntityExist(args[1]) then
if IsEntityAPed(args[1]) then
print('arg1 is a ped')
end
end
if DoesEntityExist(args[2]) then
if IsEntityAPed(args[2]) then
if args[2] == myPed then
print('arg2 is a ped (mine)')
else
print('arg2 is a ped')
end
end
end
if GetCurrentPedWeapon(myPed,args[5]) then
print('arg5 is my weapon')
end
if args[1] == myVehicle then
print('Vehicle!')
end
if args[2] == myPed then
print('arg2 is my ped!')
elseif args[2] == me then
print('arg2 is my player ID')
end
--]]
else
TriggerEvent('chat:addMessage',{args = {'Event',name..' '..table.concat(args, ", ")}})
end
end)
Citizen.CreateThread(function()
while true do
local events = GetNumberOfEvents(1)
if events > 0 then
SetTextEntry('STRING')
AddTextComponentString('Events: '..events)
SetTextOutline()
DrawText(0.5,0.5)
end
Citizen.Wait(0)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment