Courier Script


  • Don't even know why I named it courier edition...

    Factories

    Factories are where players can buy products to sell. They have a blue marker & blip. Blip_475.png

    Factories start with 0 stock and make product every factoryProductInterval seconds until they reach factoryMaxAutoStock value.

    You can also get a refund for the product you're carrying. (If your product and the factory are the same type!)

    Buyers

    Buyers are where players can sell their products. They have a green marker & blip. Blip_500.png

    Buyers start with 0 stock and can buy product from players until they reach their max. stock.

    When a buyer reaches their max. stock, they will start to "sell" product (aka getting rid of them) every buyerSaleInterval seconds until they reach down to buyerMinStockPercentage% capacity.

    Selling your products to a buyer results in profit while selling it to a factory just gives a refund.

    Products & Vehicles

    You can load products to certain vehicles because no one wants to walk 3.5 km just to sell one product. These vehicles are supported by default:

    • Burrito3 (6 product)
    • Rumpo (6 product)
    • Speedo (4 product)
    • Youga (4 product)

    To interact with a supported model, just press E when you're behind them.

    Settings (meta.xml)

    Name Description Default Value
    saveInterval Seconds that need to pass between two save operations. (will always save on script exit) 120
    worldPropLife Minutes a dropped product/box has before getting removed. 10
    factoryProductInterval Seconds that need to pass before an empty factory makes 1 product. 180
    factoryMaxAutoStock Amount of stock a factory needs to stop auto-generating product. 10
    buyerSaleInterval Seconds that need to pass before a full buyer sells 1 product. 180
    buyerMinStockPercentage Percentage of stock a buyer needs to stop auto-selling product. 50

    Adding a Product

    Here's how you can add more products:

    • Add it to Enums.cs
    • Add it to the Products dictionary in ProductDefinitions.cs
    • Add it's player attachment offsets to Offsets.cs
    • Rebuild

    Adding a Vehicle Model

    Here's how you can allow a vehicle model to be used in transporting:

    • Make sure the model you want to add has the platelight bone. (used for detection)
    • Add vehicle hash and attachment offsets to VehicleAttachmentOffsets.cs
    • Add vehicle hash(int) to courierVehicles array in Courier.js
    • Rebuild

    Commands & Controls

    Command Description
    /cfactory admin Creates a factory on your position.
    /setfactorystock admin Sets the stock of the factory you're standing in the ColShape of.
    /rfactory admin Removes the factory you're standing in the ColShape of.
    /cbuyer admin Creates a buyer on your position.
    /setbuyerstock admin Sets the stock of the buyer you're standing in the ColShape of.
    /setbuyermaxstock admin Sets the max. stock of the buyer you're standing in the ColShape of.
    /rbuyer admin Removes the buyer you're standing in the ColShape of.
    E Key Main interaction key, used for accessing vehicle, factory & buyer menu and picking up product on the ground.
    X Key Drop product key. Allows you to drop the product you're carrying, be aware of sneaky players though since they can take it!

    Notes

    • This script needs MoneyAPI to work properly.
    • Source code can be found in the Courier folder inside the archive.
    • Commands marked with the admin label use GetPlayerAclGroup. If you're not using ACL, consider editing the script/commands to work with your admin script.
    • This script doesn't handle vehicles being removed by API.deleteEntity or vehicle.delete(). Which means if you remove a vehicle that has product loaded inside, box props won't be removed.
  • Why couldn't you make two versions?

    1. Dll (like now not changeable for those who don't have Visual Studio software)

    2. C# for those who want to change some parameters and not to be fed up with compiling it to dll.


    It would be great, really.

    Thx.

    The post was edited 3 times, last by linnik ().

  • Thank you for the script.

    I'm able to set the factory and buyer area, I have also set the stock of the factory and buyers, but I'm not able to interact wie "E"?!


    Do you maybe have an idea what I'm doing wrong?
    Is there something else required?
    The moneyAPI resource is activated.


    Code
    1.  <resource src="admin" />
    2.   <resource src="eac" />
    3.   <resource src="action" />
    4.   <resource src="corso-rp" />
    5.   <resource src="moneyAPI" />
    6.   <resource src="house" />
    7.   <resource src="courier" />


    Thanks.

  • rootcause added a new file: