Last active
January 31, 2021 07:31
-
-
Save TroublesNCuddles/99af224747ddae6c0a6f924930daa7df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Areas = { | |
BoxZone:Create(vector3(-321.31, -125.83, 39.01), 19.4, 7.2, {name="ghost",heading=340,minZ=37.26,maxZ=41.26}), | |
BoxZone:Create(vector3(-326.94, -144.67, 39.01), 5.4, 7.4, {name="ghostpaint",heading=340,minZ=38.01,maxZ=40.61}) | |
} | |
local area = GetPedBoneCoords(PlayerPedId(), 0x796e) | |
function IsInWhitelistedArea() | |
local PlayerBoneCoords = GetPedBoneCoords(PlayerPedId(), 0x796e) | |
for area in pairs(Areas) do | |
if Area:isPointInside(PlayerBoneCoords) then | |
return true | |
end | |
end | |
return false | |
end | |
Citizen.CreateThread(function() | |
-- Don't save PlayerPedId to a variable, it's just wasteful | |
while true do | |
-- First, check if the player is doing something we do not appreciate | |
if (IsPedTryingToEnterALockedVehicle(PlayerPedId()) or IsPedJacking(PlayerPedId())) and Config.CarJackingAlert then | |
-- I don't k | |
local vehicle = GetVehiclePedIsTryingToEnter(PlayerPedId()) | |
if not IsInWhitelistedArea() and not IsEntityDead(vehicle) and ((isPlayerWhitelisted and Config.ShowCopsMisbehave) or not isPlayerWhitelisted) then | |
local plate = ESX.Math.Trim(GetVehicleNumberPlateText(vehicle)) | |
ESX.TriggerServerCallback('gr8rp_outlawalert:isVehicleOwner', function(owner) | |
if not owner then | |
local vehicleLabel = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)) | |
vehicleLabel = GetLabelText(vehicleLabel) | |
DecorSetInt(playerPed, 'isOutlaw', 2) | |
TriggerServerEvent('gr8rp_outlawalert:carJackInProgress', { | |
x = ESX.Math.Round(playerCoords.x, 1), | |
y = ESX.Math.Round(playerCoords.y, 1), | |
z = ESX.Math.Round(playerCoords.z, 1) | |
}, streetName, vehicleLabel, playerGender) | |
Citizen.Wait(60000) | |
end | |
end, plate) | |
end | |
elseif IsPedInMeleeCombat(playerPed) and Config.MeleeAlert then | |
Citizen.Wait(5000) | |
if (isPlayerWhitelisted and Config.ShowCopsMisbehave) or not isPlayerWhitelisted then | |
DecorSetInt(playerPed, 'isOutlaw', 2) | |
TriggerServerEvent('gr8rp_outlawalert:combatInProgress', { | |
x = ESX.Math.Round(playerCoords.x, 1), | |
y = ESX.Math.Round(playerCoords.y, 1), | |
z = ESX.Math.Round(playerCoords.z, 1) | |
}, streetName, playerGender) | |
Citizen.Wait(30000) | |
end | |
elseif IsPedShooting(playerPed) and not IsPedCurrentWeaponSilenced(playerPed) and Config.GunshotAlert and not inside then | |
Citizen.Wait(3000) | |
elseif IsPedShooting(playerPed) and not IsPedCurrentWeaponSilenced(playerPed) and Config.GunshotAlert then | |
Citizen.Wait(3000) | |
if (isPlayerWhitelisted and Config.ShowCopsMisbehave) or not isPlayerWhitelisted then | |
if not inside then | |
DecorSetInt(playerPed, 'isOutlaw', 2) | |
TriggerServerEvent('gr8rp_outlawalert:gunshotInProgress', { | |
x = ESX.Math.Round(playerCoords.x, 1), | |
y = ESX.Math.Round(playerCoords.y, 1), | |
z = ESX.Math.Round(playerCoords.z, 1) | |
}, streetName, playerGender) | |
--Citizen.Wait(30000) --for testing | |
end | |
end | |
end | |
end | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment