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.