Difference between revisions of "DarkRP:CustomShipmentFields"

From Official DarkRP Wiki
Jump to navigation Jump to search
(Example with all fields)
(Example with all fields)
Line 18: Line 18:
 
weight = 15, -- OPTIONAL, the weight of the shipment. The default is the weight of the shipment  
 
weight = 15, -- OPTIONAL, the weight of the shipment. The default is the weight of the shipment  
 
         buttonColor = Color(255, 255, 255, 255), -- Optional: The color of the button in the F4 menu,
 
         buttonColor = Color(255, 255, 255, 255), -- Optional: The color of the button in the F4 menu,
 
+
        label = "Super pistol", -- Optional: the text on the button in the F4 menu
  
 
-- Advanced, optional
 
-- Advanced, optional

Revision as of 14:14, 21 December 2013

This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | Russia-flag.png Русский


Custom shipment fields

You can create custom shipments in DarkRP. However, there are many things to fiddle with. This page explains every single "field".

Example with all fields

Here's an example with all available fields filled in:

AddCustomShipment("Example shipment", {
	model = "models/weapons/w_pist_fiveseven.mdl", -- The model of the item that hovers above the shipment
	entity = "weapon_fiveseven2", -- the entity that comes out of the shipment
	price = 100, -- the price of one shipment
	amount = 10, -- how many of the item go in one purchased shipment
	separate = true, -- whether the item is sold separately (usually used for guns)
	pricesep = 100, -- the price of a separately sold item
	noship = false, -- whether this item has a shipment
	allowed = {TEAM_GUN, TEAM_MEDIC}, -- OPTIONAL, which teams are allowed to buy this shipment/separate gun
	shipmodel = "models/items/item_item_crate.mdl", -- OPTIONAL, the model of the shipment (this crate is the default)
	customCheck = function(ply) return ply:Frags() < 10 end, -- OPTIONAL, extra conditions before people can purchase the shipment or separate item
	weight = 15, -- OPTIONAL, the weight of the shipment. The default is the weight of the shipment 
        buttonColor = Color(255, 255, 255, 255), -- Optional: The color of the button in the F4 menu,
        label = "Super pistol", -- Optional: the text on the button in the F4 menu

	-- Advanced, optional
	shipmentClass = "spawned_shipment", -- The classname of the shipment entity. Use this if you have made a different shipment entity
	onBought = function(ply, shipment, ent) end, -- function that is called when the shipment is bought
	getPrice = function(ply, price) return ply:GetNWString("usergroup") == "donator" and price * 0.9 or price end, -- function to decide what the price is based on the player
})

Notes

If you set shipmentClass to something other than the default, make sure the shipment entity has implemented the function SetContents(ShipmentID, Count).