Files
md-drugs/client/animationsandfunctions.lua
T

332 lines
12 KiB
Lua
Raw Normal View History

2024-01-13 22:23:17 -08:00
local started = nil
2024-11-25 12:27:43 -08:00
2025-06-30 23:24:57 -07:00
function CutCoke(coords, offset, rotation)
2024-01-13 22:23:17 -08:00
local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter"
2025-07-16 01:48:56 -07:00
ps.requestAnim(animDict, 500)
2024-01-13 22:23:17 -08:00
local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = PlayerPedId()
2025-06-30 23:24:57 -07:00
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation
2024-01-13 22:23:17 -08:00
local scenes = {
{
2024-11-25 12:27:43 -08:00
{ 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"}
2024-01-13 22:23:17 -08:00
},
}
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)
2024-01-13 22:23:17 -08:00
end
scenesList[#scenesList+1] = scene
end
DisableCamCollisionForEntity(ped)
FreezeEntityPosition(ped, true)
for i=1, #scenesList, 1 do
NetworkStartSynchronisedScene(scenesList[i])
2024-01-13 22:23:17 -08:00
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)
2024-01-13 22:23:17 -08:00
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)
2025-06-30 23:24:57 -07:00
function BagCoke(coords, offset, rotation)
2024-01-13 22:23:17 -08:00
local ver = ""
local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01"
2025-07-16 01:48:56 -07:00
ps.requestAnim(animDict, 500)
2024-01-13 22:23:17 -08:00
local animDuration = GetAnimDuration(animDict, animName) * 1000
local ped = PlayerPedId()
2025-06-30 23:24:57 -07:00
local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation
2024-01-13 22:23:17 -08:00
local scenes = {
{
2024-11-25 12:27:43 -08:00
{ 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"}
2024-01-13 22:23:17 -08:00
},
{
2024-11-25 12:27:43 -08:00
{ 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"}
2024-01-13 22:23:17 -08:00
},
{
2024-11-25 12:27:43 -08:00
{ 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"}
2024-01-13 22:23:17 -08:00
},
{
2024-11-25 12:27:43 -08:00
{ hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"},
2024-01-13 22:23:17 -08:00
}
}
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()
2024-05-02 18:34:14 -07:00
local startStamina = 50
SetFlash(0, 0, 500, 20000, 500)
2024-01-13 22:23:17 -08:00
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()
2024-05-02 18:34:14 -07:00
local startStamina = 30
2024-01-13 22:23:17 -08:00
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
2024-01-13 22:23:17 -08:00
function SpawnCarPedChase()
2025-07-17 02:06:17 -05:00
ps.debug("SpawnCarPedChase")
local stoploc = vector3(-1157.63, -3056.71, 13.94)
2025-07-17 02:06:17 -05:00
local start = GlobalState.MDDrugsLocs.StartLoc[math.random(1,#GlobalState.MDDrugsLocs.StartLoc)]
if started then
2025-07-17 02:06:17 -05:00
ps.notify(Lang.lean.act,'error')
else
2024-01-13 22:23:17 -08:00
started = true
2025-07-16 01:48:56 -07:00
ps.requestModel("pounder", Config.RequestModelTime)
ps.requestModel("ig_priest", Config.RequestModelTime)
ps.requestModel("cargobob3", Config.RequestModelTime)
2024-12-16 03:22:44 -08:00
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)
2024-01-13 22:23:17 -08:00
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)
2025-07-17 02:06:17 -05:00
SetPedKeepTask(driver, true)
repeat
2024-05-02 18:34:14 -07:00
Wait(1000)
until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0
RemoveBlip(leancar)
2025-07-17 02:06:17 -05:00
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
}
})
2024-05-02 18:34:14 -07:00
else
2024-12-16 03:22:44 -08:00
DeleteVehicle(leancar) DeleteEntity(driver) DeleteEntity(pilot2)
2025-07-17 02:06:17 -05:00
end
2024-01-13 22:23:17 -08:00
end
end
function SpawnMethCarPedChase()
local ped = GetEntityCoords(PlayerPedId())
local stoploc = vector3(-1157.63, -3056.71, 13.94)
2025-07-01 03:09:46 -07:00
local config = ps.callback('md-drugs:server:getLocs', false)
2024-11-12 01:04:42 -08:00
local start = config.StartLoc[math.random(1,#config.StartLoc)]
2024-05-02 18:34:14 -07:00
local startedmeth = false
2024-01-13 22:23:17 -08:00
if startedmeth then
2025-07-16 01:48:56 -07:00
ps.notify(Lang.meth.act,'error')
2024-01-13 22:23:17 -08:00
else
startedmeth = true
2025-07-16 01:48:56 -07:00
ps.requestModel("journey", Config.RequestModelTime)
ps.requestModel("a_m_m_hillbilly_02", Config.RequestModelTime)
ps.requestModel("cargobob3", Config.RequestModelTime)
2024-12-16 03:22:44 -08:00
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)
2024-01-13 22:23:17 -08:00
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)
2024-05-02 18:34:14 -07:00
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',
2024-11-04 16:46:27 -08:00
label = Lang.targets.meth.stealfromcar,
action = function()
if not minigame() then return end
TriggerServerEvent('md-drugs:server:givemethingridients')
2024-11-25 12:27:43 -08:00
startedmeth = false
if math.random(1,100) <= 30 then
DeleteVehicle(methcar)
DeleteEntity(methdriver)
DeleteEntity(methpilot)
end
end,
}, nil )
2024-05-02 18:34:14 -07:00
else
2024-12-16 03:22:44 -08:00
DeleteVehicle(methcar)
DeleteEntity(methdriver)
DeleteEntity(methpilot)
2024-05-02 18:34:14 -07:00
end
2024-01-13 22:23:17 -08:00
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
2025-07-16 01:48:56 -07:00
end