Good Afternoon, I’m trying to find out how i would fetch Damage Locations.
This is the code i have now, which doesn’t work. i Haven’t found any native directly to fetch the damage location.
Any ideas/Help would be appreciated, im sure this would be helpful to keep track of whos hitting what DamagePosition and how frequent they are.
Lets say a player ends up only hitting headshots, it would be very helpful for the Admins to check the player out.
AddEventHandler('weaponDamageEvent', function(sender, ev)
local user_id = VESPER.getUserId(sender)
local name = GetPlayerName(sender)
if ev.weaponDamage ~= 0 then
if ev.weaponType == 3218215474 or (ev.weaponType == 911657153 and not VESPER.hasPermission(user_id, 'police.onduty.permission')) then
TriggerEvent("VESPER:acBan", user_id, 8, name, sender, ev.weaponType)
end
local hitLocation = ev.hitLocation
local hitLocationText = ""
if hitLocation == 0x796E then
hitLocationText = "Headshot"
elseif hitLocation == 0x0 then
hitLocationText = "Bodyshot"
elseif hitLocation == 0xBB0 or hitLocation == 0x58B7 then
hitLocationText = "Arms"
elseif hitLocation == 0x3FCF or hitLocation == 0xB3FE then
hitLocationText = "Legs"
end
local embed = {
{
["color"] = "14423100",
["title"] = "Damage Logs",
["description"] = "",
["text"] = "VESPER Server #1",
["fields"] = {
{
["name"] = "Player Name",
["value"] = name,
["inline"] = true
},
{
["name"] = "Player Temp ID",
["value"] = sender,
["inline"] = true
},
{
["name"] = "Player Perm ID",
["value"] = user_id,
["inline"] = true
},
{
["name"] = "Damage",
["value"] = ev.weaponDamage,
["inline"] = true
},
{
["name"] = "Hit Location",
["value"] = hitLocationText,
["inline"] = true
},
{
["name"] = "Weapon Hash",
["value"] = ev.weaponType,
["inline"] = true
},
}
}
}
PerformHttpRequest(damagelogs, function(err, text, headers) end, 'POST', json.encode({username = "VESPER", embeds = embed}), { ['Content-Type'] = 'application/json' })
end
end)