Skip to content

Commit

Permalink
feat(resource): added death logs support for redm
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Apr 28, 2023
1 parent 4233c2b commit 3f2530d
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/dev_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
- [x] Resource: refactor `/txAdmin-reauth` to return the full cause in the snackbar
- [x] Resource: reorder `sv_main.lua` and add `local` prefix to most if not all functions
- [x] Resource: rename menu events to `txsv:xxx` and `txcl:xxx`
- [ ] Resource: full redm compatibility
- [x] Resource: full redm compatibility
- [x] Player Mode
- [x] noclip
- [x] controls
Expand Down Expand Up @@ -55,7 +55,7 @@
- [x] Announcements
- [x] reset world area (FIXME: doesn't work, disable button)
- [x] player ids
- [ ] logger (death reasons, explosions, etc)
- [x] logger (death reasons, explosions, etc)

- [x] Actions
- [x] heal
Expand Down Expand Up @@ -92,7 +92,6 @@
- [ ] add hwid token bans
- add an option to wipe all hwids from the database
- must start tracking the search duration
- [ ] update discord.js - should be drop in
- [ ] maybe add some debug logging to `AdminVault.checkAdminsFile()`, to find out why so many people are having issues with their logins


Expand Down Expand Up @@ -662,7 +661,9 @@ https://kinark.github.io/Materialize-stepper/

https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

### RedM stuff
https://github.com/femga/rdr3_discoveries
https://vespura.com/doc/natives/


=======================================
Expand Down
159 changes: 158 additions & 1 deletion resource/cl_logger.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Death reasons
local deathHashTable = {
local fivemDeathHashTable = {
[GetHashKey('WEAPON_ANIMAL')] = 'Animal',
[GetHashKey('WEAPON_COUGAR')] = 'Cougar',
[GetHashKey('WEAPON_ADVANCEDRIFLE')] = 'Advanced Rifle',
Expand Down Expand Up @@ -112,10 +112,167 @@ local deathHashTable = {
[GetHashKey('WEAPON_FALL')] = 'Falling',
}

-- https://github.com/femga/rdr3_discoveries/blob/master/weapons/weapons.lua
local redmDeathHashTable = {
[GetHashKey('WEAPON_MELEE_HATCHET_MELEEONLY')] = 'Melee Hatchet Meleeonly',
[GetHashKey('WEAPON_MELEE_KNIFE_MINER')] = 'Melee Knife Miner',
[GetHashKey('WEAPON_MELEE_KNIFE_JAWBONE')] = 'Melee Knife Jawbone',
[GetHashKey('WEAPON_MELEE_KNIFE_VAMPIRE')] = 'Melee Knife Vampire',
[GetHashKey('WEAPON_MELEE_KNIFE_JOHN')] = 'Melee Knife John',
[GetHashKey('WEAPON_MELEE_MACHETE')] = 'Melee Machete',
[GetHashKey('WEAPON_MELEE_KNIFE_BEAR')] = 'Melee Knife Bear',
[GetHashKey('WEAPON_MELEE_KNIFE_DUTCH')] = 'Melee Knife Dutch',
[GetHashKey('WEAPON_MELEE_KNIFE_KIERAN')] = 'Melee Knife Kieran',
[GetHashKey('WEAPON_MELEE_KNIFE_UNCLE')] = 'Melee Knife Uncle',
[GetHashKey('WEAPON_MELEE_KNIFE_SEAN')] = 'Melee Knife Sean',
[GetHashKey('WEAPON_MELEE_TORCH')] = 'Melee Torch',
[GetHashKey('WEAPON_MELEE_KNIFE_LENNY')] = 'Melee Knife Lenny',
[GetHashKey('WEAPON_MELEE_KNIFE_SADIE')] = 'Melee Knife Sadie',
[GetHashKey('WEAPON_MELEE_KNIFE_CHARLES')] = 'Melee Knife Charles',
[GetHashKey('WEAPON_MELEE_KNIFE_HOSEA')] = 'Melee Knife Hosea',
[GetHashKey('WEAPON_MELEE_TORCH_CROWD')] = 'Melee Torch Crowd',
[GetHashKey('WEAPON_MELEE_KNIFE_BILL')] = 'Melee Knife Bill',
[GetHashKey('WEAPON_MELEE_KNIFE_CIVIL_WAR')] = 'Melee Knife Civil War',
[GetHashKey('WEAPON_MELEE_KNIFE')] = 'Melee Knife',
[GetHashKey('WEAPON_MELEE_KNIFE_MICAH')] = 'Melee Knife Micah',
[GetHashKey('WEAPON_MELEE_BROKEN_SWORD')] = 'Melee Broken Sword',
[GetHashKey('WEAPON_MELEE_KNIFE_JAVIER')] = 'Melee Knife Javier',
[GetHashKey('WEAPON_PISTOL_VOLCANIC')] = 'Pistol Volcanic',
[GetHashKey('WEAPON_PISTOL_MAUSER_DRUNK')] = 'Pistol Mauser Drunk',
[GetHashKey('WEAPON_PISTOL_M1899')] = 'Pistol M1899',
[GetHashKey('WEAPON_PISTOL_SEMIAUTO')] = 'Pistol Semiauto',
[GetHashKey('WEAPON_PISTOL_MAUSER')] = 'Pistol Mauser',
[GetHashKey('WEAPON_REPEATER_EVANS')] = 'Repeater Evans',
[GetHashKey('WEAPON_REPEATER_CARBINE_SADIE')] = 'Repeater Carbine Sadie',
[GetHashKey('WEAPON_REPEATER_HENRY')] = 'Repeater Henry',
[GetHashKey('WEAPON_REPEATER_WINCHESTER')] = 'Repeater Winchester',
[GetHashKey('WEAPON_REPEATER_WINCHESTER_JOHN')] = 'Repeater Winchester John',
[GetHashKey('WEAPON_REPEATER_CARBINE')] = 'Repeater Carbine',
[GetHashKey('WEAPON_REVOLVER_DOUBLEACTION_MICAH_DUALWIELD')] = 'Revolver Doubleaction Micah Dualwield',
[GetHashKey('WEAPON_REVOLVER_DOUBLEACTION_MICAH')] = 'Revolver Doubleaction Micah',
[GetHashKey('WEAPON_REVOLVER_SCHOFIELD_CALLOWAY')] = 'Revolver Schofield Calloway',
[GetHashKey('WEAPON_REVOLVER_DOUBLEACTION')] = 'Revolver Doubleaction',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN')] = 'Revolver Cattleman',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_MEXICAN')] = 'Revolver Cattleman Mexican',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_HOSEA_DUALWIELD')] = 'Revolver Cattleman Hosea Dualwield',
[GetHashKey('WEAPON_REVOLVER_DOUBLEACTION_EXOTIC')] = 'Revolver Doubleaction Exotic',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_SEAN')] = 'Revolver Cattleman Sean',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_SADIE')] = 'Revolver Cattleman Sadie',
[GetHashKey('WEAPON_REVOLVER_DOUBLEACTION_JAVIER')] = 'Revolver Doubleaction Javier',
[GetHashKey('WEAPON_REVOLVER_LEMAT')] = 'Revolver Lemat',
[GetHashKey('WEAPON_REVOLVER_SCHOFIELD_BILL')] = 'Revolver Schofield Bill',
[GetHashKey('WEAPON_REVOLVER_SCHOFIELD')] = 'Revolver Schofield',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_SADIE_DUALWIELD')] = 'Revolver Cattleman Sadie Dualwield',
[GetHashKey('WEAPON_REVOLVER_DOUBLEACTION_GAMBLER')] = 'Revolver Doubleaction Gambler',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_KIERAN')] = 'Revolver Cattleman Kieran',
[GetHashKey('WEAPON_REVOLVER_SCHOFIELD_UNCLE')] = 'Revolver Schofield Uncle',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_HOSEA')] = 'Revolver Cattleman Hosea',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_LENNY')] = 'Revolver Cattleman Lenny',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_JOHN')] = 'Revolver Cattleman John',
[GetHashKey('WEAPON_REVOLVER_SCHOFIELD_DUTCH_DUALWIELD')] = 'Revolver Schofield Dutch Dualwield',
[GetHashKey('WEAPON_REVOLVER_SCHOFIELD_GOLDEN')] = 'Revolver Schofield Golden',
[GetHashKey('WEAPON_REVOLVER_CATTLEMAN_PIG')] = 'Revolver Cattleman Pig',
[GetHashKey('WEAPON_REVOLVER_SCHOFIELD_DUTCH')] = 'Revolver Schofield Dutch',
[GetHashKey('WEAPON_RIFLE_SPRINGFIELD')] = 'Rifle Springfield',
[GetHashKey('WEAPON_RIFLE_BOLTACTION')] = 'Rifle Boltaction',
[GetHashKey('WEAPON_RIFLE_BOLTACTION_BILL')] = 'Rifle Boltaction Bill',
[GetHashKey('WEAPON_RIFLE_VARMINT')] = 'Rifle Varmint',
[GetHashKey('WEAPON_SHOTGUN_SAWEDOFF')] = 'Shotgun Sawedoff',
[GetHashKey('WEAPON_SHOTGUN_DOUBLEBARREL_EXOTIC')] = 'Shotgun Doublebarrel Exotic',
[GetHashKey('WEAPON_SHOTGUN_PUMP')] = 'Shotgun Pump',
[GetHashKey('WEAPON_SHOTGUN_REPEATING')] = 'Shotgun Repeating',
[GetHashKey('WEAPON_SHOTGUN_SEMIAUTO')] = 'Shotgun Semiauto',
[GetHashKey('WEAPON_SHOTGUN_DOUBLEBARREL')] = 'Shotgun Doublebarrel',
[GetHashKey('WEAPON_SHOTGUN_DOUBLEBARREL_UNCLE')] = 'Shotgun Doublebarrel Uncle',
[GetHashKey('WEAPON_SHOTGUN_SAWEDOFF_CHARLES')] = 'Shotgun Sawedoff Charles',
[GetHashKey('WEAPON_SHOTGUN_SEMIAUTO_HOSEA')] = 'Shotgun Semiauto Hosea',
[GetHashKey('WEAPON_SNIPERRIFLE_ROLLINGBLOCK_LENNY')] = 'Sniperrifle Rollingblock Lenny',
[GetHashKey('WEAPON_SNIPERRIFLE_ROLLINGBLOCK_EXOTIC')] = 'Sniperrifle Rollingblock Exotic',
[GetHashKey('WEAPON_SNIPERRIFLE_CARCANO')] = 'Sniperrifle Carcano',
[GetHashKey('WEAPON_SNIPERRIFLE_ROLLINGBLOCK')] = 'Sniperrifle Rollingblock',
[GetHashKey('WEAPON_MELEE_HATCHET')] = 'Melee Hatchet',
[GetHashKey('WEAPON_MELEE_HATCHET_HEWING')] = 'Melee Hatchet Hewing',
[GetHashKey('WEAPON_MELEE_ANCIENT_HATCHET')] = 'Melee Ancient Hatchet',
[GetHashKey('WEAPON_MELEE_HATCHET_HUNTER')] = 'Melee Hatchet Hunter',
[GetHashKey('WEAPON_THROWN_THROWING_KNIVES_JAVIER')] = 'Thrown Throwing Knives Javier',
[GetHashKey('WEAPON_THROWN_MOLOTOV')] = 'Thrown Molotov',
[GetHashKey('WEAPON_MELEE_HATCHET_VIKING')] = 'Melee Hatchet Viking',
[GetHashKey('WEAPON_THROWN_TOMAHAWK_ANCIENT')] = 'Thrown Tomahawk Ancient',
[GetHashKey('WEAPON_MELEE_HATCHET_DOUBLE_BIT_RUSTED')] = 'Melee Hatchet Double Bit Rusted',
[GetHashKey('WEAPON_THROWN_TOMAHAWK')] = 'Thrown Tomahawk',
[GetHashKey('WEAPON_THROWN_DYNAMITE')] = 'Thrown Dynamite',
[GetHashKey('WEAPON_MELEE_HATCHET_DOUBLE_BIT')] = 'Melee Hatchet Double Bit',
[GetHashKey('WEAPON_THROWN_THROWING_KNIVES')] = 'Thrown Throwing Knives',
[GetHashKey('WEAPON_MELEE_HATCHET_HUNTER_RUSTED')] = 'Melee Hatchet Hunter Rusted',
[GetHashKey('WEAPON_MELEE_CLEAVER')] = 'Melee Cleaver',
[GetHashKey('WEAPON_MELEE_LANTERN')] = 'Melee Lantern',
[GetHashKey('WEAPON_MELEE_DAVY_LANTERN')] = 'Melee Davy Lantern',
[GetHashKey('WEAPON_MELEE_LANTERN_ELECTRIC')] = 'Melee Lantern Electric',
[GetHashKey('WEAPON_KIT_BINOCULARS')] = 'Kit Binoculars',
[GetHashKey('WEAPON_KIT_CAMERA')] = 'Kit Camera',
[GetHashKey('WEAPON_KIT_DETECTOR')] = 'Kit Detector',
[GetHashKey('WEAPON_BOW_CHARLES')] = 'Bow Charles',
[GetHashKey('WEAPON_BOW')] = 'Bow',
[GetHashKey('WEAPON_FISHINGROD')] = 'Fishingrod',
[GetHashKey('WEAPON_LASSO')] = 'Lasso',
[GetHashKey('WEAPON_WOLF')] = 'Wolf',
[GetHashKey('WEAPON_WOLF_MEDIUM')] = 'Wolf Medium',
[GetHashKey('WEAPON_WOLF_SMALL')] = 'Wolf Small',
[GetHashKey('WEAPON_ALLIGATOR')] = 'Alligator',
[GetHashKey('WEAPON_ANIMAL')] = 'Animal',
[GetHashKey('WEAPON_BADGER')] = 'Badger',
[GetHashKey('WEAPON_BEAR')] = 'Bear',
[GetHashKey('WEAPON_BEAVER')] = 'Beaver',
[GetHashKey('WEAPON_COUGAR')] = 'Cougar',
[GetHashKey('WEAPON_COYOTE')] = 'Coyote',
[GetHashKey('WEAPON_DEER')] = 'Deer',
[GetHashKey('WEAPON_FOX')] = 'Fox',
[GetHashKey('WEAPON_HORSE')] = 'Horse',
[GetHashKey('WEAPON_MUSKRAT')] = 'Muskrat',
[GetHashKey('WEAPON_RACCOON')] = 'Raccoon',
[GetHashKey('WEAPON_SNAKE')] = 'Snake',
[GetHashKey('WEAPON_FALL')] = 'Fall',
[GetHashKey('WEAPON_FIRE')] = 'Fire',
[GetHashKey('WEAPON_BLEEDING')] = 'Bleeding',
[GetHashKey('WEAPON_DROWNING')] = 'Drowning',
[GetHashKey('WEAPON_DROWNING_IN_VEHICLE')] = 'Drowning In Vehicle',
[GetHashKey('WEAPON_EXPLOSION')] = 'Explosion',
[GetHashKey('WEAPON_RAMMED_BY_CAR')] = 'Rammed By Car',
[GetHashKey('WEAPON_RUN_OVER_BY_CAR')] = 'Run Over By Car',

-- Weapons from game version 1207.80 till 1311.1212
[GetHashKey('WEAPON_KIT_CAMERA_ADVANCED')] = 'Kit Camera Advanced',
[GetHashKey('WEAPON_MELEE_MACHETE_HORROR')] = 'Melee Machete Horror',
[GetHashKey('WEAPON_BOW_IMPROVED')] = 'Bow Improved',
[GetHashKey('WEAPON_RIFLE_ELEPHANT')] = 'Rifle Elephant',
[GetHashKey('WEAPON_REVOLVER_NAVY')] = 'Revolver Navy',
[GetHashKey('WEAPON_LASSO_REINFORCED')] = 'Lasso Reinforced',
[GetHashKey('WEAPON_KIT_BINOCULARS_IMPROVED')] = 'Kit Binoculars Improved',
[GetHashKey('WEAPON_MELEE_KNIFE_TRADER')] = 'Melee Knife Trader',
[GetHashKey('WEAPON_MELEE_MACHETE_COLLECTOR')] = 'Melee Machete Collector',
[GetHashKey('WEAPON_MOONSHINEJUG_MP')] = 'Moonshinejug Mp',
[GetHashKey('WEAPON_THROWN_BOLAS')] = 'Thrown Bolas',
[GetHashKey('WEAPON_THROWN_POISONBOTTLE')] = 'Thrown Poisonbottle',

-- Weapons from game version 1311.12 till 1355.18
[GetHashKey('WEAPON_KIT_METAL_DETECTOR')] = 'Kit Metal Detector',
[GetHashKey('WEAPON_REVOLVER_NAVY_CROSSOVER')] = 'Revolver Navy Crossover',
[GetHashKey('WEAPON_THROWN_BOLAS_HAWKMOTH')] = 'Thrown Bolas Hawkmoth',
[GetHashKey('WEAPON_THROWN_BOLAS_IRONSPIKED')] = 'Thrown Bolas Ironspiked',
[GetHashKey('WEAPON_THROWN_BOLAS_INTERTWINED')] = 'Thrown Bolas Intertwined',

-- Weapons from game version 1355.18 till 1436.26
[GetHashKey('WEAPON_MELEE_KNIFE_HORROR')] = 'Melee Knife Horror',
[GetHashKey('WEAPON_MELEE_KNIFE_RUSTIC')] = 'Melee Knife Rustic',
[GetHashKey('WEAPON_MELEE_LANTERN_HALLOWEEN')] = 'Melee Lantern Halloween',
}
local deathHashTable = IS_FIVEM and fivemDeathHashTable or redmDeathHashTable

local function processDeath(ped)
local killerPed = GetPedSourceOfDeath(ped)
local causeHash = GetPedCauseOfDeath(ped)
local killer = false
debugPrint(("Death cause: %s / 0x%x"):format(causeHash, causeHash))

if killerPed == ped then
killer = false
Expand Down

0 comments on commit 3f2530d

Please sign in to comment.