I am using onPlayerKilled baseevent and for killerID I always get returned -1 even though I am killing a ped with a gun.
For a good bug report you should probably include:
- Client (production/canary) and FXServer version
4162 - What you expected to happen
Get killerID - What actually happens
I always get returned -1 - Category of bug (eg. client, server, weapons, peds, native)
server, baseevent - Reproducible steps, preferably with example script(s)
Server
RegisterNetEvent('playerConnecting')
RegisterNetEvent('playerConnecting', function()
TriggerClientEvent('showNotification', -1, '~g~' .. GetPlayerName(source) .. '~w~ joined.')
end)
RegisterNetEvent('playerDropped')
AddEventHandler('playerDropped', function()
TriggerClientEvent('showNotification', -1, '~r~' .. GetPlayerName(source) .. '~w~ left.')
end)
RegisterNetEvent('baseevents:onPlayerDied')
AddEventHandler('baseevents:onPlayerDied', function(playerId)
TriggerClientEvent('showNotification', -1, '~o~' .. GetPlayerName(source) .. '~w~ died.')
end)
RegisterNetEvent('baseevents:onPlayerKilled')
AddEventHandler('baseevents:onPlayerKilled', function(killedBy)
print(killedBy)
print(GetPlayerName(source))
TriggerClientEvent('showNotification', -1, '~o~' .. killedBy .. '~w~ killed ~o~' .. GetPlayerName(source))
end)
Client
RegisterNetEvent('showNotification')
AddEventHandler('showNotification', function(notify)
notification(notify)
end)
function notification(string)
SetNotificationTextEntry("STRING")
AddTextComponentString(string)
DrawNotification(true, false)
end```