Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name lShop 3
- @inputs EGP:wirelink [P U]:entity
- @outputs [Fire Door]:number
- @persist User:entity
- @persist [StoreName Code Version NewVersion SoundPath]:string
- @persist [State E Scan SScan TimerCheck Profit Request Hack Percent CheckOnStart CheckUpdate Update Mode GAIN]:number
- @persist PStart:vector
- @persist Shipments:array
- interval(100)
- runOnChat(1)
- runOnHTTP(1)
- if(first()){
- StoreName = "L-Shop 3"
- CheckOnStart = 0 #<-- If 1, the chip will check for an update once placed.
- Mode = 0 #<-- Selects mode. (1 = Props, Music, Animated etc.) (0 = Normal, no props no music etc.)
- SoundPath = "ambient/music/country_rock_am_radio_loop.wav" #<-- Sound path for the music played. (Default: ambient/music/country_rock_am_radio_loop.wav)
- TimerCheck = 10 #<-- Seconds between each silent scan.
- function number onClick(ID) {
- local Cursor = EGP:egpCursor(User)
- local Size = EGP:egpSize(ID) / 2
- local A = EGP:egpPos(ID) + Size
- local B = EGP:egpPos(ID) - Size
- local Max = max(A, B)
- local Min = min(A, B)
- return inrange(Cursor, Min, Max)
- }
- function number entity:sound(ID:number,S:string) {
- This:soundPlay(ID,0,S)
- return 1
- }
- function void cMsg(Text:string) {
- printColor(vec(),"[",vec(32,178,170),"L-Shop 3",vec(),"] ",vec(255,150,0),Text:replace("%red",""):replace("%no",""))
- }
- Scan = 1
- SScan = 0
- State = 0
- Version = "v2.9"
- PStart = P:pos()
- cMsg("Welcome " + owner():name() + " to L-Shop 3 CMD Style")
- timer("check_update_on_start",2000)
- }
- if(clk("check_update_on_start")){
- if(CheckOnStart){
- CheckUpdate = 1
- } else {
- cMsg("Update Check: Disabled.")
- }
- }
- if(changed(round(State))){
- local State = round(State)
- EGP:egpClear()
- EGP:egpBox(1,vec2(256,256),vec2(526,526))
- EGP:egpColor(1,vec(35,35,35))
- EGP:egpBox(2,vec2(256,31),vec2(512,60))
- EGP:egpColor(2,vec(255,215,0))
- EGP:egpBoxOutline(3,vec2(256,31),vec2(512,60))
- if(State == 0){
- EGP:egpText(4,StoreName,vec2(156,31))
- EGP:egpAlign(4,2,1)
- EGP:egpSize(4,40)
- EGP:egpLine(5,vec2(112,60),vec2(112,512))
- EGP:egpSize(5,2)
- EGP:egpLine(6,vec2(412,60),vec2(412,512))
- EGP:egpSize(6,2)
- EGP:egpText(7,"Press E to begin",vec2(256,256))
- EGP:egpSize(7,35)
- EGP:egpAlign(7,1)
- }
- if(State == 1){
- #Basically this is like a shitty intro with animations, bla bla hacker style etc. OPS rush inbound :D
- EGP:egpText(4,"Launching C:/Users/Liam/Store.exe",vec2(456,31))
- EGP:egpAlign(4,2,1)
- EGP:egpSize(4,30)
- EGP:egpBox(8,vec2(156,133),vec2(230,30))
- EGP:egpText(9,"Command Prompt - X",vec2(46,123))
- EGP:egpSize(9,20)
- EGP:egpColor(9,vec(0,0,0))
- EGP:egpBox(10,vec2(156,266),vec2(230,240))
- EGP:egpColor(10,vec(0,0,0))
- EGP:egpText(11,"Microsoft Windows [Version 10.0.10586]",vec2(46,150))
- EGP:egpSize(11,10)
- EGP:egpText(12,"exec 'C:/Users/Liam/Store.exe'",vec2(46,160))
- EGP:egpSize(12,10)
- EGP:egpAlpha(12,0)
- EGP:egpText(13,"C:/Users/Liam/Store.exe starting...",vec2(46,170))
- EGP:egpSize(13,10)
- EGP:egpAlpha(13,0)
- EGP:egpText(14,"C:/Users/Liam/Store.exe loaded",vec2(46,180))
- EGP:egpSize(14,10)
- EGP:egpAlpha(14,0)
- if(Shipments:count() < 1){
- EGP:egpText(15,"ERROR Couldn't include C:/Users/Liam/Shipments.pby",vec2(46,190))
- EGP:egpSize(15,10)
- EGP:egpAlpha(15,0)
- EGP:egpText(16,"Exitting CMD",vec2(46,200))
- EGP:egpSize(16,10)
- EGP:egpAlpha(16,0)
- } else {
- EGP:egpText(15,"Included C:/Users/Liam/Shipments.pby",vec2(46,190))
- EGP:egpSize(15,10)
- EGP:egpAlpha(15,0)
- EGP:egpText(16,"Launching executable",vec2(46,200))
- EGP:egpSize(16,10)
- EGP:egpAlpha(16,0)
- }
- EGP:egpBox(17,vec2(256,233),vec2(230,30))
- EGP:egpAlpha(17,0)
- EGP:egpText(18,"Store.exe - X",vec2(146,223))
- EGP:egpSize(18,20)
- EGP:egpColor(18,vec(0,0,0))
- EGP:egpAlpha(18,0)
- EGP:egpBox(19,vec2(256,276),vec2(230,60))
- EGP:egpColor(19,vec(0,0,0))
- EGP:egpAlpha(19,0)
- EGP:egpBox(20,vec2(256,276),vec2(180,30))
- EGP:egpColor(20,vec(0,0,155))
- EGP:egpAlpha(20,0)
- EGP:egpText(21,"Loaded",vec2(216,263))
- EGP:egpSize(21,25)
- EGP:egpAlpha(21,0)
- }
- if(State == 2){
- EGP:egpText(4,"Application: Store.exe (x64)",vec2(472,31))
- EGP:egpAlign(4,2,1)
- EGP:egpSize(4,40)
- EGP:egpBox(22,vec2(256,100),vec2(356,30))
- EGP:egpBox(23,vec2(256,266),vec2(356,300))
- EGP:egpColor(23,vec(0,0,0))
- EGP:egpBox(24,vec2(406,100),vec2(30,30))
- EGP:egpColor(24,vec(255,255,255))
- EGP:egpText(25,"Store.exe - X",vec2(90,85))
- EGP:egpSize(25,30)
- EGP:egpColor(25,vec(0))
- EGP:egpBox(46,vec2(286,100),vec2(30,30))
- EGP:egpMaterial(46,"vgui/servers/icon_password")
- for(I = 1,Shipments:count()){
- EGP:egpBoxOutline(I + 26,vec2(256,85 + (I * 60)),vec2(296,50))
- if(Shipments[I,entity]){
- EGP:egpText(I + 31,"Purchase "+Shipments[I,entity]:shipmentName()+ " : $"+(Shipments[I,entity]:shipmentPrice() / 10 + Profit),vec2(236,85 + (I * 60) - 10))
- EGP:egpAlign(I + 31, 1)
- EGP:egpBox(I + 38,vec2(393,85 + (I * 60)),vec2(20,48))
- if(User:money() >= (Shipments[I,entity]:shipmentPrice() / 10 + Profit)){
- EGP:egpColor(I + 38,vec(0,255,0))
- } else {
- EGP:egpColor(I + 38,vec(255,0,0))
- }
- }
- }
- if(Shipments:count() > 5){
- EGP:egpBoxOutline(50, vec2(256, 452), vec2(216, 50))
- EGP:egpText(51,"Next Page", vec2(256, 452))
- EGP:egpSize(51, 30)
- EGP:egpAlign(51,1,1)
- }
- }
- if(State == 3){
- EGP:egpText(4,"Application: Thanks.exe (x64)",vec2(472,31))
- EGP:egpAlign(4,2,1)
- EGP:egpSize(4,40)
- EGP:egpText(45,"Thanks for shopping!",vec2(256,256))
- EGP:egpSize(45,30)
- EGP:egpAlign(45,1,45)
- }
- if(State == 4){
- EGP:egpText(4,"Injecting root/bin/inj/boot.pby",vec2(456,31))
- EGP:egpAlign(4,2,1)
- EGP:egpSize(4,30)
- EGP:egpBox(8,vec2(156,133),vec2(230,30))
- EGP:egpText(9,"Command Prompt - X",vec2(46,123))
- EGP:egpSize(9,20)
- EGP:egpColor(9,vec(0,0,0))
- EGP:egpBox(10,vec2(156,266),vec2(230,240))
- EGP:egpColor(10,vec(0,0,0))
- EGP:egpText(11,"Microsoft Windows [Version 10.0.10586]",vec2(46,150))
- EGP:egpSize(11,10)
- EGP:egpText(12,"exec 'root/bin/inj/boot.pby'",vec2(46,160))
- EGP:egpSize(12,10)
- EGP:egpAlpha(12,0)
- EGP:egpText(13,"root/bin/inj/boot.pby starting...",vec2(46,170))
- EGP:egpSize(13,10)
- EGP:egpAlpha(13,0)
- EGP:egpText(14,"root/bin/inj/boot.pby loading " + Percent + "%...",vec2(46,180))
- EGP:egpSize(14,10)
- EGP:egpAlpha(14,0)
- EGP:egpText(15,"root/bin/inj/boot.pby injected.",vec2(46,190))
- EGP:egpSize(15,10)
- EGP:egpAlpha(15,0)
- }
- }
- if(chatClk(owner())){
- local Msg = owner():lastSaid():explode(" ")
- local Cmd = Msg[1,string]
- if(Cmd == "!del"){
- if(Shipments:count() > 0){
- Shipments:clear()
- cMsg("Cleared Array: Shipments")
- } else {
- cMsg("Unable to clear an empty array.")
- }
- }
- if(Cmd == "!profit"){
- hideChat(1)
- if(Msg[2,string] != ""){
- Profit = Msg[2,string]:toNumber()
- cMsg("Profit set to: " + Profit:toString())
- } else {
- cMsg("Please enter a valid number... E.G '!profit 2500'")
- }
- }
- if(Cmd == "!checkupdate"){
- hideChat(1)
- CheckUpdate = 1
- }
- if(Cmd == "!update"){
- hideChat(1)
- Update = 1
- }
- }
- if(Scan == 1){
- findClearBlackList()
- findClearWhiteList()
- findIncludeClass("spawned_shipment")
- findInSphere(entity():pos(),200)
- Shipments = findToArray()
- if(!SScan){
- if(Shipments:count() > 0){
- cMsg("Found: " + Shipments:count() + " shipments!")
- } else {
- cMsg("Unable to find any shipments. Please place some")
- }
- }
- Scan = 0
- }
- if(State == 0){
- if(EGP["User",entity]:isPlayer()){
- User = EGP["User",entity]
- State = 1
- EGP:entity():sound(1,"buttons/button16.wav")
- }
- }
- if(State == 1){
- timer("1",500)
- if(clk("1")){
- EGP:egpAlpha(12,255)
- timer("2",500)
- }
- if(clk("2")){
- EGP:egpAlpha(13,255)
- timer("3",500)
- }
- if(clk("3")){
- EGP:egpAlpha(14,255)
- timer("4",500)
- }
- if(clk("4")){
- EGP:egpAlpha(15,255)
- timer("5",500)
- }
- if(clk("5")){
- EGP:egpAlpha(16,255)
- if(Shipments:count() < 1){
- timer("exit",1000)
- } else {
- timer("load",500)
- }
- }
- if(clk("load")){
- for(I = 17, 21){
- EGP:egpAlpha(I,255)
- }
- timer("state",1000)
- }
- if(clk("state")){
- State = 2
- }
- if(clk("exit")){
- State = 0
- exit()
- }
- }
- if(State > 0 && State < 4){
- if(User:pos():distance(EGP:entity():pos()) > 120){
- State = 0
- exit()
- }
- }
- if(State == 0){
- timer("Silent_Check",TimerCheck * 1000)
- if(clk("Silent_Check")){
- Shipments:clear()
- Scan = 1
- SScan = 1
- }
- }
- if(State == 2){
- E = User:keyUse()
- if(changed(E) & E){
- if(onClick(24)){
- State = 0
- exit()
- EGP:entity():sound(1,"buttons/button16.wav")
- }
- if(onClick(46) && User:team():teamName():find("Thief")){
- State = 4
- }
- if(onClick(50) && Shipments:count() > 3){
- State = -2
- }
- for(I = 1, Shipments:count()){
- if(onClick(I + 26)){
- EGP:entity():sound(1,"buttons/button16.wav")
- Request = I
- moneyRequest(User,(Shipments[Request,entity]:shipmentPrice() / 10 + Profit), "Liam's Arms -> Checkout")
- }
- }
- }
- if(moneyNoClk()){
- State = 0
- exit()
- }
- if(moneyClk()){
- State = 3
- cMsg(User:name() + " has purchased a " + Shipments[Request,entity]:shipmentName() + " : $"+Shipments[Request,entity]:shipmentPrice() / 10 + " ($" + Profit + " profit.)")
- }
- }
- if(State == 3){
- timer("init",100)
- if(clk("init")){
- U:setPos(Shipments[Request,entity]:pos() + vec(0,0,10))
- U:setAng(ang(0,-90,0))
- timer("fire",100)
- }
- if(clk("fire")){
- Fire = 1
- timer("reset",5000)
- }
- if(clk("reset")){
- Scan = 1
- Fire = 0
- State = 0
- U:setPos(entity():pos() + vec(0,0,10))
- exit()
- }
- }
- if(State == 4){
- if(Hack){
- Percent++
- EGP:egpSetText(14,"root/bin/inj/boot.pby loading " + Percent + "%...")
- }
- timer("1",100)
- if(clk("1")){
- EGP:egpAlpha(12,255)
- timer("2",500)
- }
- if(clk("2")){
- EGP:egpAlpha(13,255)
- timer("3",500)
- }
- if(clk("3")){
- EGP:egpAlpha(14,255)
- Hack = 1
- }
- if(Percent >= 100){
- Hack = 0
- EGP:egpAlpha(15,255)
- timer("move",1000)
- }
- if(clk("move")){
- timer("reset_store",10000)
- Door = 1
- }
- if(clk("reset_store")){
- Door = 0
- State = 0
- exit()
- }
- }
- ## AUTO UPDATING ##
- ## CHECKING ##
- if(CheckUpdate){
- httpRequest("https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/VERSION")
- if(httpClk() & httpRequestUrl() == "https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/VERSION"){
- NewVersion = httpData():trim()
- timer("update verify",1000)
- }
- if(clk("update verify")){
- if(Version != NewVersion){
- cMsg("New Version Detected: Type !update to download version [" + NewVersion + "]")
- CheckUpdate = 0
- } else {
- cMsg("You're currently up to date!")
- CheckUpdate = 0
- }
- }
- }
- ## UPDATING ##
- if(Update){
- timer("begin_update",1000)
- if(clk("begin_update")){
- if(httpCanRequest()){
- httpRequest("https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/lshop3.txt")
- } else {
- cMsg("Cannot reach address to update, please try again or download manually. How to is on the github.")
- cMsg("https://github.com/imLiaMxo/lShop-3/edit/master/README.md")
- }
- }
- if(httpClk() & httpRequestUrl() == "https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/lshop3.txt"){
- Code = httpData()
- if(fileCanWrite()){
- fileWrite(">e2shared/"+"lshop3 - "+NewVersion+".txt",Code)
- cMsg("Saved file to: e2shared/"+"lshop3 - "+NewVersion+".txt !")
- Update = 0
- } else {
- cMsg("Failed to download latest E2! Please do it manually! How to is on the github.")
- cMsg("https://github.com/imLiaMxo/lShop-3/edit/master/README.md")
- Update = 0
- }
- }
- }
- ## AUTO UPDATING ##
- ## MODE ##
- if(Mode){
- findIncludeClass("player")
- findInSphere(EGP:entity():pos(),200)
- local Player = findClosest(EGP:entity():pos())
- if(Player:pos():distance(EGP:entity():pos()) < 100){
- if(GAIN < 46){
- GAIN += 2
- P:setPos(PStart + vec(0,0,GAIN))
- if(GAIN >= 46){
- P:soundPlay("Music",0,SoundPath)
- GAIN = 46
- State = 0
- }
- }
- } else {
- if(GAIN != 0){
- GAIN -= 2
- P:setPos(PStart + vec(0,0,GAIN))
- if(GAIN == 0){
- GAIN = 0
- soundStop("Music")
- exit()
- if(State != 0){
- State = 0
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement