remove blips| switch to waypoint. function spawning tables, code condense
This commit is contained in:
1 parent
1224133815
commit
83f2749101
13 files changed
+147
-269
No files matched your search
+26
-37
@@ -1,6 +1,6 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local miss = false
|
||||
local deliveryBlip = nil
|
||||
|
||||
|
||||
RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify)
|
||||
if not GetCops(Config.PoliceCount) then return end
|
||||
@@ -12,16 +12,7 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify)
|
||||
local CurrentLocation = Config.oxylocations[math.random(#Config.oxylocations)]
|
||||
local timer = 0
|
||||
miss = true
|
||||
deliveryBlip = AddBlipForCoord(CurrentLocation)
|
||||
SetBlipSprite(deliveryBlip, 1)
|
||||
SetBlipDisplay(deliveryBlip, 2)
|
||||
SetBlipScale(deliveryBlip, 1.0)
|
||||
SetBlipAsShortRange(deliveryBlip, false)
|
||||
SetBlipColour(deliveryBlip, 27)
|
||||
BeginTextCommandSetBlipName("STRING")
|
||||
AddTextComponentSubstringPlayerName("drug Meet")
|
||||
EndTextCommandSetBlipName(deliveryBlip)
|
||||
SetBlipRoute(deliveryBlip, true)
|
||||
SetNewWaypoint(CurrentLocation.x, CurrentLocation.y)
|
||||
lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime)
|
||||
local current = "g_m_y_famdnf_01"
|
||||
local drugdealer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, 90.0, false, false)
|
||||
@@ -32,25 +23,24 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify)
|
||||
label = Lang.Wholesale.talk,
|
||||
icon = "fas fa-eye",
|
||||
action = function()
|
||||
local luck = math.random(1,100)
|
||||
if luck >=101 then
|
||||
TriggerEvent("md-drugs:client:SuccessSale", drug)
|
||||
Wait(4000)
|
||||
DeleteEntity(drugdealer)
|
||||
else
|
||||
TriggerEvent("md-drugs:client:SetUp")
|
||||
Wait(3000)
|
||||
DeleteEntity(drugdealer)
|
||||
end
|
||||
miss = false
|
||||
end,
|
||||
local luck = math.random(1,100)
|
||||
if luck >=101 then
|
||||
TriggerEvent("md-drugs:client:SuccessSale", drug)
|
||||
Wait(4000)
|
||||
DeleteEntity(drugdealer)
|
||||
else
|
||||
TriggerEvent("md-drugs:client:SetUp")
|
||||
Wait(3000)
|
||||
DeleteEntity(drugdealer)
|
||||
end
|
||||
miss = false
|
||||
end,
|
||||
},nil )
|
||||
repeat
|
||||
Wait(1000)
|
||||
timer = timer + 1
|
||||
until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 or timer == Config.WholesaleTimeout + 1
|
||||
PoliceCall(Config.AlertPoliceWholesale)
|
||||
RemoveBlip(deliveryBlip)
|
||||
if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 then
|
||||
timer = 0
|
||||
else
|
||||
@@ -62,21 +52,20 @@ end)
|
||||
|
||||
|
||||
RegisterNetEvent("md-drugs:client:SuccessSale", function(drug)
|
||||
if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end
|
||||
if drug == 'coke' then
|
||||
TriggerServerEvent("md-drugs:server:wholesalecoke")
|
||||
elseif drug == 'crack' then
|
||||
TriggerServerEvent("md-drugs:server:wholesalecrack")
|
||||
elseif drug == 'lsd' then
|
||||
TriggerServerEvent("md-drugs:server:wholesalelsd")
|
||||
elseif drug == 'heroin' then
|
||||
TriggerServerEvent("md-drugs:server:wholesaleheroin")
|
||||
elseif drug == 'xtc' then
|
||||
TriggerEvent("md-drugs:client:wholesalextc")
|
||||
end
|
||||
if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end
|
||||
if drug == 'coke' then
|
||||
TriggerServerEvent("md-drugs:server:wholesalecoke")
|
||||
elseif drug == 'crack' then
|
||||
TriggerServerEvent("md-drugs:server:wholesalecrack")
|
||||
elseif drug == 'lsd' then
|
||||
TriggerServerEvent("md-drugs:server:wholesalelsd")
|
||||
elseif drug == 'heroin' then
|
||||
TriggerServerEvent("md-drugs:server:wholesaleheroin")
|
||||
elseif drug == 'xtc' then
|
||||
TriggerEvent("md-drugs:client:wholesalextc")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent("md-drugs:client:SetUp", function()
|
||||
progressbar("YOU FUCKED NOW", 4000, 'uncuff')
|
||||
SetUpPeds()
|
||||
|
||||
Reference in new issue
Block a user