local started = nil function CutCoke(coords, offset, rotation) local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter" ps.requestAnim(animDict, 500) local animDuration = GetAnimDuration(animDict, animName) * 1000 local ped = PlayerPedId() local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation local scenes = { { { hash = "bkr_prop_coke_bakingsoda_o", animName = "coke_cut_v5_bakingsoda"}, { hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard"}, { hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard^1"} }, } local scenesList, entitiesList = {}, {} for i=1, #scenes, 1 do local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) for j=1, #scenes[i], 1 do local s = scenes[i][j] RequestModel(s.hash) while not HasModelLoaded(s.hash) do Wait(0) end local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) SetModelAsNoLongerNeeded(s.hash) entitiesList[#entitiesList+1] = obj NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) end scenesList[#scenesList+1] = scene end DisableCamCollisionForEntity(ped) FreezeEntityPosition(ped, true) for i=1, #scenesList, 1 do NetworkStartSynchronisedScene(scenesList[i]) end Wait(animDuration-11000) for i=1, #scenesList, 1 do NetworkStopSynchronisedScene(scenesList[i]) end for i=1, #entitiesList, 1 do DeleteEntity(entitiesList[i]) end RemoveAnimDict(animDict) FreezeEntityPosition(ped, false) end CreateThread(function() BikerCocaine = exports['bob74_ipl']:GetBikerCocaineObject() BikerCocaine.Style.Set(BikerCocaine.Style.upgrade) BikerCocaine.Security.Set(BikerCocaine.Security.upgrade) BikerCocaine.Details.Enable({BikerCocaine.Details.cokeBasic1, BikerCocaine.Details.cokeBasic2, BikerCocaine.Details.cokeBasic3}, true) end) function BagCoke(coords, offset, rotation) local ver = "" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" ps.requestAnim(animDict, 500) local animDuration = GetAnimDuration(animDict, animName) * 1000 local ped = PlayerPedId() local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation local scenes = { { { hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."box01"}, { hash = "bkr_prop_coke_fullmetalbowl_02", animName = "break_weigh_"..ver.."box01^1"}, { hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."methbag01"} }, { { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^1"}, { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^2"}, { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^3"} }, { { hash = "bkr_prop_coke_fullscoop_01a", animName = "break_weigh_"..ver.."scoop"}, { hash = "bkr_prop_coke_scale_01", animName = "break_weigh_"..ver.."scale"}, { hash = "bkr_prop_fakeid_penclipboard", animName = "break_weigh_"..ver.."pen"} }, { { hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"}, } } local scenesList, entitiesList = {}, {} for i=1, #scenes, 1 do local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) for j=1, #scenes[i], 1 do local s = scenes[i][j] RequestModel(s.hash) while not HasModelLoaded(s.hash) do Wait(0) end local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) SetModelAsNoLongerNeeded(s.hash) entitiesList[#entitiesList+1] = obj NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) end scenesList[#scenesList+1] = scene end DisableCamCollisionForEntity(ped) FreezeEntityPosition(ped, true) for i=1, #scenesList, 1 do NetworkStartSynchronisedScene(scenesList[i]) end Wait(animDuration-11000) for i=1, #scenesList, 1 do NetworkStopSynchronisedScene(scenesList[i]) end for i=1, #entitiesList, 1 do DeleteEntity(entitiesList[i]) end RemoveAnimDict(animDict) FreezeEntityPosition(ped, false) end function EcstasyEffect() local startStamina = 50 SetFlash(0, 0, 500, 20000, 500) while startStamina > 0 do Wait(1000) startStamina = startStamina - 1 RestorePlayerStamina(PlayerId(), 1.0) if math.random(1, 100) < 51 then SetFlash(0, 0, 500, 7000, 500) ShakeGameplayCam('SMALL_EXPLOSION_SHAKE', 0.08) end end if IsPedRunning(PlayerPedId()) then SetPedToRagdoll(PlayerPedId(), math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0) end startStamina = 0 end function MethBagEffect() local startStamina = 30 TrevorEffect() SetRunSprintMultiplierForPlayer(PlayerId(), 1.49) while startStamina > 0 do Wait(1000) if math.random(5, 100) < 10 then RestorePlayerStamina(PlayerId(), 1.0) end startStamina = startStamina - 1 if math.random(5, 100) < 51 then TrevorEffect() end end startStamina = 0 SetRunSprintMultiplierForPlayer(PlayerId(), 1.0) end function TrevorEffect() StartScreenEffect("DrugsTrevorClownsFightIn", 3.0, 0) Wait(3000) StartScreenEffect("DrugsTrevorClownsFight", 3.0, 0) Wait(3000) StartScreenEffect("DrugsTrevorClownsFightOut", 3.0, 0) StopScreenEffect("DrugsTrevorClownsFight") StopScreenEffect("DrugsTrevorClownsFightIn") StopScreenEffect("DrugsTrevorClownsFightOut") end function CokeBaggyEffect() local startStamina = 20 local ped = PlayerPedId() AlienEffect() SetRunSprintMultiplierForPlayer(PlayerId(), 1.1) while startStamina > 0 do Wait(1000) if math.random(1, 100) < 20 then RestorePlayerStamina(PlayerId(), 1.0) end startStamina = startStamina - 1 if math.random(1, 100) < 10 and IsPedRunning(ped) then SetPedToRagdoll(ped, math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0) end if math.random(1, 300) < 10 then AlienEffect() Wait(math.random(3000, 6000)) end end if IsPedRunning(ped) then SetPedToRagdoll(ped, math.random(1000, 3000), math.random(1000, 3000), 3, 0, 0, 0) end startStamina = 0 SetRunSprintMultiplierForPlayer(PlayerId(), 1.0) end function AlienEffect() StartScreenEffect("DrugsMichaelAliensFightIn", 3.0, 0) Wait(math.random(5000, 8000)) StartScreenEffect("DrugsMichaelAliensFight", 3.0, 0) Wait(math.random(5000, 8000)) StartScreenEffect("DrugsMichaelAliensFightOut", 3.0, 0) StopScreenEffect("DrugsMichaelAliensFightIn") StopScreenEffect("DrugsMichaelAliensFight") StopScreenEffect("DrugsMichaelAliensFightOut") end local hit = 0 function SpawnCarPedChase() ps.debug("SpawnCarPedChase") local stoploc = vector3(-1157.63, -3056.71, 13.94) local start = GlobalState.MDDrugsLocs.StartLoc[math.random(1,#GlobalState.MDDrugsLocs.StartLoc)] if started then ps.notify(Lang.lean.act,'error') else started = true ps.requestModel("pounder", Config.RequestModelTime) ps.requestModel("ig_priest", Config.RequestModelTime) ps.requestModel("cargobob3", Config.RequestModelTime) local leancar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, true, false) local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, false, false) local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) FreezeEntityPosition(pilot2, true) SetEntityInvincible(pilot2, true) SetEntityAsMissionEntity(leancar) AddBlipForEntity(leancar) SetPedIntoVehicle(driver, leancar, -1) SetPedFleeAttributes(driver,false) TaskVehicleDriveToCoordLongrange(driver, leancar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) SetPedKeepTask(driver, true) repeat Wait(1000) until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0 RemoveBlip(leancar) if GetEntityHealth(driver) == 0 then ps.entityTarget(leancar, { { name = 'leancar', icon = 'fa-solid fa-car', label = Lang.targets.lean.st, action = function() hit = hit + 1 if not minigame() then return end TriggerServerEvent('md-drugs:server:givelean') started = nil if math.random(1,100) <= 30 or hit == 4 then hit = 0 DeleteVehicle(leancar) DeleteEntity(driver) DeleteEntity(pilot2) end end } }) else DeleteVehicle(leancar) DeleteEntity(driver) DeleteEntity(pilot2) end end end function SpawnMethCarPedChase() local ped = GetEntityCoords(PlayerPedId()) local stoploc = vector3(-1157.63, -3056.71, 13.94) local config = ps.callback('md-drugs:server:getLocs', false) local start = config.StartLoc[math.random(1,#config.StartLoc)] local startedmeth = false if startedmeth then ps.notify(Lang.meth.act,'error') else startedmeth = true ps.requestModel("journey", Config.RequestModelTime) ps.requestModel("a_m_m_hillbilly_02", Config.RequestModelTime) ps.requestModel("cargobob3", Config.RequestModelTime) local methcar = CreateVehicle("journey", start.x+3, start.y-2, start.z-1, 52.0, true, false) local methdriver = CreatePed(26, "a_m_m_hillbilly_02", start.x, start.y, start.z, 268.9422, false, false) local methpilot = CreatePed(26, "a_m_m_hillbilly_02", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) FreezeEntityPosition(methpilot, true) SetEntityInvincible(methpilot, true) SetEntityAsMissionEntity(methcar) AddBlipForEntity(methcar) SetPedIntoVehicle(methdriver, methcar, -1) SetPedFleeAttributes(methdriver,false) TaskVehicleDriveToCoordLongrange(methdriver, methcar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) SetPedKeepTask(methdriver, true) repeat Wait(1000) until #(GetEntityCoords(methdriver) - stoploc) < 20.0 or GetEntityHealth(methdriver) == 0 if GetEntityHealth(methdriver) == 0 then AddSingleModel(methcar,{ name = 'methcar', icon = 'fa-solid fa-car', label = Lang.targets.meth.stealfromcar, action = function() if not minigame() then return end TriggerServerEvent('md-drugs:server:givemethingridients') startedmeth = false if math.random(1,100) <= 30 then DeleteVehicle(methcar) DeleteEntity(methdriver) DeleteEntity(methpilot) end end, }, nil ) else DeleteVehicle(methcar) DeleteEntity(methdriver) DeleteEntity(methpilot) end end end function SetUpPeds() AddRelationshipGroup('setups') local ped = GetEntityCoords(PlayerPedId()) local peds = { {x = ped.x+3, y = ped.y-5, z = ped.z-1, }, {x = ped.x+6, y = ped.y-10, z = ped.z-1,}, {x = ped.x+-2,y = ped.y+5, z = ped.z-1,}, {x = ped.x+8, y = ped.y-12, z = ped.z-1,}, {x = ped.x+5, y = ped.y-2, z = ped.z-1, }, {x = ped.x+2, y = ped.y-20, z = ped.z-1,}, {x = ped.x+1, y = ped.y-10, z = ped.z-1,}, } for i = 1, #peds do local k = peds[i] i = CreatePed(0, "g_m_y_famdnf_01", k.x, k.y, k.z, 90.0, true, true) SetPedRelationshipGroupHash(i, 'setups') GiveWeaponToPed(i, "weapon_pistol", 1, false, true) TaskCombatPed(i, PlayerPedId(), 0, 16) SetPedCombatAttributes(i, 46, true) end end