- added
- piglatin - gungan - pirate - klingon - meanieweenie - DJ
This commit is contained in:
1 parent
1f3d7154aa
commit
880479b435
28 files changed
+2035
-237
No files matched your search
+116
-30
@@ -1,27 +1,77 @@
|
||||
local miss = false
|
||||
local 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
|
||||
local settings = ps.callback('md-drugs:server:GetWSsettings')
|
||||
|
||||
function SetUpPeds(drugCount)
|
||||
local attackerCount = settings.WholesaleAmbushBase
|
||||
if settings.WholesaleAmbushScale then
|
||||
if drugCount > settings.WholesaleAmbushTier1 then
|
||||
attackerCount = 3
|
||||
end
|
||||
if drugCount > settings.WholesaleAmbushTier2 then
|
||||
attackerCount = 4
|
||||
end
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
attackerCount = 5
|
||||
end
|
||||
end
|
||||
local weaponTier = settings.WholesaleWeaponsTier1
|
||||
if settings.WholesaleWeaponTiers then
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
weaponTier = settings.WholesaleWeaponsTier4
|
||||
elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
weaponTier = settings.WholesaleWeaponsTier3
|
||||
elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
weaponTier = settings.WholesaleWeaponsTier2
|
||||
end
|
||||
end
|
||||
local playerPed = PlayerPedId()
|
||||
local playerCoords = GetEntityCoords(playerPed, false)
|
||||
local models = {"g_m_y_ballasout_01", "g_m_y_famdnf_01", "g_m_y_famca_01", "g_m_y_mexgoon_01", "g_m_y_salvagoon_01"}
|
||||
for i = 1, attackerCount do
|
||||
local angle = (360 / attackerCount) * i
|
||||
local x = playerCoords.x + math.cos(math.rad(angle)) * 15
|
||||
local y = playerCoords.y + math.sin(math.rad(angle)) * 15
|
||||
local z = playerCoords.z
|
||||
local modelHash = GetHashKey(models[math.random(1, #models)])
|
||||
ps.requestModel(modelHash)
|
||||
local ped = CreatePed(4, modelHash, x, y, z, 0.0, true, false)
|
||||
local weapon = weaponTier[math.random(1, #weaponTier)]
|
||||
SetPedRelationshipGroupHash(ped, GetHashKey("HATES_PLAYER"))
|
||||
SetPedCombatAttributes(ped, 46, true)
|
||||
SetPedCombatAttributes(ped, 0, true)
|
||||
SetPedCombatAttributes(ped, 5, true)
|
||||
SetPedCombatAttributes(ped, 2, true)
|
||||
local healthMultiplier = 1.0
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
healthMultiplier = 1.5
|
||||
elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
healthMultiplier = 1.3
|
||||
elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
healthMultiplier = 1.2
|
||||
end
|
||||
local baseHealth = GetEntityHealth(ped)
|
||||
SetEntityHealth(ped, math.floor(baseHealth * healthMultiplier))
|
||||
GiveWeaponToPed(ped, GetHashKey(weapon), 500, false, true)
|
||||
TaskCombatPed(ped, playerPed, 0, 16)
|
||||
local blip = AddBlipForEntity(ped)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
SetBlipColour(blip, 1)
|
||||
SetBlipScale(blip, 0.7)
|
||||
SetEntityAsNoLongerNeeded(ped)
|
||||
end
|
||||
local tierName = "Basic"
|
||||
if drugCount > settings.WholesaleAmbushTier3 then
|
||||
tierName = "Elite"
|
||||
elseif drugCount > settings.WholesaleAmbushTier2 then
|
||||
tierName = "Advanced"
|
||||
elseif drugCount > settings.WholesaleAmbushTier1 then
|
||||
tierName = "Medium"
|
||||
end
|
||||
ps.notify(string.format(ps.lang('wholesale.ambush'), attackerCount, tierName), 'error')
|
||||
end
|
||||
|
||||
RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
|
||||
if not GetCops(Config.PoliceCount) then return end
|
||||
if not GetCops(settings.PoliceCount) then return end
|
||||
if miss then
|
||||
ps.notify(ps.lang('wholesale.alreadyWholesale'), 'error')
|
||||
else
|
||||
@@ -29,8 +79,25 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
|
||||
local timer = 0
|
||||
miss = true
|
||||
SetNewWaypoint(loc.x, loc.y)
|
||||
ps.requestModel("g_m_y_famdnf_01", Config.RequestModelTime)
|
||||
local drugdealer = CreatePed(0, "g_m_y_famdnf_01",loc.x,loc.y,loc.z-1, 90.0, false, false)
|
||||
if settings.WholesaleShowEstimates and drug.count > 0 then
|
||||
local bonusTiers = math.floor(drug.count / 10)
|
||||
local potentialBonus = math.min(bonusTiers * settings.WholesaleQuantityBonus, settings.WholesaleMaxBonus)
|
||||
local bonusPercent = math.floor(potentialBonus * 100)
|
||||
local minPayout = math.floor(drug.price.min * (1 + potentialBonus))
|
||||
local maxPayout = math.floor(drug.price.max * (1 + potentialBonus))
|
||||
local totalMinPayout = drug.count * minPayout
|
||||
local totalMaxPayout = drug.count * maxPayout
|
||||
ps.notify(string.format(ps.lang('wholesale.count'), drug.count), 'info')
|
||||
if bonusPercent > 0 then
|
||||
ps.notify(string.format(ps.lang('wholesale.bonus'), bonusPercent), 'info')
|
||||
end
|
||||
ps.notify(string.format(ps.lang('wholesale.estimate'), totalMinPayout, totalMaxPayout), 'info')
|
||||
elseif drug.count <= 0 then
|
||||
ps.notify(ps.lang('wholesale.no_drugs'), 'error')
|
||||
end
|
||||
ps.requestModel("g_m_y_famdnf_01", settings.RequestModelTime)
|
||||
local current = "g_m_y_famdnf_01"
|
||||
local drugdealer = CreatePed(0, current,loc.x,loc.y,loc.z-1, 90.0, false, false)
|
||||
FreezeEntityPosition(drugdealer, true)
|
||||
SetEntityInvincible(drugdealer, true)
|
||||
ps.entityTarget(drugdealer, {{
|
||||
@@ -38,12 +105,21 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
|
||||
icon = "fas fa-eye",
|
||||
action = function()
|
||||
local luck = math.random(1,100)
|
||||
if luck <= Config.SuccessfulChance then
|
||||
if luck <= settings.SuccessfulChance then
|
||||
if not ps.progressbar(ps.lang('wholesale.wholesaling'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:SuccessSale", drug)
|
||||
else
|
||||
ps.notify(ps.lang('wholesale.uhoh'), 'error')
|
||||
SetUpPeds()
|
||||
ps.progressbar("Deal Going Bad", 4000, 'uncuff')
|
||||
if settings.WholesaleAmbushEnabled then
|
||||
SetUpPeds(drug.count)
|
||||
end
|
||||
if settings.WholesaleFailPoliceAlert > 0 then
|
||||
local alertChance = math.random(1, 100)
|
||||
if alertChance <= settings.WholesaleFailPoliceAlert then
|
||||
PoliceCall(100)
|
||||
end
|
||||
end
|
||||
TriggerServerEvent('md-drugs:server:CleanupWholesale')
|
||||
end
|
||||
Wait(3000)
|
||||
DeleteEntity(drugdealer)
|
||||
@@ -53,15 +129,25 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug)
|
||||
repeat
|
||||
Wait(1000)
|
||||
timer = timer + 1
|
||||
until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 or timer == Config.WholesaleTimeout + 1
|
||||
PoliceCall(Config.AlertPoliceWholesale)
|
||||
if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then
|
||||
until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 or timer == settings.WholesaleTimeout + 1
|
||||
PoliceCall(settings.AlertPoliceWholesale)
|
||||
if timer <= settings.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then
|
||||
timer = 0
|
||||
else
|
||||
ps.notify(ps.lang('wholesale.tooLong'), 'error')
|
||||
DeleteEntity(drugdealer)
|
||||
TriggerServerEvent('md-drugs:server:CleanupWholesale')
|
||||
if settings.WholesaleResetOnTimeout then
|
||||
miss = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('md-drugs:client:WholesaleComplete', function(data)
|
||||
local bonusText = ""
|
||||
if data.bonus > 0 then
|
||||
bonusText = " (+" .. data.bonus .. "% quantity bonus)"
|
||||
end
|
||||
ps.notify(string.format(ps.lang('wholesale.complete'), data.quantity, data.payout, bonusText), 'success')
|
||||
end)
|
||||
Reference in new issue
Block a user