Throw Everything

Installation

Instructions on how to download and install the basics of Throw Everything.

Download

After you bought Throw Everything, you will see those on your Keymaster page. Download these.

Configure (cfg.lua)

  • You can easily add new items and objects.

  • You can adjust keys, global objects, locales and items.

  • You can set other configurations.


Do not add weapons in the throwItems section.
```lua
    framework = {
        name = 'ESX',                       -- Only ESX or QB.
        scriptName = 'es_extended',            -- Framework script name work framework exports. (Example: qb-core or es_extended)
        eventName = 'esx:getSharedObject', -- If your framework using trigger event for shared object, you can set in here.
    },
    -- WARNING: Default mode will consume more ms. This option may cause performance loss!
    targetScript = 'ox_target',             -- Target script name (qtarget or qb-target or ox_target or default (for showhelpnotification))
    iconsPath = 'ox_inventory/web/images', --change this example for ox: 'ox_inventory/web/images'
    saveItems = true, -- When you restart the server, items will spawn.
    dropWeaponDie = true,
    blacklistWeapons = {
        ["WEAPON_RPG"] = true,
    },
    throwItems = { -- do not add weapons. Weapons are added automatically.
        ['sandwich'] = {
            label = 'Sandwich',
            propModel = 'prop_sandwich_01',
            offset = vec3(0.0, 0.0, 0.0),
            rotation = vec3(0.0, 0.0, 0.0),
        },
        ['tablet'] = {
            label = 'Tablet',
            propModel = 'prop_cs_tablet_02',
            offset = vec3(0.0, 0.0, 0.0),
            rotation = vec3(0.0, 0.0, 0.0),
        },
    },
    globalObjects = { -- Large objects cannot be thrown.
        ['prop_postbox_01a'] = {
            throwable = false,
            canPutTrunk = true,
        },
    },
    keys = {
        takeKey = 38,
        keyText = 'E',
        vehicleThrowKey = 38,
        dropModeKey = 38,
        cancelDropMode = 47,
        putTrunkKey = 73,
        takeObjectKey = 38,
        dropObjectKey = 47,
    },
    useableItemCooldown = 5000, -- for useable items export
```

Ox Inventory

  • If you are using ox inventory, you should add the code blocks below to the places shown in the screenshots.

Add the following code anywhere in ox_inventory/client.lua

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
	return true
end
  • You should replace the following codes with the code in the ox_inventory/client.lua > ox_inventory:setPlayerInventory event as shown in the screenshot.

if currentWeapon then
    if rmThrow(weaponHash) and weaponHash ~= currentWeapon.hash and currentWeapon.timer then
        local weaponCount = Items[currentWeapon.name]?.count

        if weaponCount > 0 then
            SetCurrentPedWeapon(playerPed, currentWeapon.hash, true)
            SetAmmoInClip(playerPed, currentWeapon.hash, currentWeapon.metadata.ammo)
            SetPedCurrentWeaponVisible(playerPed, true, false, false, false)

            weaponHash = GetSelectedPedWeapon(playerPed)
        end

        if rmThrow("item") and weaponHash ~= currentWeapon.hash then
            currentWeapon = Weapon.Disarm(currentWeapon, true)
        end
    end
elseif client.weaponmismatch and not client.ignoreweapons[weaponHash] then
    local weaponType = GetWeapontypeGroup(weaponHash)

    if weaponType ~= 0 and weaponType ~= `GROUP_UNARMED` and rmThrow("item") then
        Weapon.Disarm(currentWeapon, true)
    end
end

If you do not have any changes in the ox_inventory/client.lua section, you can use this file.

ESX

  • For esx, you must add the following export to the es_extended/server/common.lua content.

exports("checkUsableItem", function(itemName)
    return Core.UsableItemsCallbacks[itemName]
end)

QBCore

  • If you are using qb and qb-smallresources, you must add the code block below as shown in the screenshot.

rmThrow = function(weapon)
	if not GetResourceState("rm_throw") or GetResourceState("rm_throw") ~= "started" then
		return true
	end
	
	if weapon == GetHashKey("WEAPON_SNOWBALL") then
		return false
	end
	
	if weapon == "item" and exports["rm_throw"]:useItem() then
		return false
	end
	
	if exports["rm_throw"]:useItem() then
		return false
	end
	
	return true
end
  • You should replace the following codes with the code in the qb-smallresources/client/weapdraw.lua > weapons:client:DrawWeapon event.

If you receive WeapDraw error in F8 Console after doing this, you should update your qb-smallresources script.

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)

If you do not have any changes in the qb-smallresources/client/weapdraw.lua section, you can use this file.

Useable Items

  • In order to throw useable items, you must add the following export to the event of the useable item.

if not exports["rm_throw"]:useableItem(itemName) then
    return
end

Install

If you do not start the script in server.cfg but start it after entering the game, it will not work.

  • After basic configures, add these line to your server.cfg.

ensure rm_stream
ensure rm_throw

In-Game

  • If you did everything right, you can now throw items, objects and items.

Last updated