Skip to content

Explosive vests with huge blast radius and a deadman switch made for the QBCore framework

License

Notifications You must be signed in to change notification settings

Omega248/qb-explosivevest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Explosive vests with huge blast radius and a deadman switch made for the QBCore framework

there alot of checks within the script to ensure that the vests can not be exploited/abused.
all the sounds of the vest are played within distance of the player so anyone nearby will be able
to hear the vest beeping and activating

Requirements

qb-core

qb-smallresources/consumables

interact-sounds

Keys to activate the vest

G activates the vest

= toggles the deadmanswitch

add to qb-smallresources/client/consumables around line 500

RegisterNetEvent('consumables:client:RemoveVest', function()
    local ped = PlayerPedId()
    if Vest == true then
        loadAnimDict("clothingtie")
        TaskPlayAnim(ped, 'clothingtie', 'try_tie_negative_a' , 3.0, 3.0, -1, 0, 32, false, false, false)
        QBCore.Functions.Progressbar("remove_armor", "Removing the explosive vest", 8500, false, true, {
            disableMovement = true,
            disableCarMovement = false,
            disableMouse = false,
            disableCombat = true,
        }, {}, {}, {}, function() -- Done
            SetPedComponentVariation(ped, 9, 0, 0, 2)
            TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items["explosivevest"], "add")
            TriggerServerEvent("QBCore:Server:AddItem", "explosivevest", 1)
            TriggerEvent('qb-explosivevest:client:remove')
            TriggerEvent('consumables:client:detonated')
            QBCore.Functions.Notify("You Have Removed You're explosive Vest","success")
        end)
    else
        QBCore.Functions.Notify("You're not wearing a vest", "error")
    end
end)
RegisterNetEvent('consumables:client:UseExplosiveVest', function()
    if Vest == true then QBCore.Functions.Notify('You already have an explosive vest on', 'error') return end
    local ped = PlayerPedId()
    local PlayerData = QBCore.Functions.GetPlayerData()
    loadAnimDict("clothingtie")
    TaskPlayAnim(ped, 'clothingtie', 'try_tie_negative_a' , 3.0, 3.0, -1, 0, 32, false, false, false)
    QBCore.Functions.Progressbar("use_heavyarmor", "Putting on an explosive vest", 8500, false, true, {
        disableMovement = true,
        disableCarMovement = false,
		disableMouse = false,
		disableCombat = true,
    }, {}, {}, {}, function() -- Done
        if PlayerData.charinfo.gender == 0 then
            currentVest = GetPedDrawableVariation(ped, 9)
            currentVestTexture = GetPedTextureVariation(ped, 9)
            SetPedComponentVariation(ped, 9, 14, 0, 1)
        else
            currentVest = GetPedDrawableVariation(ped, 30)
            currentVestTexture = GetPedTextureVariation(ped, 30)
            SetPedComponentVariation(ped, 9, 16, 0, 1)
        end
        TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items["explosivevest"], "remove")
        TriggerServerEvent("QBCore:Server:RemoveItem", "explosivevest", 1)
        TriggerEvent('qb-explosivevest:client:equip')
        TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 3, "beep-sound-1", 0.50)
        Vest = true
        QBCore.Functions.Notify("You Have Equiped An Explosive Vest","success")
    end)
end)
RegisterNetEvent('consumables:client:detonated', function()
    Vest = false
end)

add to qb-smallresources/server/consumables around line 130

QBCore.Functions.CreateUseableItem("explosivevest", function(source, item)
    local src = source
    TriggerClientEvent("consumables:client:UseExplosiveVest", src)
end)

QBCore.Commands.Add("removevest", "Removes Vest", {}, false, function(source, args)
    local src = source
	TriggerClientEvent('consumables:client:RemoveVest', src)
end)

Add to qb-core/shared/items

['explosivevest'] 		 		 = {['name'] = 'explosivevest', 					['label'] = 'Explosive Vest', 			['weight'] = 5000, 	    ['type'] = 'item', 		['image'] = 'vest.png', 				['unique'] = true, 		['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = 'Definitely just a normal vest'}

Replace in qb-core/shared/items

['heavyarmor'] 		 			 = {['name'] = 'heavyarmor', 					['label'] = 'Heavy Armor', 				['weight'] = 5000, 	    ['type'] = 'item', 		['image'] = 'armor.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = {accept = {'weapon_stickybomb'}, reward = 'explosivevest', anim = {['dict'] = 'anim@amb@business@weed@weed_inspecting_high_dry@', ['lib'] = 'weed_inspecting_high_base_inspector', ['text'] = 'Crafting Explosive Vest', ['timeOut'] = 7500,}}, ['description'] = 'Some protection won\'t hurt... right?'},

Add the vest.png to inventory photos

Add the sounds to interact-sounds/client/Html

Preview

Preview

About

Explosive vests with huge blast radius and a deadman switch made for the QBCore framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages