dealerpos = {x=0,y=0,z=0} Antifreeze = {x=0,y=0,z=0} Acetone = {x=0,y=0,z=0} Sudafed = {x=0,y=0,z=0} Redp = {x=0,y=0,z=0} local drug = 0 drugs = { {id = 8, name = "Weed", min = 1, max = 3, low = 500, high = 850, prob = 10}, {id = 152, name = "Weed", min = 1, max = 3, low = 1200, high = 1600, prob = 10}, {id = 11, name = "Meth", min = 1, max = 1, low = 2750, high = 3500, prob = 15}, {id = 153, name = "Meth", min = 1, max = 1, low = 5000, high = 6000, prob = 25}, {id = 118, name = "Crack Cocaine", min = 1, max = 2, low = 1250, high = 2250, prob = 15}, {id = 28, name = "Cocaine", min = 1, max = 2, low = 4000, high = 5000, prob = 25}, } local entityEnumerator = { __gc = function(enum) if enum.destructor and enum.handle then enum.destructor(enum.handle) end enum.destructor = nil enum.handle = nil end } local function EnumerateEntities(initFunc, moveFunc, disposeFunc) return coroutine.wrap(function() local iter, id = initFunc() if not id or id == 0 then disposeFunc(iter) return end local enum = {handle = iter, destructor = disposeFunc} setmetatable(enum, entityEnumerator) local next = true repeat coroutine.yield(id) next, id = moveFunc(iter) until not next enum.destructor, enum.handle = nil, nil disposeFunc(iter) end) end function EnumerateObjects() return EnumerateEntities(FindFirstObject, FindNextObject, EndFindObject) end function EnumeratePeds() return EnumerateEntities(FindFirstPed, FindNextPed, EndFindPed) end function EnumerateVehicles() return EnumerateEntities(FindFirstVehicle, FindNextVehicle, EndFindVehicle) end function EnumeratePickups() return EnumerateEntities(FindFirstPickup, FindNextPickup, EndFindPickup) end function GetAllPeds() local peds = {} for ped in EnumeratePeds() do if DoesEntityExist(ped) then table.insert(peds, ped) end end return peds end function GetAllVehicles() local vehicles = {} for vehicle in EnumerateVehicles() do if DoesEntityExist(vehicle) then table.insert(vehicles, vehicle) end end return vehicles end Citizen.CreateThread(function() while true do Citizen.Wait(1000) for k,v in pairs(drugs) do if exports.FCORE_:GetItemQuantity(v.id) >= 1 then drug = k break end drug = 0 end end end) function GetNearestPed() local closestped = 0 local closestdist = 500 dist2 = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1), true),GetEntityCoords(closestped, true), true) peds = GetAllPeds() for k,v in pairs(peds) do dist = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1), true), GetEntityCoords(v, true), true) if dist < closestdist and v ~= GetPlayerPed(-1) and not IsPedAPlayer(v) then closestped = v closestdist = dist end end return closestped end RegisterNetEvent('ai:revive') AddEventHandler('ai:revive', function() local closestped = 0 local closestdist = 500 dist2 = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1), true),GetEntityCoords(closestped, true), true) peds = GetAllPeds() for k,v in pairs(peds) do dist = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1), true), GetEntityCoords(v, true), true) if dist < closestdist and v ~= GetPlayerPed(-1) then closestped = v closestdist = dist end end if closestped ~= 0 then local coords = GetEntityCoords(closestped, true) ResurrectPed(closestped) SetEntityHealth(closestped, 100) ClearPedTasksImmediately(closestped) local coords = GetEntityCoords(closestped, false) SetEntityCoords(closestped, coords.x, coords.y, coords.z+0.5, 0, 0, 0, false) Citizen.Wait(100) ResurrectPed(closestped) SetEntityHealth(closestped, 100) ClearPedTasksImmediately(closestped) SetEntityCoords(closestped, coords.x, coords.y, coords.z+0.5, 0, 0, 0, false) end end) local attached = false RegisterNetEvent('ai:drag') AddEventHandler('ai:drag', function() local closestped = 0 local closestdist = 500 dist2 = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1), true),GetEntityCoords(closestped, true), true) peds = GetAllPeds() for k,v in pairs(peds) do dist = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1), true), GetEntityCoords(v, true), true) if dist < closestdist and v ~= GetPlayerPed(-1) then closestped = v closestdist = dist end end if closestped ~= 0 and attached == false then ClearPedTasksImmediately(closestped) Citizen.Wait(100) AttachEntityToEntity(closestped, PlayerPedId(), 4103, 11816, 0.48, 0.00, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true) attached = true elseif attached == true then DetachEntity(closestped,0,0) attached = false end end) function DrawText3d2(x,y,z, text) local onScreen,_x,_y=World3dToScreen2d(x,y,z) local px,py,pz=table.unpack(GetGameplayCamCoords()) if onScreen then SetTextScale(0.5, 0.5) SetTextFont(4) SetTextProportional(1) SetTextColour(255, 255, 255, 255) SetTextDropshadow(0, 0, 0, 0, 55) SetTextEdge(2, 0, 0, 0, 150) SetTextDropShadow() SetTextOutline() SetTextEntry("STRING") SetTextCentre(1) AddTextComponentString(text) DrawText(_x,_y) end end -- Initilizing Selling Variables local selling = false local secondsRemaining = 0 local rejected = false local alerted = 0 Citizen.CreateThread(function() while true do if selling then Citizen.Wait(1000) if(secondsRemaining > 0)then secondsRemaining = secondsRemaining - 1 end end Citizen.Wait(0) end end) currentped = nil local has = true function checkalert() local peds = GetAllPeds() local player = GetPlayerPed(-1) for k,v in pairs(peds) do if v ~= player and not IsPedAPlayer(v) then local dist = GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1), true), GetEntityCoords(v, true), true) if dist < 60.0 then local random = math.random(1,10) if random == 1 and alerted == 0 then alert() alerted = 200 end end end end end function alert() local player = GetPlayerPed(-1) local playerloc = GetEntityCoords(player, 0) local s1, s2 = Citizen.InvokeNative( 0x2EB41072B4C1E4C0, playerloc.x, playerloc.y, playerloc.z, Citizen.PointerValueInt(), Citizen.PointerValueInt() ) local street1 = GetStreetNameFromHashKey(s1) local street2 = GetStreetNameFromHashKey(s2) TriggerServerEvent('cds:callPos', playerloc.x, playerloc.y, playerloc.z, drugs[drug].id) if s2 == 0 then TriggerServerEvent('cds:callS1', street1, getgender(),drugs[drug].name) elseif s2 ~= 0 then TriggerServerEvent("cds:call", street1, street2, getgender(),drugs[drug].name) end end nearestped = nil drugthiefped = nil thiefamount = nil drugstolen = nil soldpeds = {} function checksoldpeds(sellingto) for k,v in pairs(soldpeds) do if sellingto == v then return false end end return true end Citizen.CreateThread(function() while true do Citizen.Wait(0) if drugthiefped ~= nil then if IsEntityDead(drugthiefped) then local player = GetPlayerPed(-1) local playerloc = GetEntityCoords(player, 0) local pos = GetEntityCoords(drugthiefped, false) local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerloc['x'], playerloc['y'], playerloc['z'], true) if distance < 1.5 then drawTxt("Press ~b~E~s~ to loot.",0,1,0.5,0.8,0.6,255,255,255,255) if IsControlJustPressed(1, 38) then TriggerEvent("inventory:addQty", drugstolen, thiefamount) drugthiefped = nil drugstolen = nil thiefamount = nil TriggerEvent('emote', "medic") Citizen.Wait(1500) ClearPedTasks(player) end end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(500) nearestped = GetNearestPed() if alerted > 0 then alerted = alerted - .5 end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) if not selling then if not exports.apartments:IsInApartment() then if drug ~= 0 and nearestped ~= nil then local player = GetPlayerPed(-1) local playerloc = GetEntityCoords(player, 0) ped = nearestped local pos = GetEntityCoords(ped) local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerloc['x'], playerloc['y'], playerloc['z'], true) if IsPedInAnyVehicle(player) == false then if DoesEntityExist(ped)then if IsPedDeadOrDying(ped) == false then if IsPedInAnyVehicle(ped) == false then local pedType = GetPedType(ped) if pedType ~= 28 and IsPedAPlayer(ped) == false then currentped = pos if checksoldpeds(ped) and distance <= 1.7 and ped ~= player and GetDistanceBetweenCoords(dealerpos.x,dealerpos.y,dealerpos.z, playerloc['x'], playerloc['y'], playerloc['z'], true) > 5.0 then drawTxt("Press ~b~E~s~ to sell " .. drugs[drug].name,0,1,0.5,0.8,0.6,255,255,255,255) if IsControlJustPressed(1, 38) then table.insert(soldpeds, ped) TriggerEvent("currentlySelling") SetEntityAsMissionEntity(ped) ClearPedTasks(ped) local random = math.random(1, 100) if random < drugs[drug].prob then local randomsteal = math.random(1,2) if randomsteal < 2 then selling = false TaskTurnPedToFaceEntity(player, ped, 1000) TaskTurnPedToFaceEntity(ped, player, 11000) Citizen.Wait(10000) RequestAnimDict("anim@mp_atm@enter") while (not HasAnimDictLoaded("anim@mp_atm@enter")) do Citizen.Wait(0) end TaskPlayAnim(player,"anim@mp_atm@enter","enter", 100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) TaskPlayAnim(ped,"anim@mp_atm@enter","enter",100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) Wait(750) StopAnimTask(player, "anim@mp_atm@enter","enter", 1.0) StopAnimTask(ped, "anim@mp_atm@enter","enter", 1.0) ClearPedTasks(ped) TriggerEvent('chatMessage', "Haha! Sucker!") drugthiefped = ped if exports.FCORE_:GetItemQuantity(drugs[drug].id) >= drugs[drug].max then thiefamount = math.random(drugs[drug].min,drugs[drug].max) drugstolen = drugs[drug].id TriggerEvent("inventory:removeQty", drugs[drug].id, thiefamount) elseif exports.FCORE_:GetItemQuantity(drugs[drug].id) < drugs[drug].max then thiefamount = exports.FCORE_:GetItemQuantity(drugs[drug].id) drugstolen = drugs[drug].id TriggerEvent("inventory:removeQty", drugs[drug].id, thiefamount) end TaskSmartFleePed(ped, player, 1000.0, -1, 1, 1) selling = false checkalert() else randommessagemath = math.random(1,5) if randommessagemath == 1 then randommessage = "No thanks." elseif randommessagemath == 2 then randommessage = "Nah, I'm good." elseif randommessagemath == 3 then randommessage = "Get out of here." elseif randommessagemath == 4 then randommessage = "Already got some." elseif randommessagemath == 5 then randommessage = "Creep." end TriggerEvent('chatMessage', randommessage) selling = false SetEntityAsMissionEntity(ped) SetPedAsNoLongerNeeded(ped) checkalert() end else TaskTurnPedToFaceEntity(player, ped, 1000) TaskTurnPedToFaceEntity(ped, player, 11000) pos1 = GetEntityCoords(ped) checkalert() end end end end end end end end end end end end end) -- Initilize the Cancel status local blah = false Citizen.CreateThread(function() while true do Wait(0) if selling then local player = GetPlayerPed(-1) local playerloc = GetEntityCoords(player, 0) local distance = GetDistanceBetweenCoords(pos1.x, pos1.y, pos1.z, playerloc['x'], playerloc['y'], playerloc['z'], true) if distance > 2.5 then selling = false SetEntityAsMissionEntity(ped) SetPedAsNoLongerNeeded(ped) end if secondsRemaining == 0 then blah = true local pid = PlayerPedId() SetEntityAsMissionEntity(ped) ClearPedTasks(GetPlayerPed(-1)) RequestAnimDict("anim@mp_atm@enter") while (not HasAnimDictLoaded("anim@mp_atm@enter")) do Citizen.Wait(0) end TaskPlayAnim(pid,"anim@mp_atm@enter","enter", 100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) TaskPlayAnim(ped,"anim@mp_atm@enter","enter",100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) Wait(750) StopAnimTask(pid, "anim@mp_atm@enter","enter", 1.0) StopAnimTask(ped, "anim@mp_atm@enter","enter", 1.0) SetPedAsNoLongerNeeded(ped) if exports.FCORE_:GetItemQuantity(drugs[drug].id) >= drugs[drug].max then local amount = math.random(drugs[drug].min,drugs[drug].max) local sellamount = math.floor(amount*(math.random(drugs[drug].low,drugs[drug].high))) TriggerServerEvent('drugs:completedSale', sellamount, amount,drugs[drug].id,drugs[drug].name) elseif exports.FCORE_:GetItemQuantity(drugs[drug].id) < drugs[drug].max then local amount = exports.FCORE_:GetItemQuantity(drugs[drug].id) local sellamount = math.floor(amount*(math.random(drugs[drug].low,drugs[drug].high))) TriggerServerEvent('drugs:completedSale', sellamount, amount,drugs[drug].id,drugs[drug].name) end end end end end) Citizen.CreateThread(function() while true do Wait(0) if blah then blah = false selling = false end end end) RegisterNetEvent('currentlySelling') AddEventHandler('currentlySelling', function() selling = true secondsRemaining = 10 end) RegisterNetEvent('cancel') AddEventHandler('cancel', function() --blah = false selling = false secondsRemaining = 0 end) RegisterNetEvent('done') AddEventHandler('done', function() selling = false secondsRemaining = 0 end) -------------------===================HOST============---------------- local dealerspawned = false dealerpos = {x=0,y=0,z=0} local drugdealer = nil local drugped = nil RegisterNetEvent('drug:pedloc') AddEventHandler('drug:pedloc', function(dealer) dealerpos.x = dealer.x dealerpos.y = dealer.y dealerpos.z = dealer.z end) RegisterNetEvent('drug:createped') AddEventHandler('drug:createped', function(dealer) SetPedAsNoLongerNeeded(drugped) ClearPedTasks(drugped) DeletePed(drugped) local hash = GetHashKey(dealer.model) RequestModel(hash) while not HasModelLoaded(hash) do Citizen.Wait(1) end drugdealer = dealer drugped = CreatePed(5, hash, dealer.x, dealer.y, dealer.z-1.0, dealer.h, 0, 0) SetPedKeepTask(drugped, true) Citizen.Wait(1500) dealerspawned = true end) Citizen.CreateThread(function() while true do Citizen.Wait(1000) if drugped then local dealcoords = GetEntityCoords(drugped, true) local dist = GetDistanceBetweenCoords(dealcoords.x,dealcoords.y,dealcoords.z, drugdealer.x, drugdealer.y, drugdealer.z, true) if IsPedFleeing(drugped) or dist > 1.0 then ClearPedTasks(drugped) Citizen.Wait(500) TaskGoToCoordAnyMeans(drugped, dealcoords.x,dealcoords.y,dealcoords.z, 1.0, 0, 0, 786603, 0) end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) local pped = GetPlayerPed(-1) local coords = GetEntityCoords(pped, true) local coords2 = GetEntityCoords(drugped, true) if drugped then local dist4 = GetDistanceBetweenCoords(coords, coords2.x,coords2.y,coords2.z, 1) if dist4 < 1.5 and not IsEntityDead(drugped) then DrawText3d2(coords2.x,coords2.y,coords2.z, "Crack - $1000 [E]") if IsControlJustPressed(0, 38) then Citizen.Wait(3000) TriggerServerEvent('drug:purchasecrack') TaskTurnPedToFaceEntity(pped, drugped, 1000) TaskTurnPedToFaceEntity(drugped, pped, 11000) RequestAnimDict("anim@mp_atm@enter") while (not HasAnimDictLoaded("anim@mp_atm@enter")) do Citizen.Wait(0) end TaskPlayAnim(pped,"anim@mp_atm@enter","enter", 100.0, 200.0, 0.3, 48, 0.2, 0, 0, 0) TaskPlayAnim(drugped,"anim@mp_atm@enter","enter",100.0, 200.0, 0.3, 48, 0.2, 0, 0, 0) Wait(1500) StopAnimTask(pped, "anim@mp_atm@enter","enter", 1.0) StopAnimTask(drugped, "anim@mp_atm@enter","enter", 1.0) end end end local dist6 = GetDistanceBetweenCoords(coords, Antifreeze.x,Antifreeze.y,Antifreeze.z, 1) if dist6 < 1.5 then DrawText3d2(Antifreeze.x,Antifreeze.y,Antifreeze.z, "Antifreeze - $250 [E]") if IsControlJustPressed(0, 38) then TriggerServerEvent('drug:purchaseanti') RequestAnimDict("anim@mp_atm@enter") while (not HasAnimDictLoaded("anim@mp_atm@enter")) do Citizen.Wait(0) end TaskPlayAnim(pped,"anim@mp_atm@enter","enter", 100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) Wait(1500) StopAnimTask(pped, "anim@mp_atm@enter","enter", 1.0) end end local dist7 = GetDistanceBetweenCoords(coords, Sudafed.x,Sudafed.y,Sudafed.z, 1) if dist7 < 1.5 then DrawText3d2(Sudafed.x,Sudafed.y,Sudafed.z, "Sudafed - $250 [E]") if IsControlJustPressed(0, 38) then TriggerServerEvent('drug:purchasesuda') RequestAnimDict("anim@mp_atm@enter") while (not HasAnimDictLoaded("anim@mp_atm@enter")) do Citizen.Wait(0) end TaskPlayAnim(pped,"anim@mp_atm@enter","enter", 100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) Wait(1500) StopAnimTask(pped, "anim@mp_atm@enter","enter", 1.0) end end local dist8 = GetDistanceBetweenCoords(coords, Acetone.x,Acetone.y,Acetone.z, 1) if dist8 < 1.5 then DrawText3d2(Acetone.x,Acetone.y,Acetone.z, "Acetone - $250 [E]") if IsControlJustPressed(0, 38) then TriggerServerEvent('drug:purchaseacetone') RequestAnimDict("anim@mp_atm@enter") while (not HasAnimDictLoaded("anim@mp_atm@enter")) do Citizen.Wait(0) end TaskPlayAnim(pped,"anim@mp_atm@enter","enter", 100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) Wait(1500) StopAnimTask(pped, "anim@mp_atm@enter","enter", 1.0) end end local dist9 = GetDistanceBetweenCoords(coords, Redp.x,Redp.y,Redp.z, 1) if dist9 < 1.5 then DrawText3d2(Redp.x,Redp.y,Redp.z, "Red Phosphorus - $250 [E]") if IsControlJustPressed(0, 38) then TriggerServerEvent('drug:purchaseredp') RequestAnimDict("anim@mp_atm@enter") while (not HasAnimDictLoaded("anim@mp_atm@enter")) do Citizen.Wait(0) end TaskPlayAnim(pped,"anim@mp_atm@enter","enter", 100.0, 200.0, 0.3, 20, 0.2, 0, 0, 0) Wait(1500) StopAnimTask(pped, "anim@mp_atm@enter","enter", 1.0) end end end end) ---------------===================================================-------------------- male_models = {'mp_m_freemode_01','csb_chef2','csb_money','csb_popov','csb_rashcosvki','csb_agent','csb_avon','csb_alan','csb_bryony','ig_sacha','csb_dix','csb_djblamadon','csb_englishdave','csb_sol','csb_talcc','csb_tonyprince','ig_malc','mp_f_chbar_01','a_m_m_afriamer_01','a_m_m_beach_01','a_m_m_beach_02','a_m_m_bevhills_01','u_m_y_smugmech_01','s_m_m_ccrew_01','u_m_m_doa_01','u_m_m_edtoh','a_m_y_clubcust_01','a_m_y_clubcust_02','a_m_y_clubcust_03','a_m_m_bevhills_02','a_m_y_clubcust_01','a_m_y_clubcust_02','a_m_y_clubcust_03','mp_m_cocaine_01','mp_m_weed_01','s_m_y_xmech_02_mp','csb_bogdan','mp_m_avongoon','mp_m_weapexp_01','mp_m_weapwork_01','a_m_m_business_01','a_m_m_eastsa_01','a_m_m_eastsa_02','a_m_m_farmer_01','mp_m_counterfeit_01','mp_m_forgery_01','mp_m_bogdangoon','mp_m_meth_01','a_m_m_fatlatin_01','a_m_m_genfat_01','a_m_m_genfat_02','a_m_m_golfer_01','a_m_m_hasjew_01','a_m_m_hillbilly_01','a_m_m_hillbilly_02','a_m_m_indian_01','a_m_m_ktown_01','a_m_m_malibu_01','a_m_m_mexcntry_01','a_m_m_mexlabor_01','a_m_m_og_boss_01','a_m_m_paparazzi_01','a_m_m_polynesian_01','a_m_m_prolhost_01','a_m_m_rurmeth_01','a_m_m_salton_01','a_m_m_salton_02','a_m_m_salton_03','a_m_m_salton_04','a_m_m_skater_01','a_m_m_skidrow_01','a_m_m_socenlat_01','a_m_m_soucent_01','a_m_m_soucent_02','a_m_m_soucent_03','a_m_m_soucent_04','a_m_m_stlat_02','a_m_m_tennis_01','a_m_m_tourist_01','a_m_m_trampbeac_01','a_m_m_tramp_01','a_m_m_tranvest_01','a_m_m_tranvest_02','a_m_o_acult_01','a_m_o_acult_02','a_m_o_beach_01','a_m_o_genstreet_01','a_m_o_ktown_01','a_m_o_salton_01','a_m_o_soucent_01','a_m_o_soucent_02','a_m_o_soucent_03','a_m_o_tramp_01','a_m_y_acult_01','a_m_y_acult_02','a_m_y_beachvesp_01','a_m_y_beachvesp_02','a_m_y_beach_01','a_m_y_beach_02','a_m_y_beach_03','a_m_y_bevhills_01','a_m_y_bevhills_02','a_m_y_breakdance_01','a_m_y_busicas_01','a_m_y_business_01','a_m_y_business_02','a_m_y_business_03','a_m_y_cyclist_01','a_m_y_dhill_01','a_m_y_downtown_01','a_m_y_eastsa_01','a_m_y_eastsa_02','a_m_y_epsilon_01','a_m_y_epsilon_02','a_m_y_gay_01','a_m_y_gay_02','a_m_y_genstreet_01','a_m_y_genstreet_02','a_m_y_golfer_01','a_m_y_hasjew_01','a_m_y_hiker_01','a_m_y_hippy_01','a_m_y_hipster_01','a_m_y_hipster_02','a_m_y_hipster_03','a_m_y_indian_01','a_m_y_jetski_01','a_m_y_juggalo_01','a_m_y_ktown_01','a_m_y_ktown_02','a_m_y_latino_01','a_m_y_methhead_01','a_m_y_mexthug_01','a_m_y_motox_01','a_m_y_motox_02','a_m_y_musclbeac_01','a_m_y_musclbeac_02','a_m_y_polynesian_01','a_m_y_roadcyc_01','a_m_y_runner_01','a_m_y_runner_02','a_m_y_salton_01','a_m_y_skater_01','a_m_y_skater_02','a_m_y_soucent_01','a_m_y_soucent_02','a_m_y_soucent_03','a_m_y_soucent_04','a_m_y_stbla_01','a_m_y_stbla_02','a_m_y_stlat_01','a_m_y_stwhi_01','a_m_y_stwhi_02','a_m_y_sunbathe_01','a_m_y_surfer_01','a_m_y_vindouche_01','a_m_y_vinewood_01','a_m_y_vinewood_02','a_m_y_vinewood_03','a_m_y_vinewood_04','a_m_y_yoga_01','csb_anton','csb_ballasog','csb_burgerdrug','csb_car3guy1','csb_car3guy2','csb_chef','csb_chin_goon','csb_cletus', 'csb_customer', 'csb_fos_rep', 'csb_g', 'csb_groom', 'csb_grove_str_dlr', 'csb_hao', 'csb_hugh', 'csb_imran', 'csb_janitor', 'csb_ortega', 'csb_oscar', 'csb_porndudes', 'csb_prologuedriver', 'csb_ramp_gang', 'csb_ramp_hic', 'csb_ramp_hipster', 'csb_ramp_mex', 'csb_reporter', 'csb_roccopelosi', 'csb_trafficwarden','cs_bankman', 'cs_barry', 'cs_beverly', 'cs_brad', 'cs_carbuyer', 'cs_chengsr', 'cs_chrisformage', 'cs_clay', 'cs_dale', 'cs_davenorton', 'cs_devin', 'cs_dom', 'cs_dreyfuss', 'cs_drfriedlander', 'cs_fabien', 'cs_floyd', 'cs_hunter', 'cs_jimmyboston', 'cs_jimmydisanto', 'cs_joeminuteman', 'cs_johnnyklebitz', 'cs_josef', 'cs_josh', 'cs_lazlow', 'cs_lestercrest', 'cs_lifeinvad_01', 'cs_manuel', 'cs_martinmadrazo', 'cs_milton', 'cs_movpremmale', 'cs_mrk', 'cs_nervousron', 'cs_nigel', 'cs_old_man1a', 'cs_old_man2', 'cs_omega', 'cs_orleans', 'cs_paper', 'cs_priest', 'cs_prolsec_02', 'cs_russiandrunk', 'cs_siemonyetarian', 'cs_solomon', 'cs_stevehains', 'cs_stretch', 'cs_taocheng', 'cs_taostranslator', 'cs_tenniscoach', 'cs_terry', 'cs_tom', 'cs_tomepsilon', 'cs_wade', 'cs_zimbor', 'g_m_m_armboss_01','g_m_m_armgoon_01','g_m_m_armlieut_01','g_m_m_chemwork_01','g_m_m_chiboss_01','g_m_m_chicold_01','g_m_m_chigoon_01','g_m_m_chigoon_02','g_m_m_korboss_01','g_m_m_mexboss_01','g_m_m_mexboss_02','g_m_y_armgoon_02','g_m_y_azteca_01','g_m_y_ballaeast_01','g_m_y_ballaorig_01','g_m_y_ballasout_01','g_m_y_famca_01','g_m_y_famdnf_01','g_m_y_famfor_01','g_m_y_korean_01','g_m_y_korean_02','g_m_y_korlieut_01','g_m_y_lost_01','g_m_y_lost_02','g_m_y_lost_03','g_m_y_mexgang_01','g_m_y_mexgoon_01','g_m_y_mexgoon_02','g_m_y_mexgoon_03','g_m_y_pologoon_01','g_m_y_pologoon_02','g_m_y_salvaboss_01','g_m_y_salvagoon_01','g_m_y_salvagoon_02','g_m_y_salvagoon_03','g_m_y_strpunk_01','g_m_y_strpunk_02','hc_driver', 'hc_gunman', 'hc_hacker', 's_m_m_ammucountry','s_m_m_autoshop_01','s_m_m_autoshop_02','s_m_m_bouncer_01','s_m_m_ciasec_01','s_m_m_cntrybar_01','s_m_m_dockwork_01','s_m_m_doctor_01','s_m_m_fiboffice_02','s_m_m_gaffer_01','s_m_m_gardener_01','s_m_m_gentransport','s_m_m_hairdress_01','s_m_m_highsec_01','s_m_m_highsec_02','s_m_m_janitor','s_m_m_lathandy_01','s_m_m_lifeinvad_01','s_m_m_linecook','s_m_m_lsmetro_01','s_m_m_mariachi_01','s_m_m_migrant_01','s_m_m_movprem_01','s_m_m_movspace_01','s_m_m_pilot_01','s_m_m_pilot_02','s_m_m_postal_01','s_m_m_postal_02','s_m_m_scientist_01','s_m_m_strperf_01','s_m_m_strpreach_01','s_m_m_strvend_01','s_m_m_trucker_01','s_m_m_ups_01','s_m_m_ups_02','s_m_o_busker_01','s_m_y_airworker','s_m_y_ammucity_01','s_m_y_armymech_01','s_m_y_autopsy_01','s_m_y_barman_01','s_m_y_baywatch_01','s_m_y_busboy_01','s_m_y_chef_01','s_m_y_clown_01','s_m_y_construct_01','s_m_y_construct_02','s_m_y_dealer_01','s_m_y_devinsec_01','s_m_y_dockwork_01','s_m_y_dwservice_01','s_m_y_dwservice_02','s_m_y_factory_01','s_m_y_garbage','s_m_y_grip_01','s_m_y_mime','s_m_y_pestcont_01','s_m_y_pilot_01','s_m_y_prismuscl_01','s_m_y_prisoner_01','s_m_y_robber_01','s_m_y_shop_mask','s_m_y_strvend_01','s_m_y_uscg_01','s_m_y_valet_01','s_m_y_waiter_01','s_m_y_winclean_01','s_m_y_xmech_01','s_m_y_xmech_02','u_m_m_aldinapoli','u_m_m_bankman','u_m_m_bikehire_01','u_m_m_fibarchitect','u_m_m_filmdirector','u_m_m_glenstank_01','u_m_m_griff_01','u_m_m_jesus_01','u_m_m_jewelsec_01','u_m_m_jewelthief','u_m_m_markfost','u_m_m_partytarget','u_m_m_promourn_01','u_m_m_rivalpap','u_m_m_spyactor','u_m_m_willyfist','u_m_o_finguru_01','u_m_o_taphillbilly','u_m_o_tramp_01','u_m_y_abner','u_m_y_antonb','u_m_y_babyd','u_m_y_baygor','u_m_y_burgerdrug_01','u_m_y_chip','u_m_y_cyclist_01','u_m_y_fibmugger_01','u_m_y_guido_01','u_m_y_gunvend_01','u_m_y_hippie_01','u_m_y_imporage','u_m_y_justin','u_m_y_mani','u_m_y_militarybum','u_m_y_paparazzi','u_m_y_party_01','u_m_y_pogo_01','u_m_y_prisoner_01','u_m_y_proldriver_01','u_m_y_rsranger_01','u_m_y_sbike','u_m_y_staggrm_01','u_m_y_tattoo_01'} female_models = {'mp_f_freemode_01','a_f_y_femaleagent','a_f_m_beach_01','csb_paige','a_f_m_bevhills_01','a_f_m_bevhills_02','a_f_m_bodybuild_01','a_f_m_business_02','a_f_m_downtown_01','a_f_m_eastsa_01','mp_f_bennymech_01','a_f_m_eastsa_02','a_f_m_fatbla_01','mp_f_cocaine_01','mp_f_counterfeit_01','a_f_m_fatcult_01','a_f_m_fatwhite_01','a_f_m_ktown_01','a_f_m_ktown_02','a_f_m_prolhost_01','a_f_m_salton_01','a_f_m_skidrow_01','mp_f_forgery_01','mp_f_meth_01','mp_f_weed_01','a_f_m_soucentmc_01','mp_f_helistaff_01','a_f_m_soucent_01','a_f_m_soucent_02','a_f_m_tourist_01','a_f_m_trampbeac_01','a_f_m_tramp_01','a_f_o_genstreet_01','a_f_o_indian_01','a_f_o_ktown_01','a_f_o_salton_01','a_f_o_soucent_01','a_f_o_soucent_02','a_f_y_beach_01','a_f_y_bevhills_01','a_f_y_bevhills_02','a_f_y_bevhills_03','a_f_y_bevhills_04','a_f_y_business_01','a_f_y_business_02','a_f_y_business_03','a_f_y_business_04','a_f_y_eastsa_01','a_f_y_eastsa_02','a_f_y_eastsa_03','a_f_y_epsilon_01','a_f_y_fitness_01','a_f_y_fitness_02','a_f_y_genhot_01','a_f_y_golfer_01','a_f_y_hiker_01','a_f_y_hippie_01','a_f_y_hipster_01','a_f_y_hipster_02','a_f_y_hipster_03','a_f_y_hipster_04','a_f_y_indian_01','a_f_y_juggalo_01','a_f_y_runner_01','a_f_y_rurmeth_01','a_f_y_scdressy_01','a_f_y_skater_01','a_f_y_soucent_01','a_f_y_soucent_02','a_f_y_soucent_03','a_f_y_tennis_01','a_f_y_topless_01','a_f_y_tourist_01','a_f_y_tourist_02','a_f_y_vinewood_01','a_f_y_vinewood_02','a_f_y_vinewood_03','a_f_y_vinewood_04','a_f_y_yoga_01','cs_tracydisanto','cs_tanisha', 'cs_patricia', 'cs_mrsphillips', 'cs_mrs_thornhill', 'cs_natalia', 'cs_molly', 'cs_movpremf_01', 'cs_maryann', 'cs_michelle', 'cs_marnie', 'cs_magenta', 'cs_janet', 'cs_jewelass', 'cs_guadalope', 'cs_gurk', 'cs_debra', 'cs_denise', 'cs_amandatownley', 'cs_ashley', 'csb_screen_writer', 'csb_stripper_01', 'csb_stripper_02', 'csb_tonya', 'csb_maude', 'csb_denise_friend', 'csb_abigail', 'csb_anita', 'g_f_y_ballas_01','g_f_y_families_01','g_f_y_lost_01','g_f_y_vagos_01','s_f_m_fembarber','s_f_m_maid_01','s_f_m_shop_high','s_f_m_sweatshop_01','s_f_y_airhostess_01','s_f_y_bartender_01','s_f_y_baywatch_01','s_f_y_factory_01','s_f_y_hooker_01','s_f_y_hooker_02','s_f_y_hooker_03','s_f_y_migrant_01','s_f_y_movprem_01','s_f_y_shop_low','s_f_y_shop_mid','s_f_y_stripperlite','s_f_y_stripper_01','s_f_y_stripper_02','s_f_y_sweatshop_01','u_f_m_corpse_01','u_f_m_miranda','u_f_m_promourn_01','u_f_o_moviestar','u_f_o_prolhost_01','u_f_y_bikerchic','u_f_y_comjane','u_f_y_hotposh_01','u_f_y_jewelass_01','u_f_y_mistress','u_f_y_poppymich','u_f_y_princess','u_f_y_spyactress'} function getgender() ped = GetPlayerPed(-1) for k,v in pairs(male_models) do if IsPedModel(ped, v) then return "Male" end end for k,v in pairs(female_models) do if IsPedModel(ped, v) then return "Female" end end return "Individual" end RegisterNetEvent('notifycops') AddEventHandler('notifycops', function(alert) if CheckIfPlayerIsOfficer() then TriggerEvent('chatMessage', alert) PlaySoundFrontend(-1, "TENNIS_MATCH_POINT", "HUD_AWARDS", 1); end end) function CheckIfPlayerIsOfficer() isPoliceInService = exports.policejob:getIsInService() if isPoliceInService then return true end return false end local blipGunTime = 300 --in second RegisterNetEvent('cds:callPlace') AddEventHandler('cds:callPlace', function(gx, gy, gz, blip) if CheckIfPlayerIsOfficer() then local transG = 255 local randomX = RandomXCoord(gx) -- so the blip isnt in the exact location local randomY = RandomYCoord(gy) -- / local gunshotBlip = AddBlipForCoord(randomX, randomY, gz) local blipExists = true SetBlipSprite(gunshotBlip, blip) SetBlipColour(gunshotBlip, 4) SetBlipScale(gunshotBlip, 0.8) SetBlipAlpha(gunshotBlip, transG) SetBlipAsShortRange(gunshotBlip, 1) BeginTextCommandSetBlipName("STRING") AddTextComponentString("CDS Complaint") EndTextCommandSetBlipName(gunshotBlip) while DoesBlipExist(gunshotBlip) do --]] -- [[ If cop arrives on scene, delete the blip ]] -- local plyPos = GetEntityCoords(GetPlayerPed(-1), true) local dist = 30 -- Distance the cop needs to be from the blip for it to delete local minX = randomX - dist; local maxX = randomX + dist; local minY = randomY - dist; local maxY = randomY + dist; if plyPos.x > minX and plyPos.x < maxX and plyPos.y > minY and plyPos.y < maxY then RemoveBlip(gunshotBlip) -- Will only remove for this officer.. hence client side. Could make it delete for all cops in the future but unsure if theres any point seems it has a timer anyway return end -- [[ Fade out if timer is over, delete the blip ]] -- Wait(blipGunTime * 10) transG = transG - 1 SetBlipAlpha(gunshotBlip, transG) if transG == 0 then --SetBlipSprite(gunshotBlip, 2) RemoveBlip(gunshotBlip) return end end end end) function RandomXCoord(inx) -- X local randx = inx local dir = math.random(0, 10) local amt = math.random(0, 40) if dir <= 5 then randx = inx + amt else randx = inx - amt end return randx end function RandomYCoord(iny) -- Y local randy = iny local dir = math.random(0, 10) local amt = math.random(0, 40) if dir <= 5 then randy = iny + amt else randy = iny - amt end return randy end ---------------===================================================-------------------- --============================================-- --------------------Weed Farm------------------- --============================================-- BikerWeedFarm = exports['bob74']:GetBikerWeedFarmObject() weedprocess = { {x=1038.5960693359, y=-3205.9948730469, z=-37.283699035645}, {x=1036.4748535156, y=-3202.6831054688, z=-37.283740997314}, {x=1033.5157470703, y=-3202.6848144531, z=-37.283744812012}, {x=1033.7711181641, y=-3205.8203125, z=-37.283706665039}, } weedseeds = {x=2243.2963867188, y=5154.1323242188, z=57.887153625488} weedseeds2 = {x = 2225.64, y = 5577.001, z = 53.801} weedplants = { Plant1 = { {x=1052.6169433594, y=-3197.6105957031, z=-38.909752655029, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.0179443359, y=-3197.6701660156, z=-38.908058929443, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1049.939453125, y=-3197.3020019531, z=-38.931065368652, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1050.0242919922, y=-3195.7941894531, z=-38.940705108643, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.2724609375, y=-3196.1962890625, z=-38.907913970947, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1052.9504394531, y=-3195.9235839844, z=-38.908226776123, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1052.6221923828, y=-3194.3898925781, z=-38.907677459717, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.2758789063, y=-3194.7385253906, z=-38.907635498047, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1049.8983154297, y=-3194.6057128906, z=-38.940544891357, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant2 = { {x=1052.6291503906, y=-3192.6379394531, z=-38.98135990708, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.2618408203, y=-3192.86328125, z=-38.95812530518, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1050.0910644531, y=-3192.6052246094, z=-38.96235351995, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1050.3132324219, y=-3190.5676269531, z=-38.96044616699, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.6303710938, y=-3190.9497070313, z=-38.95549316406, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1053.0567626953, y=-3190.9497070313, z=-38.96109466553, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1053.0821533203, y=-3189.3564453125, z=-38.96201019287, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.6389160156, y=-3189.6286621094, z=-38.93992919922, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1050.3519287109, y=-3189.4418945313, z=-38.96315460205, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1050.0595703125, y=-3187.9423828125, z=-38.96086578369, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.6820068359, y=-3188.1418457031, z=-38.95465393066, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1052.7296142578, y=-3187.9423828125, z=-38.96487121582, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant3 = { {x=1054.8768310547, y=-3191.2443847656, z=-38.9616506958, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1054.83203125, y=-3189.7116699219, z=-38.9615629564, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1055.0251464844, y=-3188.1481933594, z=-38.9615476989, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1056.3240966797, y=-3188.7456054688, z=-38.9614141845, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1056.7523193359, y=-3190.2287597656, z=-38.9616278076, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1056.2033691406, y=-3191.8410644531, z=-38.9610861206, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.0378417969, y=-3191.5874023438, z=-38.9611547851, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.1390380859, y=-3189.7719726563, z=-38.9614256286, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1057.9561767578, y=-3188.064453125, z=-38.9612959289, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant4 = { {x=1061.5947265625, y=-3191.8093261719, z=-38.922581481934, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1062.9862060547, y=-3192.2824707031, z=-38.920273590088, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.5942382813, y=-3191.8388671875, z=-38.921551513672, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.7939453125, y=-3193.3793945313, z=-38.921257781982, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.6485595703, y=-3195.2485351563, z=-38.921170043945, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1062.6690673828, y=-3195.2216796875, z=-38.921334075928, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1063.0106201172, y=-3193.8234863281, z=-38.921654510498, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1061.3489990234, y=-3193.2670898438, z=-38.921528625488, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1061.4544677734, y=-3194.7917480469, z=-38.920822906494, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant5 = { {x=1061.4580078125, y=-3197.1013183594, z=-38.9215400695, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1062.9342041016, y=-3197.0334472656, z=-38.9214675903, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.6311035156, y=-3196.5678710938, z=-38.9214485168, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.1424560547, y=-3198.20703125, z=-38.9214485846, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1062.8364257813, y=-3198.4421386719, z=-38.9213912963, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1061.2736816406, y=-3198.5981445313, z=-38.9214065551, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1061.5974121094, y=-3200.330078125, z=-38.9215095200, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1062.9544677734, y=-3200.041015625, z=-38.9214065517, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.7447509766, y=-3199.5458984375, z=-38.9224403381, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant6 = { {x=1062.1657714844, y=-3201.4938964844, z=-38.916689300, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1063.2780761719, y=-3201.5485839844, z=-38.925492095, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.7111816406, y=-3201.8913574219, z=-38.916494750, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.9494628906, y=-3203.4365234375, z=-38.916311645, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1063.2640380859, y=-3203.2683105469, z=-38.925469207, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1061.8303222656, y=-3202.958984375, z=-38.917166137, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1062.02734375, y=-3204.8598632813, z=-38.916838073, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1063.6068115234, y=-3205.1181640625, z=-38.925537872, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.7870117188, y=-3205.0554199219, z=-38.942533874, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1064.9722900391, y=-3206.556640625, z=-38.915827789, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1063.1013183594, y=-3206.7023925781, z=-38.929905700, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1061.7995605469, y=-3206.3090820313, z=-38.917459869, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant7 = { {x=1060.1239013672, y=-3204.8508300781, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1059.9615478516, y=-3205.8837890625, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1059.8968505859, y=-3207.5903320313, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.2490234375, y=-3207.5483398438, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.3972167969, y=-3205.8203125, z=-38.954, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.4697265625, y=-3204.5354003906, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1057.0518798828, y=-3204.6672363281, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1056.5911865234, y=-3205.7377929688, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1056.8525390625, y=-3207.4064941406, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1054.9575195313, y=-3207.2631835938, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1054.8497314453, y=-3205.5256347656, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1055.2828369141, y=-3204.552734375, z=-38.9165, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant8 = { {x=1056.0404052734, y=-3201.7446289063, z=-38.95609131, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1057.4138183594, y=-3202.2541503906, z=-38.90692139, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.7579345703, y=-3201.7048339844, z=-38.91691895, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.5805664063, y=-3199.7521972656, z=-38.98538818, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1057.5319824219, y=-3200.0310058594, z=-38.99273682, z=-38.954, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1055.8990478516, y=-3200.6196289063, z=-38.98754883, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1056.1337890625, y=-3199.0322265625, z=-38.98428955, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1056.0944824219, y=-3197.4018554688, z=-38.95866699, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1057.2664794922, y=-3198.4411621094, z=-38.94666748, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1058.7286376953, y=-3198.1330566406, z=-38.91367188, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, Plant9 = { {x=1052.8745117188, y=-3207.1850585938, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.3940429688, y=-3206.8347167969, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1050.1926269531, y=-3207.1103515625, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1049.7918701172, y=-3205.3103027344, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.1790771484, y=-3205.2277832031, z=-38.954, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1053.1231689453, y=-3205.7370605469, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1053.0848388672, y=-3200.7954101563, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.4738769531, y=-3200.5397949219, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1049.8394775391, y=-3200.5998535156, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1050.1252441406, y=-3198.8903808594, z=-38.916, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1051.5939941406, y=-3199.5029296875, z=-38.925, stage = 0, hydration = 0, strain = "normal", timer = 0}, {x=1053.3016357422, y=-3199.0937534667, z=-38.915, stage = 0, hydration = 0, strain = "normal", timer = 0}, }, } RegisterNetEvent('loadweed') AddEventHandler('loadweed', function(data) weedplants = json.decode(data) end) water = {x=1054.2655029297, y=-3187.1943359375, z=-39.161468505859} local inweedfarm = false Citizen.CreateThread(function() while true do Citizen.Wait(10000) -- 12000 if inweedfarm then for k2,v2 in pairs(weedplants) do for k,v in pairs(v2) do if v.hydration > 0 and v.timer < 100 and v.stage > 0 then v.timer = v.timer + 1 elseif v.timer == 100 and v.stage == 1 then v.hydration = 0 v.timer = 0 v.stage = 2 if k2 == "Plant1" and p1stage ~= "medium" then BikerWeedFarm.Plant1.Set(BikerWeedFarm.Plant1.Stage.medium, BikerWeedFarm.Plant1.Light.basic) p1stage = "medium" elseif k2 == "Plant2" and p2stage ~= "medium" then BikerWeedFarm.Plant2.Set(BikerWeedFarm.Plant2.Stage.medium, BikerWeedFarm.Plant2.Light.basic) p2stage = "medium" elseif k2 == "Plant3" and p3stage ~= "medium" then BikerWeedFarm.Plant3.Set(BikerWeedFarm.Plant3.Stage.medium, BikerWeedFarm.Plant3.Light.basic) p3stage = "medium" elseif k2 == "Plant4" and p4stage ~= "medium" then BikerWeedFarm.Plant4.Set(BikerWeedFarm.Plant4.Stage.medium, BikerWeedFarm.Plant4.Light.basic) p4stage = "medium" elseif k2 == "Plant5" and p5stage ~= "medium" then BikerWeedFarm.Plant5.Set(BikerWeedFarm.Plant5.Stage.medium, BikerWeedFarm.Plant5.Light.basic) p5stage = "medium" elseif k2 == "Plant6" and p6stage ~= "medium" then BikerWeedFarm.Plant6.Set(BikerWeedFarm.Plant6.Stage.medium, BikerWeedFarm.Plant6.Light.basic) p6stage = "medium" elseif k2 == "Plant7" and p7stage ~= "medium" then BikerWeedFarm.Plant7.Set(BikerWeedFarm.Plant7.Stage.medium, BikerWeedFarm.Plant7.Light.basic) p7stage = "medium" elseif k2 == "Plant8" and p2stage ~= "medium" then BikerWeedFarm.Plant8.Set(BikerWeedFarm.Plant8.Stage.medium, BikerWeedFarm.Plant8.Light.basic) p8stage = "medium" elseif k2 == "Plant9" and p9stage ~= "medium" then BikerWeedFarm.Plant9.Set(BikerWeedFarm.Plant9.Stage.medium, BikerWeedFarm.Plant9.Light.basic) p9stage = "medium" end elseif v.timer == 100 and v.stage == 2 then v.hydration = 0 v.timer = 0 v.stage = 3 if k2 == "Plant1" and p1stage ~= "full" then BikerWeedFarm.Plant1.Set(BikerWeedFarm.Plant1.Stage.full, BikerWeedFarm.Plant1.Light.basic) p1stage = "full" elseif k2 == "Plant2" and p2stage ~= "full" then BikerWeedFarm.Plant2.Set(BikerWeedFarm.Plant2.Stage.full, BikerWeedFarm.Plant2.Light.basic) p2stage = "full" elseif k2 == "Plant3" and p3stage ~= "full" then BikerWeedFarm.Plant3.Set(BikerWeedFarm.Plant3.Stage.full, BikerWeedFarm.Plant3.Light.basic) p3stage = "full" elseif k2 == "Plant4" and p4stage ~= "full" then BikerWeedFarm.Plant4.Set(BikerWeedFarm.Plant4.Stage.full, BikerWeedFarm.Plant4.Light.basic) p4stage = "full" elseif k2 == "Plant5" and p5stage ~= "full" then BikerWeedFarm.Plant5.Set(BikerWeedFarm.Plant5.Stage.full, BikerWeedFarm.Plant5.Light.basic) p5stage = "full" elseif k2 == "Plant6" and p6stage ~= "full" then BikerWeedFarm.Plant6.Set(BikerWeedFarm.Plant6.Stage.full, BikerWeedFarm.Plant6.Light.basic) p6stage = "full" elseif k2 == "Plant7" and p7stage ~= "full" then BikerWeedFarm.Plant7.Set(BikerWeedFarm.Plant7.Stage.full, BikerWeedFarm.Plant7.Light.basic) p7stage = "full" elseif k2 == "Plant8" and p2stage ~= "full" then BikerWeedFarm.Plant8.Set(BikerWeedFarm.Plant8.Stage.full, BikerWeedFarm.Plant8.Light.basic) p8stage = "full" elseif k2 == "Plant9" and p9stage ~= "full" then BikerWeedFarm.Plant9.Set(BikerWeedFarm.Plant9.Stage.full, BikerWeedFarm.Plant9.Light.basic) p9stage = "full" end end end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(60000) if inweedfarm then TriggerServerEvent('saveweed', weedplants) end end end) Citizen.CreateThread(function() while true do Citizen.Wait(5000) if inweedfarm then for k2,v2 in pairs(weedplants) do for k,v in pairs(v2) do if v.hydration > 0 and v.timer < 100 then v.hydration = v.hydration - 1 end end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) if inweedfarm then local ped = GetPlayerPed(-1) local coords = GetEntityCoords(ped, true) local dist2 = GetDistanceBetweenCoords(coords, water.x,water.y,water.z, 1) if dist2 < 50.0 then DisablePlayerFiring(ped, true) end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) if inweedfarm then local ped = GetPlayerPed(-1) local coords = GetEntityCoords(ped, true) local dist2 = GetDistanceBetweenCoords(coords, water.x,water.y,water.z, 1) if dist2 < 1.0 then if IsControlPressed(0, 38) then for k2,v2 in pairs(weedplants) do for k,v in pairs(v2) do if v.hydration < 100 and v.stage > 0 then v.hydration = v.hydration + 1 end end end Citizen.Wait(250) end end end end end) local p1stage = nil local p2stage = nil local p3stage = nil local p4stage = nil local p5stage = nil local p6stage = nil local p7stage = nil local p8stage = nil local p9stage = nil Citizen.CreateThread(function() while true do Citizen.Wait(0) local ped = GetPlayerPed(-1) local coords = GetEntityCoords(ped, true) local dist4 = GetDistanceBetweenCoords(coords, weedseeds.x,weedseeds.y,weedseeds.z, 1) if dist4 < 1.5 then DrawText3d2(weedseeds.x,weedseeds.y,weedseeds.z, "Seed Exchange [E]") if exports.FCORE_:GetItemQuantity(148) >= 1 and IsControlJustPressed(0, 38) then local quantity = math.random(3,6) TriggerEvent("inventory:removeQty", 148, 1) TriggerEvent("inventory:addQty", 146, quantity) RequestAnimDict("mp_weapons_deal_sting") while (not HasAnimDictLoaded("mp_weapons_deal_sting")) do Citizen.Wait(0) end TaskPlayAnim(GetPlayerPed(-1),"mp_weapons_deal_sting","crackhead_bag_loop", 1.0, 1.0, 5.0, 20, 0.2, 0, 0, 0) Citizen.Wait(5000) elseif exports.FCORE_:GetItemQuantity(149) >= 1 and IsControlJustPressed(0, 38) then local quantity = math.random(1,2) TriggerEvent("inventory:removeQty", 149, 1) TriggerEvent("inventory:addQty", 147, quantity) RequestAnimDict("mp_weapons_deal_sting") while (not HasAnimDictLoaded("mp_weapons_deal_sting")) do Citizen.Wait(0) end TaskPlayAnim(GetPlayerPed(-1),"mp_weapons_deal_sting","crackhead_bag_loop", 1.0, 1.0, 5.0, 20, 0.2, 0, 0, 0) Citizen.Wait(5000) end end local dist5 = GetDistanceBetweenCoords(coords, weedseeds2.x,weedseeds2.y,weedseeds2.z, 1) if dist5 < 5.0 then if IsControlJustPressed(0, 38) then TaskStartScenarioInPlace(GetPlayerPed(-1), "world_human_gardener_plant", 0, 1) Citizen.Wait(1000) ClearPedTasks(ped) Citizen.Wait(3000) local chance = math.random(1,100) if chance < 10 then TriggerEvent("inventory:addQty", 146, 1) Notify("Found a seed.") end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) if inweedfarm then local ped = GetPlayerPed(-1) local coords = GetEntityCoords(ped, true) local dist2 = GetDistanceBetweenCoords(coords, water.x,water.y,water.z, 1) if dist2 < 5 then DrawText3d2(water.x,water.y,water.z, "Water Valve [E]") end for k3,v3 in pairs(weedprocess) do local dist3 = GetDistanceBetweenCoords(coords, v3.x,v3.y,v3.z, 1) if dist3 < 1.8 then DrawText3d2(v3.x,v3.y,v3.z, "Process Plants [E]") if exports.FCORE_:GetItemQuantity(148) >= 1 and IsControlJustPressed(0, 38) then TriggerEvent("inventory:removeQty", 148, 1) TriggerEvent("inventory:addQty", 150, 1) RequestAnimDict("mp_weapons_deal_sting") while (not HasAnimDictLoaded("mp_weapons_deal_sting")) do Citizen.Wait(0) end TaskPlayAnim(GetPlayerPed(-1),"mp_weapons_deal_sting","crackhead_bag_loop", 1.0, 1.0, 5.0, 20, 0.2, 0, 0, 0) Citizen.Wait(5000) elseif exports.FCORE_:GetItemQuantity(149) >= 1 and IsControlJustPressed(0, 38) then TriggerEvent("inventory:removeQty", 149, 1) TriggerEvent("inventory:addQty", 151, 1) RequestAnimDict("mp_weapons_deal_sting") while (not HasAnimDictLoaded("mp_weapons_deal_sting")) do Citizen.Wait(0) end TaskPlayAnim(GetPlayerPed(-1),"mp_weapons_deal_sting","crackhead_bag_loop", 1.0, 1.0, 5.0, 20, 0.2, 0, 0, 0) Citizen.Wait(5000) end end end for k2,v2 in pairs(weedplants) do for k,v in pairs(v2) do local dist = GetDistanceBetweenCoords(coords, v.x, v.y, v.z, 1) if dist < 10.0 then --DrawText3d2(v.x,v.y,v.z, tostring("[E]")) if v.stage > 0 and not (v.stage == 3 and v.timer == 100) then Percent3D(v.hydration,v.x,v.y,v.z,0.07,.02,100,100,100,100,0,100,155,100) Percent3D(v.timer,v.x,v.y,v.z-0.09,0.07,.02,100,100,100,100,100,250,0,100) elseif v.stage == 3 and v.timer == 100 then DrawText3d2(v.x,v.y,v.z, "Harvest [E]") elseif v.stage == 0 then DrawText3d2(v.x,v.y,v.z-.55, "Plant [E]") end if dist < 0.9 then if IsControlJustPressed(0, 38) then if v.stage == 0 then local hasseeds = false if exports.FCORE_:GetItemQuantity(146) >= 1 then v.strain = "normal" hasseeds = true TriggerEvent("inventory:removeQty", 146, 1) elseif exports.FCORE_:GetItemQuantity(147) >= 1 then v.strain = "premium" hasseeds = true TriggerEvent("inventory:removeQty", 147, 1) end if hasseeds then TaskStartScenarioInPlace(GetPlayerPed(-1), "world_human_gardener_plant", 0, 1) Citizen.Wait(1000) ClearPedTasks(GetPlayerPed(-1)) Citizen.Wait(3000) v.stage = 1 if k2 == "Plant1" and p1stage ~= "small" then BikerWeedFarm.Plant1.Set(BikerWeedFarm.Plant1.Stage.small, BikerWeedFarm.Plant1.Light.basic) p1stage = "small" elseif k2 == "Plant2" and p2stage ~= "small" then BikerWeedFarm.Plant2.Set(BikerWeedFarm.Plant2.Stage.small, BikerWeedFarm.Plant2.Light.basic) p2stage = "small" elseif k2 == "Plant3" and p3stage ~= "small" then BikerWeedFarm.Plant3.Set(BikerWeedFarm.Plant3.Stage.small, BikerWeedFarm.Plant3.Light.basic) p3stage = "small" elseif k2 == "Plant4" and p4stage ~= "small" then BikerWeedFarm.Plant4.Set(BikerWeedFarm.Plant4.Stage.small, BikerWeedFarm.Plant4.Light.basic) p4stage = "small" elseif k2 == "Plant5" and p5stage ~= "small" then BikerWeedFarm.Plant5.Set(BikerWeedFarm.Plant5.Stage.small, BikerWeedFarm.Plant5.Light.basic) p5stage = "small" elseif k2 == "Plant6" and p6stage ~= "small" then BikerWeedFarm.Plant6.Set(BikerWeedFarm.Plant6.Stage.small, BikerWeedFarm.Plant6.Light.basic) p6stage = "small" elseif k2 == "Plant7" and p7stage ~= "small" then BikerWeedFarm.Plant7.Set(BikerWeedFarm.Plant7.Stage.small, BikerWeedFarm.Plant7.Light.basic) p7stage = "small" elseif k2 == "Plant8" and p2stage ~= "small" then BikerWeedFarm.Plant8.Set(BikerWeedFarm.Plant8.Stage.small, BikerWeedFarm.Plant8.Light.basic) p8stage = "small" elseif k2 == "Plant9" and p9stage ~= "small" then BikerWeedFarm.Plant9.Set(BikerWeedFarm.Plant9.Stage.small, BikerWeedFarm.Plant9.Light.basic) p9stage = "small" end else end elseif v.stage == 3 and v.timer == 100 then v.stage = 0 v.timer = 0 v.hydration = 0 TaskStartScenarioInPlace(GetPlayerPed(-1), "world_human_gardener_plant", 0, 1) Citizen.Wait(1000) ClearPedTasks(GetPlayerPed(-1)) Citizen.Wait(3000) if v.strain == "normal" then TriggerEvent("inventory:addQty", 148, 1) elseif v.strain == "premium" then TriggerEvent("inventory:addQty", 149, 1) end if k2 == "Plant1" and p1stage ~= "empty" then BikerWeedFarm.Plant1.Clear() p1stage = "empty" elseif k2 == "Plant2" and p2stage ~= "empty" then BikerWeedFarm.Plant2.Clear() p2stage = "empty" elseif k2 == "Plant3" and p3stage ~= "empty" then BikerWeedFarm.Plant3.Clear() p3stage = "empty" elseif k2 == "Plant4" and p4stage ~= "empty" then BikerWeedFarm.Plant4.Clear() p4stage = "empty" elseif k2 == "Plant5" and p5stage ~= "empty" then BikerWeedFarm.Plant5.Clear() p5stage = "empty" elseif k2 == "Plant6" and p6stage ~= "empty" then BikerWeedFarm.Plant6.Clear() p6stage = "empty" elseif k2 == "Plant7" and p7stage ~= "empty" then BikerWeedFarm.Plant7.Clear() p7stage = "empty" elseif k2 == "Plant8" and p2stage ~= "empty" then BikerWeedFarm.Plant8.Clear() p8stage = "empty" elseif k2 == "Plant9" and p9stage ~= "empty" then BikerWeedFarm.Plant9.Clear() p9stage = "empty" end end end end end end end end end end) --============================================-- ------------------------------------------------ --============================================-- function statusbar(percent,x,y,sizex,sizey,r,g,b,a,r2,g2,b2,a2) local percentage = percent/100 local percentage2 = (100-percent)/100 DrawRect(x, y, sizex, sizey, r, g, b, a) DrawRect(x-((sizex/2)*percentage2), y, (sizex*percentage), sizey, r2, g2, b2, a2) end function Percent3D(percent,x,y,z,sizex,sizey,r,g,b,a,r2,g2,b2,a2) local onScreen,_x,_y = World3dToScreen2d(x,y,z) local px,py,pz = table.unpack(GetGameplayCamCoord()) local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1) local scale = (1/dist)*1.7 local fov = (1/GetGameplayCamFov())*100 local scale = scale*fov if onScreen then local percentage = percent/100 local percentage2 = (100-percent)/100 DrawRect(_x, _y, sizex*scale, sizey*scale, r, g, b, a) DrawRect(_x-((sizex/2)*percentage2*scale), _y, (sizex*scale)*percentage, sizey*scale, r2, g2, b2, a2) end end function Notify(msg) exports.pNotify:SendNotification({text = msg,type = "error",timeout = 8000,layout = "centerRight",queue = "left"}) CancelEvent() end function drawTxt(text, font, centre, x, y, scale, r, g, b, a) SetTextFont(font) SetTextProportional(0) SetTextScale(scale, scale) SetTextColour(r, g, b, a) SetTextDropShadow(0, 0, 0, 0,255) SetTextEdge(1, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() SetTextCentre(centre) SetTextEntry("STRING") AddTextComponentString(text) DrawText(x , y) end local interiors = { [1] = { ["xe"] = 2564.53, ["ye"] = 4680.46, ["ze"] = 34.08, ["he"] = 40.0, ["xo"] = 1066.05, ["yo"] = -3183.50, ["zo"] = -39.16, ["ho"] = 93.00, ["name"] = 'Weed'}, [2] = { ["xe"] = 2033.91, ["ye"] = 2942.10, ["ze"] = -61.90, ["he"] = 256.60, ["xo"] = 566.23, ["yo"] = 5.25, ["zo"] = 103.23, ["ho"] = 280.00, ["name"] = 'Vinewood PD'}, [3] = { ["xe"] = -1173.8878173828, ["ye"] = -1153.19140625, ["ze"] = 5.6583757400513, ["he"] = 260.0, ["xo"] = -1569.4385986328, ["yo"] = -3016.9538574219, ["zo"] = -74.406066894531, ["ho"] = 0.00, ["name"] = 'Nightclub'}, [4] = { ["xe"] = 902.80633544922, ["ye"] = -3182.5712890625, ["ze"] = -97.053520202637, ["he"] = 93.0, ["xo"] = 906.9124145507, ["yo"] = -1932.9516601563, ["zo"] = 30.622997283936, ["ho"] = 126.91, ["name"] = 'Bunker'}, [5] = { ["xe"] = 350.30, ["ye"] = -1020.30, ["ze"] = 29.33, ["he"] = 0.0, ["xo"] = 344.28, ["yo"] = -1000.18, ["zo"] = 29.36, ["ho"] = 180.0, ["name"] = '1633 Vespucci'}, [6] = { ["xe"] = 359.53, ["ye"] = -584.75, ["ze"] = 28.82, ["he"] = 251.0, ["xo"] = 315.51, ["yo"] = -582.99, ["zo"] = 43.28, ["ho"] = 253.0, ["name"] = 'Pillbox'}, [7] = { ["xe"] = 333.17, ["ye"] = -591.38, ["ze"] = 43.29, ["he"] = 332.22, ["xo"] = 338.74, ["yo"] = -583.74, ["zo"] = 74.17, ["ho"] = 250.0, ["name"] = 'Pillbox2'}, } timer = 0 current_int = 0 Citizen.CreateThread(function() while true do Citizen.Wait(0) for i=1, #interiors do if not IsEntityDead(PlayerPedId()) then if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), interiors[i].xe,interiors[i].ye,interiors[i].ze, true) < 1 then if timer == 0 then DoScreenFadeOut(1000) while IsScreenFadingOut() do Citizen.Wait(0) end NetworkFadeOutEntity(GetPlayerPed(-1), true, false) Wait(1000) SetEntityCoords(GetPlayerPed(-1), interiors[i].xo,interiors[i].yo,interiors[i].zo) SetEntityHeading(GetPlayerPed(-1), interiors[i].ho) NetworkFadeInEntity(GetPlayerPed(-1), 0) Wait(1000) current_int = i if current_int == 1 then inweedfarm = true end timer = 5 SimulatePlayerInputGait(PlayerId(), 1.0, 100, 1.0, 1, 0) DoScreenFadeIn(1000) while IsScreenFadingIn() do Citizen.Wait(0) end end end if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), interiors[i].xo,interiors[i].yo,interiors[i].zo, true) < 1 then if timer == 0 then DoScreenFadeOut(1000) while IsScreenFadingOut() do Citizen.Wait(0) end NetworkFadeOutEntity(GetPlayerPed(-1), true, false) Wait(1000) SetEntityCoords(GetPlayerPed(-1), interiors[i].xe,interiors[i].ye,interiors[i].ze) SetEntityHeading(GetPlayerPed(-1), interiors[i].he) NetworkFadeInEntity(GetPlayerPed(-1), 0) Wait(1000) current_int = i if current_int == 1 then --inweedfarm = false end timer = 5 SimulatePlayerInputGait(PlayerId(), 1.0, 100, 1.0, 1, 0) DoScreenFadeIn(1000) while IsScreenFadingIn() do Citizen.Wait(0) end end end end end end end) Citizen.CreateThread(function() while true do Wait(1000) if timer > 0 then timer=timer-1 if timer == 0 then current_int = 0 end end end end) function DrawTxt(text,x,y) SetTextScale(0.5, 0.5) SetTextFont(4) SetTextColour(255, 255, 255, 255) SetTextEntry("STRING") SetTextCentre(1) AddTextComponentString(text) DrawText(x,y-(y/55)) end function statusbar3(percent,x,y,sizex,sizey,r,g,b,a,r2,g2,b2,a2) local percentage = percent/100 local percentage2 = (100-percent)/100 DrawRect(x, y, sizex, sizey, r, g, b, a) DrawRect(x, ((sizey/2)*percentage2)+y, sizex, sizey*percentage, r2, g2, b2, a2) end local stage = "" function statusbar4(percent,x,y,sizex,sizey,r,g,b,a,r2,g2,b2,a2) local percentage = percent/100 local percentage2 = (100-percent)/100 DrawTxt(stage,.5,.9) DrawRect(x, y, sizex, sizey, r, g, b, a) DrawRect(x-((sizex/2)*percentage2), y, (sizex*percentage), sizey, r2, g2, b2, a2) end local heat = 0 local progress = 0 local citem = "" local rheat = 0 local methqty = 1 local spot = 0 methspots = { {x=1391.9274902344, y=3605.7419433594, z=38.941925048828}, {x=1390.0001220703, y=3608.7939453125, z=38.941925048828}, {x=1389.0161132813, y=3605.5595703125, z=38.941925048828}, {x=1389.6831054688, y=3603.5283203125, z=38.91862487793}, {x=1394.6555175781, y=3601.8898925781, z=38.941925048828}, {x=2434.5034179688, y=4964.0502929688, z=42.347606658936}, {x=2436.0549316406, y=4965.505859375, z=42.347606658936}, {x=2435.359375, y=4969.0571289063, z=42.347606658936}, {x=2431.5090332031, y=4971.009765625, z=42.347606658936}, }, Citizen.CreateThread(function() while true do Citizen.Wait(0) if spot ~= 0 then local pedcoords = GetEntityCoords(GetPlayerPed(-1), false) local dist = GetDistanceBetweenCoords(pedcoords.x, pedcoords.y, pedcoords.z, methspots[spot].x, methspots[spot].y, methspots[spot].z, 1) if dist > 1.5 then stage = "" progress = 0 rheat = 0 heat = 0 citem = "" end end for k,v in pairs(methspots) do local pedcoords = GetEntityCoords(GetPlayerPed(-1), false) local dist = GetDistanceBetweenCoords(pedcoords.x, pedcoords.y, pedcoords.z, v.x, v.y, v.z, 1) if dist < 1.0 then if stage == "" then DrawText3d2(v.x,v.y,v.z, "Cook ( " .. methqty .. " ) [E]") end if IsControlJustPressed(0, 187) and stage == "" then if methqty > 1 then methqty = methqty - 1 end elseif IsControlJustPressed(0, 188) and stage == "" then if methqty < 50 then methqty = methqty + 1 end end if IsControlJustPressed(0, 38) and stage == "" then if exports.FCORE_:GetItemQuantity(7) >= methqty and exports.FCORE_:GetItemQuantity(12) >= methqty and exports.FCORE_:GetItemQuantity(13) >= methqty and exports.FCORE_:GetItemQuantity(154) >= methqty then TriggerEvent("inventory:removeQty", 7, methqty) TriggerEvent("inventory:removeQty", 12, methqty) TriggerEvent("inventory:removeQty", 13, methqty) TriggerEvent("inventory:removeQty", 154, methqty) stage = "Stage 1" rheat = 20 spot = k else Notify("Missing Supplies") end end if stage ~= "" then DisableControlAction(0, 161, true) DisableControlAction(0, 162, true) DisableControlAction(0, 163, true) DisableControlAction(0, 159, true) DrawText3d2(v.x,v.y,v.z+0.2, "Add Heat [Hold Up]") DrawText3d2(v.x,v.y,v.z+0.1, "Remove Heat [Hold Down]") DrawText3d2(v.x,v.y,v.z, "Select Antifreeze [6]") DrawText3d2(v.x,v.y,v.z-0.1, "Select Sudafed [7]") DrawText3d2(v.x,v.y,v.z-0.2, "Select Phosphorus [8]") DrawText3d2(v.x,v.y,v.z-0.3, "Select Acetone [9]") statusbar4(progress,.5,.9,.15,.025,100,100,100,100,0,255,100,100) statusbar3(heat,.1,.5,.015,.25,100,100,100,100,255,0,0,150) if IsDisabledControlJustReleased(0, 161) then if stage == "Stage 1" then citem = "suda" else heat = heat+40 end elseif IsDisabledControlJustReleased(0, 162) then if stage == "Stage 2" then citem = "pred" else heat = heat+40 end elseif IsDisabledControlJustReleased(0, 163) then if stage == "Stage 3" then citem = "acetone" else heat = heat+40 end elseif IsDisabledControlJustReleased(0, 159) then if stage == "Stage 4" then citem = "anti" else heat = heat+40 end end end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(500) if stage == "Stage 1" then if citem == "suda" and math.abs(heat - rheat) < 10 then progress = progress + 1 heat = heat + 1 elseif citem == "suda" and (heat - rheat) > 10 then progress = progress + 0.5 heat = heat + 3 elseif citem == "suda" and (heat - rheat) > 25 then heat = heat + 5 else heat = heat + 4 end if progress > 99 then stage = "Stage 2" progress = 0 rheat = 50 end elseif stage == "Stage 2" then if citem == "pred" and math.abs(heat - rheat) < 10 then progress = progress + 1 heat = heat + 1 elseif citem == "pred" and (heat - rheat) > 10 then progress = progress + 0.5 heat = heat + 3 elseif citem == "pred" and (heat - rheat) > 25 then heat = heat + 5 else heat = heat + 4 end if progress > 99 then stage = "Stage 3" progress = 0 rheat = 75 end elseif stage == "Stage 3" then if citem == "acetone" and math.abs(heat - rheat) < 10 then progress = progress + 1 heat = heat + 1 elseif citem == "acetone" and (heat - rheat) > 10 then progress = progress + 0.5 heat = heat + 3 elseif citem == "acetone" and (heat - rheat) > 25 then heat = heat + 5 else heat = heat + 4 end if progress > 99 then stage = "Stage 4" progress = 0 rheat = 25 end elseif stage == "Stage 4" then if citem == "anti" and math.abs(heat - rheat) < 10 then progress = progress + 1 heat = heat + 1 elseif citem == "anti" and (heat - rheat) > 10 then progress = progress + 0.5 heat = heat + 3 elseif citem == "anti" and (heat - rheat) > 25 then heat = heat + 5 else heat = heat + 4 end if progress > 99 then stage = "" progress = 0 rheat = 0 heat = 0 citem = "" TriggerEvent("inventory:addQty", 11, methqty) end end if heat > 100 then stage = "" heat = 0 progress = 0 rheat = 0 citem = "" local coords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0.5, 0.0, 0.0) AddExplosion(coords.x, coords.y, coords.z, "EXPLOSION_STICKYBOMB", 1.0, true, false, true) StartEntityFire(GetPlayerPed(-1)) end if IsControlPressed(0, 188) and stage ~= "" then if heat < 100 then heat = heat + 5 end elseif IsControlPressed(0, 187) and stage ~= "" then if heat > 0 then heat = heat - 5 end end end end) TriggerServerEvent('drug:start') RegisterNetEvent('drug:methloc') AddEventHandler('drug:methloc', function(anti,ace,suda,redp) Antifreeze = anti Acetone = ace Sudafed = suda Redp = redp end)