mirror of
https://github.com/ENoir420/FIveM_Discord_Log.git
synced 2026-03-31 06:33:58 -04:00
376 lines
14 KiB
Lua
376 lines
14 KiB
Lua
WeaponNames = {
|
|
[tostring(GetHashKey('WEAPON_UNARMED'))] = 'Unarmed',
|
|
[tostring(GetHashKey('GADGET_PARACHUTE'))] = 'Parachute',
|
|
[tostring(GetHashKey('WEAPON_KNIFE'))] = 'Knife',
|
|
[tostring(GetHashKey('WEAPON_NIGHTSTICK'))] = 'Nightstick',
|
|
[tostring(GetHashKey('WEAPON_HAMMER'))] = 'Hammer',
|
|
[tostring(GetHashKey('WEAPON_BAT'))] = 'Baseball Bat',
|
|
[tostring(GetHashKey('WEAPON_CROWBAR'))] = 'Crowbar',
|
|
[tostring(GetHashKey('WEAPON_GOLFCLUB'))] = 'Golf Club',
|
|
[tostring(GetHashKey('WEAPON_BOTTLE'))] = 'Bottle',
|
|
[tostring(GetHashKey('WEAPON_DAGGER'))] = 'Antique Cavalry Dagger',
|
|
[tostring(GetHashKey('WEAPON_HATCHET'))] = 'Hatchet',
|
|
[tostring(GetHashKey('WEAPON_KNUCKLE'))] = 'Knuckle Duster',
|
|
[tostring(GetHashKey('WEAPON_MACHETE'))] = 'Machete',
|
|
[tostring(GetHashKey('WEAPON_FLASHLIGHT'))] = 'Flashlight',
|
|
[tostring(GetHashKey('WEAPON_SWITCHBLADE'))] = 'Switchblade',
|
|
[tostring(GetHashKey('WEAPON_BATTLEAXE'))] = 'Battleaxe',
|
|
[tostring(GetHashKey('WEAPON_POOLCUE'))] = 'Poolcue',
|
|
[tostring(GetHashKey('WEAPON_PIPEWRENCH'))] = 'Wrench',
|
|
[tostring(GetHashKey('WEAPON_STONE_HATCHET'))] = 'Stone Hatchet',
|
|
|
|
[tostring(GetHashKey('WEAPON_PISTOL'))] = 'Pistol',
|
|
[tostring(GetHashKey('WEAPON_PISTOL_MK2'))] = 'Pistol Mk2',
|
|
[tostring(GetHashKey('WEAPON_COMBATPISTOL'))] = 'Combat Pistol',
|
|
[tostring(GetHashKey('WEAPON_PISTOL50'))] = 'Pistol .50 ',
|
|
[tostring(GetHashKey('WEAPON_SNSPISTOL'))] = 'SNS Pistol',
|
|
[tostring(GetHashKey('WEAPON_SNSPISTOL_MK2'))] = 'SNS Pistol Mk2',
|
|
[tostring(GetHashKey('WEAPON_HEAVYPISTOL'))] = 'Heavy Pistol',
|
|
[tostring(GetHashKey('WEAPON_VINTAGEPISTOL'))] = 'Vintage Pistol',
|
|
[tostring(GetHashKey('WEAPON_MARKSMANPISTOL'))] = 'Marksman Pistol',
|
|
[tostring(GetHashKey('WEAPON_REVOLVER'))] = 'Heavy Revolver',
|
|
[tostring(GetHashKey('WEAPON_REVOLVER_MK2'))] = 'Heavy Revolver Mk2',
|
|
[tostring(GetHashKey('WEAPON_DOUBLEACTION'))] = 'Double-Action Revolver',
|
|
[tostring(GetHashKey('WEAPON_APPISTOL'))] = 'AP Pistol',
|
|
[tostring(GetHashKey('WEAPON_STUNGUN'))] = 'Stun Gun',
|
|
[tostring(GetHashKey('WEAPON_FLAREGUN'))] = 'Flare Gun',
|
|
[tostring(GetHashKey('WEAPON_RAYPISTOL'))] = 'Up-n-Atomizer',
|
|
|
|
[tostring(GetHashKey('WEAPON_MICROSMG'))] = 'Micro SMG',
|
|
[tostring(GetHashKey('WEAPON_MACHINEPISTOL'))] = 'Machine Pistol',
|
|
[tostring(GetHashKey('WEAPON_MINISMG'))] = 'Mini SMG',
|
|
[tostring(GetHashKey('WEAPON_SMG'))] = 'SMG',
|
|
[tostring(GetHashKey('WEAPON_SMG_MK2'))] = 'SMG Mk2 ',
|
|
[tostring(GetHashKey('WEAPON_ASSAULTSMG'))] = 'Assault SMG',
|
|
[tostring(GetHashKey('WEAPON_COMBATPDW'))] = 'Combat PDW',
|
|
[tostring(GetHashKey('WEAPON_MG'))] = 'MG',
|
|
[tostring(GetHashKey('WEAPON_COMBATMG'))] = 'Combat MG ',
|
|
[tostring(GetHashKey('WEAPON_COMBATMG_MK2'))] = 'Combat MG Mk2',
|
|
[tostring(GetHashKey('WEAPON_GUSENBERG'))] = 'Gusenberg Sweeper',
|
|
[tostring(GetHashKey('WEAPON_RAYCARBINE'))] = 'Unholy Deathbringer',
|
|
|
|
[tostring(GetHashKey('WEAPON_ASSAULTRIFLE'))] = 'Assault Rifle',
|
|
[tostring(GetHashKey('WEAPON_ASSAULTRIFLE_MK2'))] = 'Assault Rifle Mk2',
|
|
[tostring(GetHashKey('WEAPON_CARBINERIFLE'))] = 'Carbine Rifle',
|
|
[tostring(GetHashKey('WEAPON_CARBINERIFLE_MK2'))] = 'Carbine Rifle Mk2',
|
|
[tostring(GetHashKey('WEAPON_ADVANCEDRIFLE'))] = 'Advanced Rifle',
|
|
[tostring(GetHashKey('WEAPON_SPECIALCARBINE'))] = 'Special Carbine',
|
|
[tostring(GetHashKey('WEAPON_SPECIALCARBINE_MK2'))] = 'Special Carbine Mk2',
|
|
[tostring(GetHashKey('WEAPON_BULLPUPRIFLE'))] = 'Bullpup Rifle',
|
|
[tostring(GetHashKey('WEAPON_BULLPUPRIFLE_MK2'))] = 'Bullpup Rifle Mk2',
|
|
[tostring(GetHashKey('WEAPON_COMPACTRIFLE'))] = 'Compact Rifle',
|
|
|
|
[tostring(GetHashKey('WEAPON_SNIPERRIFLE'))] = 'Sniper Rifle',
|
|
[tostring(GetHashKey('WEAPON_HEAVYSNIPER'))] = 'Heavy Sniper',
|
|
[tostring(GetHashKey('WEAPON_HEAVYSNIPER_MK2'))] = 'Heavy Sniper Mk2',
|
|
[tostring(GetHashKey('WEAPON_MARKSMANRIFLE'))] = 'Marksman Rifle',
|
|
[tostring(GetHashKey('WEAPON_MARKSMANRIFLE_MK2'))] = 'Marksman Rifle Mk2',
|
|
|
|
[tostring(GetHashKey('WEAPON_GRENADE'))] = 'Grenade',
|
|
[tostring(GetHashKey('WEAPON_STICKYBOMB'))] = 'Sticky Bomb',
|
|
[tostring(GetHashKey('WEAPON_PROXMINE'))] = 'Proximity Mine',
|
|
[tostring(GetHashKey('WAPAON_PIPEBOMB'))] = 'Pipe Bomb',
|
|
[tostring(GetHashKey('WEAPON_SMOKEGRENADE'))] = 'Tear Gas',
|
|
[tostring(GetHashKey('WEAPON_BZGAS'))] = 'BZ Gas',
|
|
[tostring(GetHashKey('WEAPON_MOLOTOV'))] = 'Molotov',
|
|
[tostring(GetHashKey('WEAPON_FIREEXTINGUISHER'))] = 'Fire Extinguisher',
|
|
[tostring(GetHashKey('WEAPON_PETROLCAN'))] = 'Jerry Can',
|
|
[tostring(GetHashKey('WEAPON_BALL'))] = 'Ball',
|
|
[tostring(GetHashKey('WEAPON_SNOWBALL'))] = 'Snowball',
|
|
[tostring(GetHashKey('WEAPON_FLARE'))] = 'Flare',
|
|
|
|
[tostring(GetHashKey('WEAPON_GRENADELAUNCHER'))] = 'Grenade Launcher',
|
|
[tostring(GetHashKey('WEAPON_RPG'))] = 'RPG',
|
|
[tostring(GetHashKey('WEAPON_MINIGUN'))] = 'Minigun',
|
|
[tostring(GetHashKey('WEAPON_FIREWORK'))] = 'Firework Launcher',
|
|
[tostring(GetHashKey('WEAPON_RAILGUN'))] = 'Railgun',
|
|
[tostring(GetHashKey('WEAPON_HOMINGLAUNCHER'))] = 'Homing Launcher',
|
|
[tostring(GetHashKey('WEAPON_COMPACTLAUNCHER'))] = 'Compact Grenade Launcher',
|
|
[tostring(GetHashKey('WEAPON_RAYMINIGUN'))] = 'Widowmaker',
|
|
|
|
[tostring(GetHashKey('WEAPON_PUMPSHOTGUN'))] = 'Pump Shotgun',
|
|
[tostring(GetHashKey('WEAPON_PUMPSHOTGUN_MK2'))] = 'Pump Shotgun Mk2',
|
|
[tostring(GetHashKey('WEAPON_SAWNOFFSHOTGUN'))] = 'Sawed-off Shotgun',
|
|
[tostring(GetHashKey('WEAPON_BULLPUPSHOTGUN'))] = 'Bullpup Shotgun',
|
|
[tostring(GetHashKey('WEAPON_ASSAULTSHOTGUN'))] = 'Assault Shotgun',
|
|
[tostring(GetHashKey('WEAPON_MUSKET'))] = 'Musket',
|
|
[tostring(GetHashKey('WEAPON_HEAVYSHOTGUN'))] = 'Heavy Shotgun',
|
|
[tostring(GetHashKey('WEAPON_DBSHOTGUN'))] = 'Double Barrel Shotgun',
|
|
[tostring(GetHashKey('WEAPON_SWEEPERSHOTGUN'))] = 'Sweeper Shotgun',
|
|
|
|
[tostring(GetHashKey('WEAPON_REMOTESNIPER'))] = 'Remote Sniper',
|
|
[tostring(GetHashKey('WEAPON_GRENADELAUNCHER_SMOKE'))] = 'Smoke Grenade Launcher',
|
|
[tostring(GetHashKey('WEAPON_PASSENGER_ROCKET'))] = 'Passenger Rocket',
|
|
[tostring(GetHashKey('WEAPON_AIRSTRIKE_ROCKET'))] = 'Airstrike Rocket',
|
|
[tostring(GetHashKey('WEAPON_STINGER'))] = 'Stinger [Vehicle]',
|
|
[tostring(GetHashKey('OBJECT'))] = 'Object',
|
|
[tostring(GetHashKey('VEHICLE_WEAPON_TANK'))] = 'Tank Cannon',
|
|
[tostring(GetHashKey('VEHICLE_WEAPON_SPACE_ROCKET'))] = 'Rockets',
|
|
[tostring(GetHashKey('VEHICLE_WEAPON_PLAYER_LASER'))] = 'Laser',
|
|
[tostring(GetHashKey('AMMO_RPG'))] = 'Rocket',
|
|
[tostring(GetHashKey('AMMO_TANK'))] = 'Tank',
|
|
[tostring(GetHashKey('AMMO_SPACE_ROCKET'))] = 'Rocket',
|
|
[tostring(GetHashKey('AMMO_PLAYER_LASER'))] = 'Laser',
|
|
[tostring(GetHashKey('AMMO_ENEMY_LASER'))] = 'Laser',
|
|
[tostring(GetHashKey('WEAPON_RAMMED_BY_CAR'))] = 'Rammed by Car',
|
|
[tostring(GetHashKey('WEAPON_FIRE'))] = 'Fire',
|
|
[tostring(GetHashKey('WEAPON_HELI_CRASH'))] = 'Heli Crash',
|
|
[tostring(GetHashKey('WEAPON_RUN_OVER_BY_CAR'))] = 'Run over by Car',
|
|
[tostring(GetHashKey('WEAPON_HIT_BY_WATER_CANNON'))] = 'Hit by Water Cannon',
|
|
[tostring(GetHashKey('WEAPON_EXHAUSTION'))] = 'Exhaustion',
|
|
[tostring(GetHashKey('WEAPON_EXPLOSION'))] = 'Explosion',
|
|
[tostring(GetHashKey('WEAPON_ELECTRIC_FENCE'))] = 'Electric Fence',
|
|
[tostring(GetHashKey('WEAPON_BLEEDING'))] = 'Bleeding',
|
|
[tostring(GetHashKey('WEAPON_DROWNING_IN_VEHICLE'))] = 'Drowning in Vehicle',
|
|
[tostring(GetHashKey('WEAPON_DROWNING'))] = 'Drowning',
|
|
[tostring(GetHashKey('WEAPON_BARBED_WIRE'))] = 'Barbed Wire',
|
|
[tostring(GetHashKey('WEAPON_VEHICLE_ROCKET'))] = 'Vehicle Rocket',
|
|
[tostring(GetHashKey('VEHICLE_WEAPON_ROTORS'))] = 'Rotors',
|
|
[tostring(GetHashKey('WEAPON_AIR_DEFENCE_GUN'))] = 'Air Defence Gun',
|
|
[tostring(GetHashKey('WEAPON_ANIMAL'))] = 'Animal',
|
|
[tostring(GetHashKey('WEAPON_COUGAR'))] = 'Cougar'
|
|
}
|
|
|
|
|
|
Citizen.CreateThread(function()
|
|
local DeathReason, Killer, DeathCauseHash, Weapon
|
|
|
|
while true do
|
|
Citizen.Wait(0)
|
|
if IsEntityDead(GetPlayerPed(PlayerId())) then
|
|
Citizen.Wait(0)
|
|
local PedKiller = GetPedSourceOfDeath(GetPlayerPed(PlayerId()))
|
|
local killername = GetPlayerName(PedKiller)
|
|
DeathCauseHash = GetPedCauseOfDeath(GetPlayerPed(PlayerId()))
|
|
Weapon = WeaponNames[tostring(DeathCauseHash)]
|
|
|
|
if IsEntityAPed(PedKiller) and IsPedAPlayer(PedKiller) then
|
|
Killer = NetworkGetPlayerIndexFromPed(PedKiller)
|
|
elseif IsEntityAVehicle(PedKiller) and IsEntityAPed(GetPedInVehicleSeat(PedKiller, -1)) and IsPedAPlayer(GetPedInVehicleSeat(PedKiller, -1)) then
|
|
Killer = NetworkGetPlayerIndexFromPed(GetPedInVehicleSeat(PedKiller, -1))
|
|
end
|
|
|
|
if (Killer == PlayerId()) then
|
|
DeathReason = 'committed suicide'
|
|
elseif (Killer == nil) then
|
|
DeathReason = 'died'
|
|
else
|
|
if IsMelee(DeathCauseHash) then
|
|
DeathReason = 'murdered'
|
|
elseif IsTorch(DeathCauseHash) then
|
|
DeathReason = 'torched'
|
|
elseif IsKnife(DeathCauseHash) then
|
|
DeathReason = 'knifed'
|
|
elseif IsPistol(DeathCauseHash) then
|
|
DeathReason = 'pistoled'
|
|
elseif IsSub(DeathCauseHash) then
|
|
DeathReason = 'riddled'
|
|
elseif IsRifle(DeathCauseHash) then
|
|
DeathReason = 'rifled'
|
|
elseif IsLight(DeathCauseHash) then
|
|
DeathReason = 'machine gunned'
|
|
elseif IsShotgun(DeathCauseHash) then
|
|
DeathReason = 'pulverized'
|
|
elseif IsSniper(DeathCauseHash) then
|
|
DeathReason = 'sniped'
|
|
elseif IsHeavy(DeathCauseHash) then
|
|
DeathReason = 'obliterated'
|
|
elseif IsMinigun(DeathCauseHash) then
|
|
DeathReason = 'shredded'
|
|
elseif IsBomb(DeathCauseHash) then
|
|
DeathReason = 'bombed'
|
|
elseif IsVeh(DeathCauseHash) then
|
|
DeathReason = 'mowed over'
|
|
elseif IsVK(DeathCauseHash) then
|
|
DeathReason = 'flattened'
|
|
else
|
|
DeathReason = 'killed'
|
|
end
|
|
end
|
|
|
|
if DeathReason == 'committed suicide' or DeathReason == 'died' then
|
|
TriggerServerEvent('playerDied',1,GetPlayerServerId(PlayerId()),0,DeathReason,Weapon)
|
|
else
|
|
TriggerServerEvent('playerDied',2,GetPlayerServerId(PlayerId()),GetPlayerServerId(Killer),DeathReason,Weapon)
|
|
end
|
|
Killer = nil
|
|
DeathReason = nil
|
|
DeathCauseHash = nil
|
|
Weapon = nil
|
|
end
|
|
while IsEntityDead(PlayerPedId()) do
|
|
Citizen.Wait(0)
|
|
end
|
|
end
|
|
end)
|
|
|
|
Citizen.CreateThread(function()
|
|
|
|
while true do
|
|
Citizen.Wait(0)
|
|
local playerped = GetPlayerPed(-1)
|
|
|
|
if IsPedShooting(playerped) then
|
|
TriggerServerEvent('playerShotWeapon', WeaponNames[tostring(GetSelectedPedWeapon(playerped))])
|
|
Citizen.Wait(5000)
|
|
end
|
|
end
|
|
|
|
end)
|
|
|
|
function hashToWeapon(hash)
|
|
return weapons[hash]
|
|
end
|
|
|
|
exports('discord', function(message, id, id2, color, channel)
|
|
TriggerServerEvent('ClientDiscord', message, id, id2, color, channel)
|
|
end)
|
|
|
|
function IsMelee(Weapon)
|
|
local Weapons = {'WEAPON_UNARMED', 'WEAPON_CROWBAR', 'WEAPON_BAT', 'WEAPON_GOLFCLUB', 'WEAPON_HAMMER', 'WEAPON_NIGHTSTICK'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsTorch(Weapon)
|
|
local Weapons = {'WEAPON_MOLOTOV'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsKnife(Weapon)
|
|
local Weapons = {'WEAPON_DAGGER', 'WEAPON_KNIFE', 'WEAPON_SWITCHBLADE', 'WEAPON_HATCHET', 'WEAPON_BOTTLE'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsPistol(Weapon)
|
|
local Weapons = {'WEAPON_SNSPISTOL', 'WEAPON_HEAVYPISTOL', 'WEAPON_VINTAGEPISTOL', 'WEAPON_PISTOL', 'WEAPON_APPISTOL', 'WEAPON_COMBATPISTOL'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsSub(Weapon)
|
|
local Weapons = {'WEAPON_MICROSMG', 'WEAPON_SMG'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsRifle(Weapon)
|
|
local Weapons = {'WEAPON_CARBINERIFLE', 'WEAPON_MUSKET', 'WEAPON_ADVANCEDRIFLE', 'WEAPON_ASSAULTRIFLE', 'WEAPON_SPECIALCARBINE', 'WEAPON_COMPACTRIFLE', 'WEAPON_BULLPUPRIFLE'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsLight(Weapon)
|
|
local Weapons = {'WEAPON_MG', 'WEAPON_COMBATMG'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsShotgun(Weapon)
|
|
local Weapons = {'WEAPON_BULLPUPSHOTGUN', 'WEAPON_ASSAULTSHOTGUN', 'WEAPON_DBSHOTGUN', 'WEAPON_PUMPSHOTGUN', 'WEAPON_HEAVYSHOTGUN', 'WEAPON_SAWNOFFSHOTGUN'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsSniper(Weapon)
|
|
local Weapons = {'WEAPON_MARKSMANRIFLE', 'WEAPON_SNIPERRIFLE', 'WEAPON_HEAVYSNIPER', 'WEAPON_ASSAULTSNIPER', 'WEAPON_REMOTESNIPER'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsHeavy(Weapon)
|
|
local Weapons = {'WEAPON_GRENADELAUNCHER', 'WEAPON_RPG', 'WEAPON_FLAREGUN', 'WEAPON_HOMINGLAUNCHER', 'WEAPON_FIREWORK', 'VEHICLE_WEAPON_TANK'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsMinigun(Weapon)
|
|
local Weapons = {'WEAPON_MINIGUN'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsBomb(Weapon)
|
|
local Weapons = {'WEAPON_GRENADE', 'WEAPON_PROXMINE', 'WEAPON_EXPLOSION', 'WEAPON_STICKYBOMB'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsVeh(Weapon)
|
|
local Weapons = {'VEHICLE_WEAPON_ROTORS'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function IsVK(Weapon)
|
|
local Weapons = {'WEAPON_RUN_OVER_BY_CAR', 'WEAPON_RAMMED_BY_CAR'}
|
|
for i, CurrentWeapon in ipairs(Weapons) do
|
|
if GetHashKey(CurrentWeapon) == Weapon then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
|
|
|
|
function ShowDebug(text)
|
|
SetNotificationTextEntry("STRING")
|
|
AddTextComponentSubstringPlayerName("~bENoir_logs Debug:~s~\n"..text)
|
|
DrawNotification(true, true)
|
|
end
|