Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Again, this is all a prototype, shouldn't be taken seriously, I didn't think alot about it, started writting what had made sense for me at the time.
- SRH.Shipments = SRH.Shipments or {}
- SRH.Shipments.All = {}
- function SRH.Shipments:Register( class, single, type, model, amount, price, name, access )
- self.All[ name ] = { class, single, type, model, amount, price, name, access }
- end
- function SRH.Shipments:Buy( ply, shipmentname )
- local shipment = self.All[ shipmentname ]
- if not ply:CanAfford( shipment.price ) then
- ply:Error( "You can't afford this " .. shipment.name .. " ($" .. shipment.price .. ")!" )
- return
- end
- if shipment.single then
- ply:AddMoney( -shipment.price )
- local ship = ents.Create( shipment.class )
- ship:SetPos( ply:GetEyeTrace().HitPos + Vector( 0, 0, 10 ) )
- ship:Spawn()
- return
- else
- ply:AddMoney( -shipment.price )
- local ship = ents.Create( "shipment_base" )
- ship:SetModel( shipment.model )
- ship.ShipmentName = shipment.name
- ship.Amount = shipment.amount
- ship.Container = shipment.class
- end
- end
- -- examples
- -- SRH.Shipments:Register( "weapon_pist_deagle", true, "gun", "deaglemodel.mdl", 1, 300, "Desert Eagle", { {"Trader", 3}, {"Arms Dealer", 1} } )
- -- SRH.Shipments:Register( "weapon_snip_scout", false, "gun", "scoutmodel.mdl", 5, 2000, "Scout Shipment", { {"Arms Dealer", 1} } )
- -- SRH.Shipments:Register( "drug_lsd", true, "drug", "lsdmodel.mdl", 1, 400, "LSD", { {"Trader", 2} } )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement