Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Sony's Smart Shipment Box
- @inputs [EGP]:wirelink [User]:entity Ranger
- @outputs ShipmentUser
- @persist CanSell
- @trigger
- # SmartContainer V0.2
- # Made by Sony - https://steamcommunity.com/id/Sony_08/
- # Hit me up if you have any questions or feedback!
- # --== SmartContainer Config: ==-- #
- GunName = "Deagle" # What gun are we selling? (String)
- GunPrice = 200 # For what price? (Number)
- # By default this uses some sounds from TF2 because they sound better IMO.
- # For those that don't want to use TF2 content, just change these vars to use HL2 sounds instead.
- Sound_Purchase = "mvm/mvm_bought_upgrade.wav" # What sound plays when someone buys something? (string)
- Sound_Failed = "mvm/mvm_money_vanish.wav" # What sound plays when there is a problem. (string)
- # Your local or preferred currency symbol.
- CurrencySymbol = "£"
- # --== End of config, don't edit below here unless you know what you're doing. ==-- #
- if(first() || dupefinished())
- {
- ShipmentUser = 0
- function void prefixPrint(Text:string)
- {
- printColor(vec(100, 100, 255), format("\n[%s]", "SmartContainer"), vec(180), " : ", Text)
- }
- function void wirelink:mainScreen()
- {
- This:egpClear()
- This:egpBox(1, vec2(256), vec2(512))
- This:egpColor(1, vec(25))
- This:egpCircle(2, vec2(256), vec2(196))
- This:egpColor(2, vec(35))
- # What gun are we selling?
- This:egpText(3, GunName, vec2(256, 190))
- This:egpAlign(3, 1, 1)
- This:egpSize(3, 100)
- # For what price?
- This:egpText(4, CurrencySymbol+GunPrice, vec2(256, 276))
- This:egpAlign(4, 1, 1)
- This:egpSize(4, 80)
- # Smaller text underneath tells people what to do.
- This:egpText(5, "Press E to buy", vec2(256, 340))
- This:egpAlign(5, 1, 1)
- This:egpSize(5, 50)
- }
- # What shows on the screen when somone purchases our contents:
- function void wirelink:purchasedScreen()
- {
- EGP:entity():soundPlay(1, 1, Sound_Purchase)
- EGP:egpSetText(3, "Thanks!")
- EGP:egpSetText(4, ":)")
- EGP:egpSetText(5, "Enjoy")
- EGP:egpColor(3, vec(0, 255, 0))
- ShipmentUser = 1
- timer("Reset", 3000)
- }
- # What shows on the screen when somone tries to buy, but can't:
- function void wirelink:failedScreen()
- {
- EGP:entity():soundPlay(1, 1, Sound_Failed)
- EGP:egpSetText(3, "Failed.")
- EGP:egpSetText(4, ":(")
- EGP:egpSetText(5, "Not enough?")
- EGP:egpColor(3, vec(255, 0, 0))
- timer("Reset", 3000)
- }
- EGP:mainScreen()
- if (Ranger == 0) {
- prefixPrint("\nYour container with stock '"+GunName+"' is empty and needs refilling!\nContainer will reboot in 2 minutes.")
- EGP:egpSetText(3, "Empty")
- EGP:egpSetText(4, ":(")
- EGP:egpSetText(5, "Try again later")
- EGP:egpColor(3, vec(255, 0, 0))
- CanSell = 0
- timer("Reset", 120000)
- }
- else
- {
- CanSell = 1
- }
- }
- # Was the execution caused by a change in the input "User"
- elseif(~User & User)
- {
- if(CanSell == 1) {
- CurPly = User
- EGP:mainScreen()
- moneyRequest(CurPly,GunPrice,"Purchase 1x "+GunName+" from SmartContainer:")
- }
- else
- {
- prefixPrint("Someone tried to buy your stuff but we're out of stock!")
- EGP:entity():soundPlay(1, 1, Sound_Failed)
- }
- }
- # Purchase success!
- if(moneyClk()){
- prefixPrint("Someone bought 1x '"+GunName+"' from your SmartContainer!")
- EGP:purchasedScreen()
- }
- # Purchase failed, they clicked no or it timed out.
- if(moneyNoClk() | moneyTimeout()){
- EGP:failedScreen()
- }
- if(clk("Reset"))
- {
- reset()
- }
Advertisement
Add Comment
Please, Sign In to add comment