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

Hi

As requested in Scipting Help forum, there is a simple script to show in chatbox a message when a player try to carjacking a vehicle and when a player shoot anywhere.

I’ll improve it with time, like addind temporary blip on map etc…

Configuable options:

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

What next:
Implement it in EssentialMode
Detcet the skin of player: if it’s a cop skin, the player can see alert, if not, the player don’t see anything!

19 Likes

Car theft works perfect! Thank you again, just cant get shots fired with alerts

2 Likes

Hum; strange, I just tested and that work, I have re-uploaded my working version on github, let me know if theralways nothing when gunshot

works great! amazing job! None of the problems i had before. I added this in the script IsPedInMeleeCombat, for when a fight breaks out.

1 Like

yes works nice now…! First post of this edit in last thread was missing some stuff you added in github.

Thank you! Please consider little scripts like this, they are great for role play.

2 Likes

###Update###

Suggested by @stevenkrause84 I have added blip:

A simple red blip when someone shoot
A red circle around the zone where a car has been stolen/jacked

The red blip disapear after 2.5 sec. and the red circle after about 10 sec.

Great work. I’ll take a look at it when I get time and provide feedback.

1 Like

Awesome! Your amazing my brother!

can you make also an alert when someone dies on the server and shows where they die.

2 Likes

By someone you want to tell a player?

Is there a way to make the message appear to admin only? My on duty police will have level one admin. Less chance of meta, if they player doesn’t know he/she is wanted.

yeah but what HST said is it possible to make it so only the police would know?

That would be cool…

Well you would need to have the /changerole script then add line with the role permissions

@NYKILLA1127, @ejb1123 and @HST, I don’t know how the role on your server is defined… If there is a way to get the role of the player I can do something for that, but if everyone use the same role assignation system…

Client.lua


RegisterNetEvent('thiefPlace')
AddEventHandler('thiefPlace', function(tx, ty, tz)
    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)

RegisterNetEvent('fightinprogress')
AddEventHandler('fightinprogress', function(tx, ty, tz)
    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)

RegisterNetEvent('gunshotPlace')
AddEventHandler('gunshotPlace', function(gx, gy, gz)
    transG = 255
    local thiefBlip = AddBlipForCoord(gx, gy, gz)
    SetBlipSprite(thiefBlip,  1)
    SetBlipColour(thiefBlip,  1)
    SetBlipAlpha(thiefBlip,  transG)
    SetBlipAsShortRange(thiefBlip,  1)
    while transG ~= 0 do
        Wait(10)
        transG = transG - 1
        SetBlipAlpha(thiefBlip,  transG)
    end
    if transG == 0 then
        return 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
            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)
        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)

server.lua

RegisterServerEvent('thiefInProgress')
AddEventHandler('thiefInProgress', function(street1, street2, veh, sex)
	if veh == "NULL" then
		TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Vehicle Robbery in progress by a ^0"..sex.." ^1between ^0"..street1.."^1 and ^0"..street2)
	else
		TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Vehicle  robbery in progress ^0"..veh.." ^1by a ^0"..sex.." ^1between ^0"..street1.."^1 and ^0"..street2)
	end
end)

RegisterServerEvent('thiefInProgressS1')
AddEventHandler('thiefInProgressS1', function(street1, veh, sex)
	if veh == "NULL" then
		TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Vehicle Robbery in progress by a ^0"..sex.." ^1at ^0"..street1)
	else
		TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Vehicle  robbery in progress ^0"..veh.." ^1by a ^0"..sex.." ^1at ^0"..street1)
	end
end)

RegisterServerEvent('gunshotInProgress')
AddEventHandler('gunshotInProgress', function(street1, street2, sex)
	TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Gunshots reported by a ^0"..sex.." ^1between ^0"..street1.."^1 and ^0"..street2)
end)

RegisterServerEvent('fightinprogress')
AddEventHandler('fightinprogress', function(street1, street2, sex)
	TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Fight reported by a ^0"..sex.." ^1between ^0"..street1.."^1 and ^0"..street2)
end)

RegisterServerEvent('gunshotInProgressS1')
AddEventHandler('gunshotInProgressS1', function(street1, sex)
	TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Gunshots reported by a ^0"..sex.." ^1at ^0"..street1)
end)

RegisterServerEvent('fightinprogresss1')
AddEventHandler('fightinprogresss1', function(street1, sex)
	TriggerClientEvent("chatMessage", -1, '', { 0, 0, 0 }, "^1CCTV: Fight reported by a ^0"..sex.." ^1at ^0"..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('fightinprogresspos')
AddEventHandler('fightinprogresspos', function(gx, gy, gz)
	TriggerClientEvent('fightinprogress', -1, gx, gy, gz)
end)

this is the same script , nothing is changed, i just added a simple fight in progress.

1 Like

I will add melee in next update, with the possibility to active/unactive alert you want to see via a little config option in client.lua

##Update##

Add of melee alert
Add configurable option
Add timer to be Outlaw
Add star next to the player name when Outlaw
Change alerte form Chat Message To notification (above the map)

local timer = 1 --in minutes - Set the time during the player is wanted
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

I added the code nothing is happening? am I doing something wrong?

You have to re download all files, this is just to see what option are configurable