😡
RAINMAD Documentation
WebsiteStoreDiscordYouTube
  • Welcome to RAINMAD Scripts
  • INFORMATION
    • FAQ
    • Support and Assistance
    • Discord Roles
    • How to Update Your Asset
  • CFX Auth system
    • FiveM Asset Escrow System
  • Development Guide
    • Common Issues
    • How to Add Webhooks
    • Target Options Configuration
    • How to Translate Your Script
    • How to Integrate Your Custom Notification Script
    • How to Change the Black Money Name
    • How to Add an Item
    • How to Change the Dispatch
    • Framework Selection and Configuration
    • Finding Item Images
  • RESOURCES
    • Cargo Ship Heist
      • Installation
      • Dependencies
      • Translate Strings
      • Discord Log
      • Configuration
      • Exports
    • Below the Vault Heist
      • Installation
    • NPC Mechanic
      • Installation
      • Configuration Guide
    • Cash Exchange Heist
      • Installation
      • Dependencies
    • Drugs V: Grow, Cook & Space!
      • Installation
      • Configuration Guide
    • Drugs V: Laboratories
      • Installation
      • Configuration Guide
    • Drugs V: Goods Deal
      • Installation
      • Configuration Guide
    • Drugs V: Business Labs
      • Installation
      • Configuration Guide
    • Drugs V: Effects
      • Installation
      • Configuration Guide
      • Exports
    • Drugs V: Money Laundering
      • Installation
      • Configuration Guide
    • Bank Truck Robbery - 4 in 1!
      • Installation
      • Dependencies
      • Translate Strings
      • Discord Log
      • Events & Exports
      • Disable Mission NPC
    • House Robbery with Welding Minigame
      • Installation
      • Dependencies
      • Inventory Integration
      • Translate Strings
      • Discord Log
      • Creating a House for Robbery
      • Events & Exports
      • Disable Mission NPC
    • Lootbag
      • Installation
    • Bounty Board
      • Installation
    • Chopshop with Welding Minigame
      • Installation
      • Dependencies
      • Translate Strings
      • Discord Log
      • Events & Exports
      • Disable Mission NPC
    • Scenes: Draw everywhere
      • Installation
      • Add Text Font
      • Events & Exports
    • Vault Heist
      • Installation
      • Vehicle Mods
      • Dependencies
    • Barge Heist
      • Installation
      • Dependencies
    • Towtruck + Missions
      • Installation
    • Zombies & Dungeon
      • Installation
      • Rarity System
    • Gangs - Territory, Wars & Tribute Zones!
      • Installation
      • Add Gang & Tribute Zone
      • Events & Exports
      • Gang System for ESX
    • Camper V: Drug Caravans
      • Installation
      • Dependencies
    • Realistic Airdrop
      • Installation
    • ATM Robbery - 4 in 1!
      • Installation
    • Bobcat Security Heist
      • Installation
      • Dependencies
    • Minigame Bundle
      • Installation
      • Minigame Exports
      • Translate Strings
    • Weapon V: Realism
      • Installation
    • Boombox with Watch Party
      • Installation
      • Youtube API Key
      • Exports
    • Drop and Dead Info.
      • Installation
    • Throw Everything
      • Installation
      • Useable Items
      • Exports
      • QBCore Compatibility
      • ESX Compatibility
    • Police Riot with Interior
      • Installation
      • Dependencies
    • Dialog with NPC
      • Installation
    • Gun Store Heist
      • Installation
      • Dependencies
    • Emoji V: Share Feelings
      • Installation
    • Illegal Corners: Selling Goods
      • Installation
      • Adding a New Corner
    • Decal V: Graffiti & Vehicle Sticker
      • Installation
      • Custom Decal
      • Events & Exports
    • Hacker V: Become Hacker
      • Installation
      • Custom Hack
      • Functions & Events
    • Weed Shop Heist
      • Installation
      • Dependencies
    • Jailbreak
      • Installation
      • Dependencies
    • Vangelico Heist Final
      • Installation
      • Dependencies
    • Pets
      • Installation
      • QBCore Compatible
    • Artifact Heist
      • Installation
    • Betta Heist
      • Installation
    • Oil Rig Heist
      • Installation
      • Dependencies
    • Fleeca Heist Final
      • Installation
      • Dependencies
    • Deluxe Car Heist
      • Installation
    • Yacht Heist
      • Installation
    • Paleto Heist
      • Installation
    • Union Heist
      • Installation
    • Shop Robbery
      • Installation
    • Drug Boat Heist
      • Installation
    • Underground Heist
      • Installation
      • Dependencies
    • Van Heist
      • Installation
      • Dependencies
    • Pacific Heist
      • Installation
      • Dependencies
    • Train Heist
      • Installation
    • Humane Labs Heist
      • Installation
    • Vangelico Heist
      • Installation
    • Fleeca Heist
      • Installation
    • Casino Heist
      • Installation
      • Dependencies
      • Compatible For Rcore
    • Art Heist
      • Installation
      • Dependencies
    • Kidnapping
      • Installation
    • Graffiti War
      • Installation
Powered by GitBook
On this page
  • Step 1: Find
  • Step 2: Add Function
  • Step 3: Find weapons:client:DrawWeapon Event
  • Additional
  1. RESOURCES
  2. Throw Everything

QBCore Compatibility

If you are using qb-core and qb-smallresources you should do the following steps

Step 1: Find

qb-smallresources/client/weapdraw.lua

or

qb-weapons/client/weapdraw.lua

Open this file with Notepad++ or VSCode.

Step 2: Add Function

Find an empty space and paste the code block below.

rmThrow = function(weapon)
	if GetResourceState("rm_throw") and GetResourceState("rm_throw") == "started" then
		if weapon == "item" and exports["rm_throw"]:useItem() then
			return false
		end
		
		if weapon == GetHashKey("WEAPON_SNOWBALL") then
			return false
		end

		if exports["rm_throw"]:useItem() then
			return false
		end
	end

	if GetResourceState("rm_weaponv") and GetResourceState("rm_weaponv") == "started" then
		return weaponState
	end

	return true
end

Step 3: Find weapons:client:DrawWeapon Event

Find this weapons:client:DrawWeapon event in the file and replace it with the block of code below.

RegisterNetEvent('weapons:client:DrawWeapon', function()
    if GetResourceState('qb-inventory') == 'missing' then return end -- This part is only made to work with qb-inventory, other inventories might conflict
    local sleep
    local weaponCheck = 0
    while true do
        local ped = PlayerPedId()
        sleep = 250
        if DoesEntityExist(ped) and not IsEntityDead(ped) and not IsPedInParachuteFreeFall(ped) and not IsPedFalling(ped) and (GetPedParachuteState(ped) == -1 or GetPedParachuteState(ped) == 0) then
            sleep = 0
            if currWeap ~= GetSelectedPedWeapon(ped) then
                local pos = GetEntityCoords(ped, true)
                local rot = GetEntityHeading(ped)

                local newWeap = GetSelectedPedWeapon(ped)
                if rmThrow(newWeap) then
                    SetCurrentPedWeapon(ped, currWeap, true)
                    loadAnimDict('reaction@intimidation@1h')
                    loadAnimDict('reaction@intimidation@cop@unarmed')
                    loadAnimDict('rcmjosh4')
                    loadAnimDict('weapons@pistol@')

                    local holsterVariant = GetPedDrawableVariation(ped, 8)
                    wearingHolster = false
                    for i = 1, #Config.WeapDraw.variants, 1 do
                        if holsterVariant == Config.WeapDraw.variants[i] then
                            wearingHolster = true
                        end
                    end

                    if checkWeapon(newWeap) then
                        if holstered then
                            if wearingHolster then
                                --TaskPlayAnim(ped, 'rcmjosh4', 'josh_leadout_cop2', 8.0, 2.0, -1, 48, 10, 0, 0, 0 )
                                canFire = false
                                CeaseFire()
                                currHolster = GetPedDrawableVariation(ped, 7)
                                currHolsterTexture = GetPedTextureVariation(ped, 7)
                                TaskPlayAnimAdvanced(ped, 'rcmjosh4', 'josh_leadout_cop2', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(300)
                                SetCurrentPedWeapon(ped, newWeap, true)

                                if isWeaponHolsterable(newWeap) then
                                    SetPedComponentVariation(ped, 7, currHolster == 8 and 2 or currHolster == 1 and 3 or currHolster == 6 and 5, currHolsterTexture, 2)
                                end
                                currWeap = newWeap
                                Wait(300)
                                ClearPedTasks(ped)
                                holstered = false
                                canFire = true
                            else
                                canFire = false
                                CeaseFire()
                                TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(1000)
                                SetCurrentPedWeapon(ped, newWeap, true)
                                currWeap = newWeap
                                Wait(1400)
                                ClearPedTasks(ped)
                                holstered = false
                                canFire = true
                            end
                        elseif newWeap ~= currWeap and checkWeapon(currWeap) then
                            if wearingHolster then
                                canFire = false
                                CeaseFire()

                                TaskPlayAnimAdvanced(ped, 'reaction@intimidation@cop@unarmed', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(500)

                                if isWeaponHolsterable(currWeap) then
                                    SetPedComponentVariation(ped, 7, currHolster, currHolsterTexture, 2)
                                end

                                SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
                                currHolster = GetPedDrawableVariation(ped, 7)
                                currHolsterTexture = GetPedTextureVariation(ped, 7)

                                TaskPlayAnimAdvanced(ped, 'rcmjosh4', 'josh_leadout_cop2', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(300)
                                SetCurrentPedWeapon(ped, newWeap, true)

                                if isWeaponHolsterable(newWeap) then
                                    SetPedComponentVariation(ped, 7, currHolster == 8 and 2 or currHolster == 1 and 3 or currHolster == 6 and 5, currHolsterTexture, 2)
                                end

                                Wait(500)
                                currWeap = newWeap
                                ClearPedTasks(ped)
                                holstered = false
                                canFire = true
                            else
                                canFire = false
                                CeaseFire()
                                TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'outro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(1600)
                                SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
                                TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(1000)
                                SetCurrentPedWeapon(ped, newWeap, true)
                                currWeap = newWeap
                                Wait(1400)
                                ClearPedTasks(ped)
                                holstered = false
                                canFire = true
                            end
                        else
                            if wearingHolster then
                                SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
                                currHolster = GetPedDrawableVariation(ped, 7)
                                currHolsterTexture = GetPedTextureVariation(ped, 7)
                                TaskPlayAnimAdvanced(ped, 'rcmjosh4', 'josh_leadout_cop2', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(300)
                                SetCurrentPedWeapon(ped, newWeap, true)

                                if isWeaponHolsterable(newWeap) then
                                    SetPedComponentVariation(ped, 7, currHolster == 8 and 2 or currHolster == 1 and 3 or currHolster == 6 and 5, currHolsterTexture, 2)
                                end

                                currWeap = newWeap
                                Wait(300)
                                ClearPedTasks(ped)
                                holstered = false
                                canFire = true
                            else
                                SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
                                TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(1000)
                                SetCurrentPedWeapon(ped, newWeap, true)
                                currWeap = newWeap
                                Wait(1400)
                                ClearPedTasks(ped)
                                holstered = false
                                canFire = true
                            end
                        end
                    else
                        if not holstered and checkWeapon(currWeap) then
                            if wearingHolster then
                                canFire = false
                                CeaseFire()
                                TaskPlayAnimAdvanced(ped, 'reaction@intimidation@cop@unarmed', 'intro', pos.x, pos.y, pos.z, 0, 0, rot, 3.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(500)

                                if isWeaponHolsterable(currWeap) then
                                    SetPedComponentVariation(ped, 7, currHolster, currHolsterTexture, 2)
                                end

                                SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
                                ClearPedTasks(ped)
                                SetCurrentPedWeapon(ped, newWeap, true)
                                holstered = true
                                canFire = true
                                currWeap = newWeap
                            else
                                canFire = false
                                CeaseFire()
                                TaskPlayAnimAdvanced(ped, 'reaction@intimidation@1h', 'outro', pos.x, pos.y, pos.z, 0, 0, rot, 8.0, 3.0, -1, 50, 0, 0, 0)
                                Wait(1400)
                                SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
                                ClearPedTasks(ped)
                                SetCurrentPedWeapon(ped, newWeap, true)
                                holstered = true
                                canFire = true
                                currWeap = newWeap
                            end
                        else
                            SetCurrentPedWeapon(ped, newWeap, true)
                            holstered = false
                            canFire = true
                            currWeap = newWeap
                        end
                    end
                end
            end
        end
        Wait(sleep)
        if currWeap == nil or currWeap == `WEAPON_UNARMED` then
            weaponCheck += 1
            if weaponCheck == 2 then
                break
            end
        end
    end
end)

Additional

If you cannot make this change correctly, you can download the file below and replace it with qb-smallresources/client/weapdraw.lua.

PreviousExportsNextESX Compatibility

Last updated 5 months ago

14KB
weapdraw.lua