[Release] Crate Drop

About

I decided to make a short script to imitate the Merryweather crate drops in GTA Online.


Features

  • The crate is dropped by a plane that flies overhead.
  • The crate contains whatever weapon the player called through the command.
  • A parachute is attached to the crate while it’s falling down.
  • The crate has a beeping sound, just like in GTAO.
  • A flare gets deployed wherever the crate lands.

Usage

For example
/cratedrop minigun 100 true 400.0
will drop a crate containing a minigun with 100 rounds with roofCheck being done beforehand and plane will be spawned 400 metres away, if no ammo count is specified then the script will default to 250 rounds. If roofCheck is false or not entered, then it will be skipped. If planeSpawnDistance is not specified, it’ll be 400 metres.


Notes

  • Thanks to everyone in Discord, especially Throwarray who helped me make this and understand Rockstar’s code.
  • Let me know about the bugs you encounter.

Download
The resource can be downloaded at my Github as a zip file.


Changelog

v2.0

  • Command has changed to /cratedrop, only the weapon is required as an argument, but accepts /cratedrop minigun 50 true 1000 where 50 is ammo, true is for roofCheck and 1000 is planeSpawnDistance.
  • Got rid of weaponTable entirely for interpreting commands, for example, pistol gets converted to pickup_weapon_pistol automatically along with weapon_pistol. This means all weapons are supported
  • Plane spawn location is now RNG at the given distance (400 metres by default).
  • CrateDrop is now an exported function (no error correction, so use it right) for developers with parameters such as weapon (must use exact name of pickup), ammo, planeSpawnDistance (how far away to spawn plane), dropCoords(expects a dictionary table with x, y, z values).
  • “crateDrop” is an event (does error checking and correction) with parameters such as weapon (expects for example smg or weapon_smg or pickup_weapon_smg, but only works with weapons, doesn’t accept other pickups, use the function to bypass this), ammo, roofCheck (bool, if true then checks if plane is capable of dropping a crate to specified coordinates), planeSpawnDistance, dropCoords.
  • When the resource gets stopped, the resource cleans up after itself, removing objects, pickups, planes
  • If the crate is dropped and picked up early enough by a player so the flare isn’t deployed yet, the flare gets deleted. I was unable to find a way to get rid of it after it deployed.

v1.2

  • Added support for Scammer’s Universal Menu and the event “Cratedrop:Execute” now accepts parameters in a more logical manner.

v1.1

  • Slight code optimization, actually commented the code, removed unnecessary stuff and added a lot more weapons to the drop list.

v1.0

  • Initial release
33 Likes

Nice! Would be pretty awesome if the crate drops randomly in certain random positions.
But anyways, keep up the good work!

3 Likes

I wholeheartedly concur

Would it be OK if we take this and make it into a global loot box system?

(/s)

1 Like

just tried all seems fine on cmds, just when plane comes it crashes, no flare and the box/crate or what ever it is, is invisible and cant to anything with it :thinking:

Hell yeah! Weapon tints are underutilized anyway.

1 Like

I don’t know what to say, it’s working fine on my end. Could it be another resource interfering with cratedrop?

1 Like

Thanks for the kind words, but I don’t plan on doing it, you could do it yourself if you want. It should be a few rather simple changes to the script.

1 Like

Is it possible to make the drop contain drugs like coke or weed in a easy way?

Drugs like an RP thing? Sure, just make it give the player coke/weed once the pickup disappears (aka is picked up by a player). However I’m not sure how to do CreateAmbientPickup() without actually giving the player a weapon, as one of the parameters requires a weapon.

1 Like

Yeah drug like in RP, an item. I will try to edit myself and see if I can come up with something :slight_smile:

I love this script!!! Question is it possible to include own items? that will be fantastic! Like a Rescuepack (flare, flargun and bread with water) :wink: or ony one of such things

Yes you need to find the pickup hash for said pickup.

Flare, falregun are optiions but not all pickups are all what you want, look up “GTA 5 Pickup Hash List” or use this for help on which you can use. Items with “PICKUP_” are the ones you want to use then just add them to the weaponList table.

https://wiki.fivem.net/wiki/Weapons#PICKUPS

1 Like

Is there a way to add more pick up items in 1 crate drop? I tried this but, that’s not working.

At least you tried, but CreateAmbientPickup() will only accept a single pickup hash. You can’t give it a table. I’m not quite sure how it would have to be done, but I’ll let you know when I think of something. Because I don’t think you can receive 2 items from a single pickup even in GTAO, correct me if I am wrong.

1 Like

This could maybe like make a loop around that. If for example someone types /drop supplies that 3 crates get dropped, 1 with health, weapon and armor.

Perhaps use a smaller model for the pickup and fit the three pickups in a single crate all right next to eachother. Or… drop one pickup and check when that pickup is picked up by a player, give them the other stuff as well at the same time, creating the illusion of getting 3 items from a single pickup. Only problem would be that I don’t know how to check who actually picked up the pickup, it might not always be the one who called down the pickup. Also I think I’ll push an update to cratedrop as well.

Edit:

New version out!

v1.1
Added slight code optimization, actually commented code, removed unnecessary stuff and added a lot more weapons to the drop list.

1 Like

how to install: start cratedrop¿ start cratedrop-1.1

I’m not quite sure what you’re asking, if you want to start the resource, then make sure it’s in your resources folder and enter start cratedrop or whatever else name you gave to the resource.

1 Like