thelindat / linden_outlawalert

Display notifications for any job, with automated checks for shooting, carjacking, speeding, and more.
https://forum.cfx.re/t/esx-outlawalert-wildfire-alerts-and-hypaste-mdt-integration/2067483
MIT License
42 stars 60 forks source link

Custom Alerts #5

Closed Gmzy-1 closed 3 years ago

Gmzy-1 commented 3 years ago

Hi, sorry to bug you again haha.

Seem to be having another issue with custom alerts now.

I'm trying to call it via a script once a ped is alerted to send a custom alert as a test but nothing appears.

Citizen.CreateThread(function(house)
    while true do
    Citizen.Wait(6)
    if GetPlayerCurrentStealthNoise(PlayerId()) > 5 then
    if CanPedHearPlayer(PlayerId(), peds[1]) then
      local data = {displayCode = '211', description = 'Robbery', isImportant = 0, recipientList = {'police'}, length = '10000', infoM = 'fa-info-circle', info = 'Vangelico Jewelry Store'}
      local dispatchData = {dispatchData = data, caller = 'Alarm', coords = vector3(-633.9, -241.7, 38.1)}
      TriggerEvent('wf-alerts:svNotify', dispatchData)
      ClearPedTasks(peds[1])
      Citizen.Wait(5)
      PlayPain(peds[1], 7, 0)
      if HasPedGotWeapon(peds[1], GetHashKey("WEAPON_PISTOL"), false) then
        SetCurrentPedWeapon(peds[1], GetHashKey("WEAPON_PISTOL"), true)
        Citizen.Wait(5)
        TaskShootAtEntity(peds[1], PlayerPedId(), -1, 2685983626)
        Citizen.Wait(7000)
      end
    end
    end
  end
end)

As you can see it's being called once the noise threshold is above 5 but nothing seems to come through, with no errors either.

Thanks

thelindat commented 3 years ago

Need to change TriggerEvent to TriggerServerEvent if calling from client.