-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
47 lines (39 loc) · 1.15 KB
/
client.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
RegisterNetEvent('VehicleDeleteGunOn')
RegisterNetEvent('VehicleDeleteGunOff')
local toggle = false
AddEventHandler('VehicleDeleteGunOn', function()
toggle = true
drawNotification("~g~Vehicle Delete Gun Enabled!")
end)
AddEventHandler('VehicleDeleteGunOff', function()
toggle = false
drawNotification("~r~Vehicle Delete Gun Disabled!")
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if toggle then
if IsPlayerFreeAiming(PlayerId()) then
local entity = getEntity(PlayerId())
if IsPedShooting(GetPlayerPed(-1)) then
SetEntityAsMissionEntity(entity, true, true)
if Config.DVGunEntities then
DeleteEntity(entity)
else
local vehicle = GetVehicleIndexFromEntityIndex(entity)
DeleteVehicle(vehicle)
end
end
end
end
end
end)
function getEntity(player) --Function To Get Entity Player Is Aiming At
local result, entity = GetEntityPlayerIsFreeAimingAt(player)
return entity
end
function drawNotification(text) --Just Don't Edit!
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(false, false)
end