[Release] Simple outlaw alert (11-04-2017)

this script has great potential hopefully he gets back working on it :slight_smile:

1 Like

great script, what did you use to see street name ? I’m using StreetDisplay but i’ve nothing on the map, there is an other better script?

My current edits, added some skins, increased the time the message stays up, and fixed the fight alert to be a called timer. Still tweaking

client.lua

--Config
local timer = 1 --in minutes - Set the time during the player is outlaw
local showOutlaw = true --Set if show outlaw act on map
local gunshotAlert = true --Set if show alert when player use gun
local carJackingAlert = true --Set if show when player do carjacking
local fightAlert = true --Set if show when player fight in melee
local meleeAlert = true --Set if show when player fight in melee
local blipGunTime = 15 --in second
local blipMeleeTime = 15 --in second
local blipJackingTime = 15 -- in second
--End config

local origin = false --Don't touche it
local timing = timer * 60000 --Don't touche it

local PedModels = {
        "s_m_y_cop_01",
        's_m_m_snowcop_01',
        's_m_y_hwaycop_01',
        's_f_y_cop_01',
        's_m_y_sheriff_01',
        's_f_y_sheriff_01',
        's_m_y_ranger_01',
        's_m_m_armoured_01',
        's_m_m_armoured_02',
        's_f_y_ranger_01',
        's_m_m_ciasec_01',
        'u_m_m_fibarchitect',
        's_m_y_swat_01',
		's_m_y_blackops_01',
		's_m_y_blackops_02',
		's_m_y_blackops_03',
		's_m_y_hwaycop_01',
		'u_m_m_doa_01',
		'ig_karen_daniels',
		'cs_karen_daniels'
		}
GetPlayerName()
RegisterNetEvent('outlawNotify')
AddEventHandler('outlawNotify', function(alert)
    for i = 0, #PedModels do
        if not origin and IsPedModel(GetPlayerPed(-1),GetHashKey(PedModels[i])) then
            Notify(alert)
        end
    end
end)

function Notify(text)
    SetNotificationTextEntry('STRING')
    AddTextComponentString(text)
    DrawNotification(false, false)
end

Citizen.CreateThread(function()
    while true do
        Wait(0)
        if NetworkIsSessionStarted() then
            DecorRegister("IsOutlaw",  3)
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 1)
            return
        end
    end
end)

RegisterNetEvent('thiefPlace')
AddEventHandler('thiefPlace', function(tx, ty, tz)
    for i = 0, #PedModels do
        if not origin and IsPedModel(GetPlayerPed(-1),GetHashKey(PedModels[i])) then
            if carJackingAlert then
                local transT = 250
                local thiefBlip = AddBlipForCoord(tx, ty, tz)
                SetBlipSprite(thiefBlip,  1)
                SetBlipColour(thiefBlip,  1)
                SetBlipAlpha(thiefBlip,  transT)
                SetBlipAsShortRange(thiefBlip,  1)
                while transT ~= 0 do
                    Wait(blipJackingTime * 4)
                    transT = transT - 1
                    SetBlipAlpha(thiefBlip,  transT)
                    if transT == 0 then
                        SetBlipSprite(thiefBlip,  2)
                        return end
                end
                
            end
        end
    end
end)

RegisterNetEvent('fightinprogress')
AddEventHandler('fightinprogress', function(tx, ty, tz)
    for i = 0, #PedModels do
        if not origin and IsPedModel(GetPlayerPed(-1),GetHashKey(PedModels[i])) then
            if fightAlert then
				local transT = 255
				local fightBlip = AddBlipForCoord(tx, ty, tz)
				SetBlipSprite(fightBlip,  1)
				SetBlipColour(fightBlip,  1)
				SetBlipAlpha(fightBlip,  transT)
				SetBlipAsShortRange(fightBlip,  1)
				while transT ~= 0 do
					transT = transT - 1
					SetBlipAlpha(fightBlip,  transT)
					if transT == 0 then
                        SetBlipSprite(fightBlip,  2)
						return end
				end
			
            end
        end
    end
end)		

RegisterNetEvent('gunshotPlace')
AddEventHandler('gunshotPlace', function(gx, gy, gz)
    for i = 0, #PedModels do
        if not origin and IsPedModel(GetPlayerPed(-1),GetHashKey(PedModels[i])) then
            if gunshotAlert then
                local transG = 250
                local gunshotBlip = AddBlipForCoord(gx, gy, gz)
                SetBlipSprite(gunshotBlip,  1)
                SetBlipColour(gunshotBlip,  1)
                SetBlipAlpha(gunshotBlip,  transG)
                SetBlipAsShortRange(gunshotBlip,  1)
                while transG ~= 0 do
                    Wait(blipGunTime * 4)
                    transG = transG - 1
                    SetBlipAlpha(gunshotBlip,  transG)
                    if transG == 0 then
                        SetBlipSprite(gunshotBlip,  2)
                        return end
                end
               
            end
        end
    end
end)

RegisterNetEvent('meleePlace')
AddEventHandler('meleePlace', function(mx, my, mz)
   for i = 0, #PedModels do
        if not origin and IsPedModel(GetPlayerPed(-1),GetHashKey(PedModels[i])) then
            if meleeAlert then
                local transM = 250
                local meleeBlip = AddBlipForCoord(mx, my, mz)
                SetBlipSprite(meleeBlip,  270)
                SetBlipColour(meleeBlip,  17)
                SetBlipAlpha(meleeBlip,  transG)
                SetBlipAsShortRange(meleeBlip,  1)
                while transM ~= 0 do
                    Wait(blipMeleeTime * 4)
                    transM = transM - 1
                    SetBlipAlpha(meleeBlip,  transM)
                    if transM == 0 then
                        SetBlipSprite(meleeBlip,  2)
                        return end
                end
                
            end
        end
    end
end)

--Star color
--[[1- White
2- Black
3- Grey
4- Clear grey
5-
6-
7- Clear orange
8-
9-
10-
11-
12- Clear blue]]

Citizen.CreateThread( function()
    while true do
        Wait(0)
        if showOutlaw then
            for i = 0, 31 do
                if DecorGetInt(GetPlayerPed(i), "IsOutlaw") == 2 and GetPlayerPed(i) ~= GetPlayerPed(-1) then
                    gamerTagId = Citizen.InvokeNative(0xBFEFE3321A3F5015, GetPlayerPed(i), ".", false, false, "", 0 )
                    Citizen.InvokeNative(0xCF228E2AA03099C3, gamerTagId, 0) --Show a star
                    Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 7, true) --Active gamerTagId
                    Citizen.InvokeNative(0x613ED644950626AE, gamerTagId, 7, 1) --White star
                elseif DecorGetInt(GetPlayerPed(i), "IsOutlaw") == 1 then
                    Citizen.InvokeNative(0x613ED644950626AE, gamerTagId, 7, 255) -- Set Color to 255
                    Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 7, false) --Unactive gamerTagId
                end
            end
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)
        if DecorGetInt(GetPlayerPed(-1), "IsOutlaw") == 2 then
            Wait( math.ceil(timing) )
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 1)
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)
        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedTryingToEnterALockedVehicle(GetPlayerPed(-1)) or IsPedJacking(GetPlayerPed(-1)) then
            origin = true
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 2)
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('thiefInProgressPos', plyPos.x, plyPos.y, plyPos.z)
            local veh = GetVehiclePedIsTryingToEnter(GetPlayerPed(-1))
            local vehName = GetDisplayNameFromVehicleModel(GetEntityModel(veh))
            local vehName2 = GetLabelText(vehName)
            if s2 == 0 then
                TriggerServerEvent('thiefInProgressS1', street1, vehName2, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent('thiefInProgress', street1, street2, vehName2, sex)
            end
            Wait(5000)
            origin = false
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)
        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedInMeleeCombat(GetPlayerPed(-1)) then 
            origin = true
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 2)
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('meleeInProgressPos', plyPos.x, plyPos.y, plyPos.z)
            if s2 == 0 then
                TriggerServerEvent('meleeInProgressS1', street1, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent("meleeInProgress", street1, street2, sex)
            end
            Wait(3000)
            origin = false
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)
        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedShooting(GetPlayerPed(-1)) then
            origin = true
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 2)
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('gunshotInProgressPos', plyPos.x, plyPos.y, plyPos.z)
            if s2 == 0 then
                TriggerServerEvent('gunshotInProgressS1', street1, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent("gunshotInProgress", street1, street2, sex)
            end
            Wait(3000)
            origin = false
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)      
        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedInMeleeCombat(GetPlayerPed(-1)) then
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('fightinprogresspos', plyPos.x, plyPos.y, plyPos.z)
            if s2 == 0 then
                TriggerServerEvent('fightinprogresss1', street1, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent("fightinprogress", street1, street2, sex)
            end
            Wait(3000)
        end
    end
end)

server.lua

RegisterServerEvent('thiefInProgress')
AddEventHandler('thiefInProgress', function(street1, street2, veh, sex)
	if veh == "NULL" then
		TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-16 ~r~Thief of a vehicle by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
	else
		TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-16 ~r~Thief of a ~w~"..veh.." ~r~by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
	end
end)

RegisterServerEvent('thiefInProgressS1')
AddEventHandler('thiefInProgressS1', function(street1, veh, sex)
	if veh == "NULL" then
		TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-16 ~r~Thief of a vehicle by a ~w~"..sex.." ~r~at ~w~"..street1)
	else
		TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-16 ~r~Thief of a ~w~"..veh.." ~r~by a ~w~"..sex.." ~r~at ~w~"..street1)
	end
end)

RegisterServerEvent('fightinprogress')
AddEventHandler('fightinprogress', function(street1, street2, sex)
	TriggerClientEvent("outlawNotify", -1, '', { 0, 0, 0 }, "~b~[HQ] ~g~10-10 ^1Fight reported by a ^0"..sex.." ^1between ^0"..street1.."^1 and ^0"..street2)
end)

RegisterServerEvent('meleeInProgress')
AddEventHandler('meleeInProgress', function(street1, street2, sex)
	TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-10 ~r~Fight initiated by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
end)

RegisterServerEvent('meleeInProgressS1')
AddEventHandler('meleeInProgressS1', function(street1, sex)
	TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-10 ~r~Assault initiated by a ~w~"..sex.." ~r~at ~w~"..street1)
end)


RegisterServerEvent('gunshotInProgress')
AddEventHandler('gunshotInProgress', function(street1, street2, sex)
	TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-13 ~r~Gunshot by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
end)

RegisterServerEvent('gunshotInProgressS1')
AddEventHandler('gunshotInProgressS1', function(street1, sex)
	TriggerClientEvent("outlawNotify", -1, "~b~[HQ] ~g~10-13 ~r~Gunshot by a ~w~"..sex.." ~r~at ~w~"..street1)
end)

RegisterServerEvent('thiefInProgressPos')
AddEventHandler('thiefInProgressPos', function(tx, ty, tz)
	TriggerClientEvent('thiefPlace', -1, tx, ty, tz)
end)

RegisterServerEvent('gunshotInProgressPos')
AddEventHandler('gunshotInProgressPos', function(gx, gy, gz)
	TriggerClientEvent('gunshotPlace', -1, gx, gy, gz)
end)

RegisterServerEvent('meleeInProgressPos')
AddEventHandler('meleeInProgressPos', function(mx, my, mz)
	TriggerClientEvent('meleePlace', -1, mx, my, mz)
end)

RegisterServerEvent('fightinprogresspos')
AddEventHandler('fightinprogresspos', function(gx, gy, gz)
	TriggerClientEvent('fightinprogress', -1, gx, gy, gz)
end)

Nice script, do you think we can just make the notification for people having police job ? better than Model I think

IMO shouldn’t be wearing the skin if you can’t drive the cars lol

Do you think it’s possible to make the alert on a job, and not only on a skin ?

Can you please make it so it only shows to players of a certain Permission level?

So for example anyone with a perm level of one or higher will see the blips (If player is specific model)

Since fivem is unplayable in my country, I don’t continue my script, because I can’t use it…

Sorry

1 Like

Thus can give yourselves us the example to change skins in job by police please because my script police gives no skins it do not can work thank you

Hi mate ,

Thanks for this script it’s very good.

How do i change gamerTagId = Citizen.InvokeNative(0xBFEFE3321A3F5015, GetPlayerPed(i), “.”, false, false, “”, 0 ) to show user id instead of the “.”

If i try change the “.” to a get player id function it doesnt show anything , havent been able to work out why but i know the function works as i used it on other events.

Thanks.

Hi,

Replace “.” by tonumber(GetPLayerId(i))

I don’t have anything to test, so, I can’t test it.

It’s nothing relating this script, the problem come from the script who give police skin (Outlaw Alert don’t work with script that let user costomize their player)

1 Like

So me and a friend did an update to this script and thought it would be viable to share.

Instead of it looking for a player model, It now looks for the users job id which can be changed in the server.lua

Please note it shows you your own blips etc.

Used with EssentialMode2

Client.lua:

--Config
local timer = 1 --in minutes - Set the time during the player is outlaw
local showOutlaw = true --Set if show outlaw act on map
local gunshotAlert = true --Set if show alert when player use gun
local carJackingAlert = true --Set if show when player do carjacking
local meleeAlert = true --Set if show when player fight in melee
local blipGunTime = 2 --in second
local blipMeleeTime = 2 --in second
local blipJackingTime = 10 -- in second
local display = false
--End config

local origin = false --Don't touche it
local timing = timer * 60000 --Don't touche it

RegisterNetEvent('c_Notice')
AddEventHandler('c_Notice', function(canDisplay)
   --Citizen.Trace('bool' .. tostring(canDisplay) .. "\n")
   if canDisplay == "show" then
      display = true
     else
      display = false
   end
end)

GetPlayerName()
RegisterNetEvent('outlawNotify')
AddEventHandler('outlawNotify', function(alert)
  if ( display ) then
--    Citizen.Trace('user rank' .. tostring(user.permission_level) .. "\n")
    Notify(alert)
  end
end)

function Notify(text)
    SetNotificationTextEntry('STRING')
    AddTextComponentString(text)
    DrawNotification(false, false)
end

Citizen.CreateThread(function()
    while true do
        Wait(0)
        if NetworkIsSessionStarted() then
            DecorRegister("IsOutlaw",  3)
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 1)
            return
        end
    end
end)

RegisterNetEvent('thiefPlace')
AddEventHandler('thiefPlace', function(tx, ty, tz)
   if ( display ) then
      if carJackingAlert then
                local transT = 250
                local thiefBlip = AddBlipForCoord(tx, ty, tz)
                SetBlipSprite(thiefBlip,  10)
                SetBlipColour(thiefBlip,  1)
                SetBlipAlpha(thiefBlip,  transT)
                SetBlipAsShortRange(thiefBlip,  1)
                while transT ~= 0 do
                    Wait(blipJackingTime * 4)
                    transT = transT - 1
                    SetBlipAlpha(thiefBlip,  transT)

                if transT == 0 then
                   SetBlipSprite(thiefBlip,  2)
                   return
               end
           end
        end
    end
end)

RegisterNetEvent('fightinprogress')
AddEventHandler('fightinprogress', function(tx, ty, tz)
  if ( display ) then
      transT = 255
      local thiefBlip = AddBlipForCoord(tx, ty, tz)
      SetBlipSprite(thiefBlip,  10)
      SetBlipColour(thiefBlip,  1)
      SetBlipAlpha(thiefBlip,  transT)
      SetBlipAsShortRange(thiefBlip,  1)
      while transT ~= 0 do
         Wait(40)
         transT = transT - 1
         SetBlipAlpha(thiefBlip,  transT)
      end

    if transT == 0 then
      return
    end
  end
end)

RegisterNetEvent('gunshotPlace')
AddEventHandler('gunshotPlace', function(gx, gy, gz)
  if ( display ) then
            if gunshotAlert then
                local transG = 250
                local gunshotBlip = AddBlipForCoord(gx, gy, gz)
                SetBlipSprite(gunshotBlip,  1)
                SetBlipColour(gunshotBlip,  1)
                SetBlipAlpha(gunshotBlip,  transG)
                SetBlipAsShortRange(gunshotBlip,  1)
                while transG ~= 0 do
                    Wait(blipGunTime * 4)
                    transG = transG - 1
                    SetBlipAlpha(gunshotBlip,  transG)
               if transG == 0 then
                  SetBlipSprite(gunshotBlip,  2)
                 return
              end
          end
       end
    end
end)

RegisterNetEvent('meleePlace')
AddEventHandler('meleePlace', function(mx, my, mz)
      if ( display ) then
            if meleeAlert then
                local transM = 250
                local meleeBlip = AddBlipForCoord(mx, my, mz)
                SetBlipSprite(meleeBlip,  270)
                SetBlipColour(meleeBlip,  17)
                SetBlipAlpha(meleeBlip,  transG)
                SetBlipAsShortRange(meleeBlip,  1)
                while transM ~= 0 do
                    Wait(blipMeleeTime * 4)
                   transM = transM - 1
                    SetBlipAlpha(meleeBlip,  transM)
                if transM == 0 then
                   SetBlipSprite(meleeBlip,  2)
                  return
                end
            end
        end
    end
end)

--Star color
--[[1- White
2- Black
3- Grey
4- Clear grey
5-
6-
7- Clear orange
8-
9-
10-
11-
12- Clear blue]]

Citizen.CreateThread( function()
    while true do
        Wait(0)
        if showOutlaw then
            for i = 0, 31 do
                if DecorGetInt(GetPlayerPed(i), "IsOutlaw") == 2 and GetPlayerPed(i) ~= GetPlayerPed(-1) then
                    gamerTagId = Citizen.InvokeNative(0xBFEFE3321A3F5015, GetPlayerPed(i), ".", false, false, "", 0 )
                    Citizen.InvokeNative(0xCF228E2AA03099C3, gamerTagId, 0) --Show a star
                    Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 7, true) --Active gamerTagId
                    Citizen.InvokeNative(0x613ED644950626AE, gamerTagId, 7, 1) --White star
                elseif DecorGetInt(GetPlayerPed(i), "IsOutlaw") == 1 then
                    Citizen.InvokeNative(0x613ED644950626AE, gamerTagId, 7, 255) -- Set Color to 255
                    Citizen.InvokeNative(0x63BB75ABEDC1F6A0, gamerTagId, 7, false) --Unactive gamerTagId
                end
            end
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)
        if DecorGetInt(GetPlayerPed(-1), "IsOutlaw") == 2 then
            Wait( math.ceil(timing) )
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 1)
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)
        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedTryingToEnterALockedVehicle(GetPlayerPed(-1)) or IsPedJacking(GetPlayerPed(-1)) then
            origin = true
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 2)
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('thiefInProgressPos', plyPos.x, plyPos.y, plyPos.z)
            local veh = GetVehiclePedIsTryingToEnter(GetPlayerPed(-1))
            local vehName = GetDisplayNameFromVehicleModel(GetEntityModel(veh))
            local vehName2 = GetLabelText(vehName)
            if s2 == 0 then
                TriggerServerEvent('thiefInProgressS1', street1, vehName2, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent('thiefInProgress', street1, street2, vehName2, sex)
            end
            Wait(5000)
            origin = false
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)
        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedInMeleeCombat(GetPlayerPed(-1)) then
            origin = true
            DecorSetInt(GetPlayerPed(-1), "IsOutlaw", 2)
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('meleeInProgressPos', plyPos.x, plyPos.y, plyPos.z)
            if s2 == 0 then
                TriggerServerEvent('meleeInProgressS1', street1, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent("meleeInProgress", street1, street2, sex)
            end
            Wait(3000)
            origin = false
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)

        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedShooting(GetPlayerPed(-1)) then
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('fightinprogresspos', plyPos.x, plyPos.y, plyPos.z)
            if s2 == 0 then
                TriggerServerEvent('gunshotInProgressS1', street1, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent("gunshotInProgress", street1, street2, sex)
            end
            Wait(3000)
        end
    end
end)

Citizen.CreateThread( function()
    while true do
        Wait(0)

        local plyPos = GetEntityCoords(GetPlayerPed(-1),  true)
        local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, plyPos.x, plyPos.y, plyPos.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() )
        local street1 = GetStreetNameFromHashKey(s1)
        local street2 = GetStreetNameFromHashKey(s2)
        if IsPedInMeleeCombat(GetPlayerPed(-1)) then
            local male = IsPedMale(GetPlayerPed(-1))
            if male then
                sex = "men"
            elseif not male then
                sex = "women"
            end
            TriggerServerEvent('fightinprogresspos', plyPos.x, plyPos.y, plyPos.z)
            if s2 == 0 then
                TriggerServerEvent('fightinprogresss1', street1, sex)
            elseif s2 ~= 0 then
                TriggerServerEvent("fightinprogress", street1, street2, sex)
            end
            Wait(3000)
        end
    end
end)

Citizen.CreateThread( function()
  while true do
    Citizen.Wait(0)
    TriggerServerEvent('s_checkPerm')
  end
end)

Server.lua

RegisterServerEvent('s_checkPerm')
AddEventHandler('s_checkPerm', function()
   TriggerEvent('es:getPlayerFromId', source, function(user)
      if ( user.job == 2 ) then --This is where you can set the job id
          TriggerClientEvent('c_Notice', source, "show")
         else
          TriggerClientEvent('c_Notice', source, "hide")
      end
   end)
end)

RegisterServerEvent('thiefInProgress')
AddEventHandler('thiefInProgress', function(street1, street2, veh, sex)
	if veh == "NULL" then
		TriggerClientEvent("outlawNotify", -1, "~r~Thief of a vehicle by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
	else
		TriggerClientEvent("outlawNotify", -1, "~r~Thief of a ~w~"..veh.." ~r~by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
	end
end)

RegisterServerEvent('thiefInProgressS1')
AddEventHandler('thiefInProgressS1', function(street1, veh, sex)
	if veh == "NULL" then
		TriggerClientEvent("outlawNotify", -1, "~r~Thief of a vehicle by a ~w~"..sex.." ~r~at ~w~"..street1)
	else
		TriggerClientEvent("outlawNotify", -1, "~r~Thief of a ~w~"..veh.." ~r~by a ~w~"..sex.." ~r~at ~w~"..street1)
	end
end)

RegisterServerEvent('meleeInProgress')
AddEventHandler('meleeInProgress', function(street1, street2, sex)
	TriggerClientEvent("outlawNotify", -1, "~r~Fight initiated by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
end)

RegisterServerEvent('meleeInProgressS1')
AddEventHandler('meleeInProgressS1', function(street1, sex)
	TriggerClientEvent("outlawNotify", -1, "~r~Fight initiated by a ~w~"..sex.." ~r~at ~w~"..street1)
end)


RegisterServerEvent('gunshotInProgress')
AddEventHandler('gunshotInProgress', function(street1, street2, sex)
	TriggerClientEvent("outlawNotify", -1, "~r~Gunshot by a ~w~"..sex.." ~r~between ~w~"..street1.."~r~ and ~w~"..street2)
end)

RegisterServerEvent('gunshotInProgressS1')
AddEventHandler('gunshotInProgressS1', function(street1, sex)
	TriggerClientEvent("outlawNotify", -1, "~r~Gunshot by a ~w~"..sex.." ~r~at ~w~"..street1)
end)

RegisterServerEvent('thiefInProgressPos')
AddEventHandler('thiefInProgressPos', function(tx, ty, tz)
	TriggerClientEvent('thiefPlace', -1, tx, ty, tz)
end)

RegisterServerEvent('gunshotInProgressPos')
AddEventHandler('gunshotInProgressPos', function(gx, gy, gz)
	TriggerClientEvent('gunshotPlace', -1, gx, gy, gz)
end)

RegisterServerEvent('meleeInProgressPos')
AddEventHandler('meleeInProgressPos', function(mx, my, mz)
	TriggerClientEvent('meleePlace', -1, mx, my, mz)
end)

RegisterServerEvent('fightinprogresspos')
AddEventHandler('fightinprogresspos', function(gx, gy, gz)
	TriggerClientEvent('fightinprogress', -1, gx, gy, gz)
end)
2 Likes

nice job bro ! going to test that very fast !!

edit :unfortunatly it doesnt work for me, I correctly put the job id

using EssentialMode2?

If not that could be why

change it to code below that should work for you allowes anyone with the rank of 1 and higher to use it and it dont show your own actions on map

RegisterServerEvent('s_checkPerm')
AddEventHandler('s_checkPerm', function()
   TriggerEvent('es:getPlayerFromId', source, function(user)
      if ( user.permission_level >= 1 ) and (GetPlayerPed(source) ~= GetPlayerServerId(source) then
        TriggerClientEvent('c_Notice', source, "show")
       else
        TriggerClientEvent('c_Notice', source, "hide")
      end
   end)
end)
1 Like

yes i’m using em2 too, i will try the answer below thanks !

Im using it like this and its working fine :confused:

do you have a job table on your user database and are using the jobs system script?

And nothing appears, even with good job ID :confused:

Did you try to replace user.job by users.job?

I get this error too, It does not effect how the script works, Ignore it… xD although it is an error that does need seeing to