Advertisement
imliamxo

lShop 3

Aug 2nd, 2016
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.86 KB | None | 0 0
  1. @name lShop 3
  2. @inputs EGP:wirelink [P U]:entity
  3. @outputs [Fire Door]:number
  4. @persist User:entity
  5. @persist [StoreName Code Version NewVersion SoundPath]:string
  6. @persist [State E Scan SScan TimerCheck Profit Request Hack Percent CheckOnStart CheckUpdate Update Mode GAIN]:number
  7. @persist PStart:vector
  8. @persist Shipments:array
  9.  
  10. interval(100)
  11. runOnChat(1)
  12. runOnHTTP(1)
  13.  
  14. if(first()){
  15.  
  16. StoreName = "L-Shop 3"
  17. CheckOnStart = 0 #<-- If 1, the chip will check for an update once placed.
  18. Mode = 0 #<-- Selects mode. (1 = Props, Music, Animated etc.) (0 = Normal, no props no music etc.)
  19. SoundPath = "ambient/music/country_rock_am_radio_loop.wav" #<-- Sound path for the music played. (Default: ambient/music/country_rock_am_radio_loop.wav)
  20. TimerCheck = 10 #<-- Seconds between each silent scan.
  21.  
  22. function number onClick(ID) {
  23. local Cursor = EGP:egpCursor(User)
  24. local Size = EGP:egpSize(ID) / 2
  25. local A = EGP:egpPos(ID) + Size
  26. local B = EGP:egpPos(ID) - Size
  27. local Max = max(A, B)
  28. local Min = min(A, B)
  29. return inrange(Cursor, Min, Max)
  30. }
  31. function number entity:sound(ID:number,S:string) {
  32. This:soundPlay(ID,0,S)
  33. return 1
  34. }
  35. function void cMsg(Text:string) {
  36. printColor(vec(),"[",vec(32,178,170),"L-Shop 3",vec(),"] ",vec(255,150,0),Text:replace("%red",""):replace("%no",""))
  37. }
  38. Scan = 1
  39. SScan = 0
  40. State = 0
  41. Version = "v2.9"
  42. PStart = P:pos()
  43. cMsg("Welcome " + owner():name() + " to L-Shop 3 CMD Style")
  44. timer("check_update_on_start",2000)
  45. }
  46.  
  47. if(clk("check_update_on_start")){
  48. if(CheckOnStart){
  49. CheckUpdate = 1
  50. } else {
  51. cMsg("Update Check: Disabled.")
  52. }
  53. }
  54. if(changed(round(State))){
  55. local State = round(State)
  56.  
  57. EGP:egpClear()
  58. EGP:egpBox(1,vec2(256,256),vec2(526,526))
  59. EGP:egpColor(1,vec(35,35,35))
  60.  
  61. EGP:egpBox(2,vec2(256,31),vec2(512,60))
  62. EGP:egpColor(2,vec(255,215,0))
  63.  
  64. EGP:egpBoxOutline(3,vec2(256,31),vec2(512,60))
  65.  
  66. if(State == 0){
  67.  
  68. EGP:egpText(4,StoreName,vec2(156,31))
  69. EGP:egpAlign(4,2,1)
  70. EGP:egpSize(4,40)
  71.  
  72. EGP:egpLine(5,vec2(112,60),vec2(112,512))
  73. EGP:egpSize(5,2)
  74.  
  75. EGP:egpLine(6,vec2(412,60),vec2(412,512))
  76. EGP:egpSize(6,2)
  77.  
  78. EGP:egpText(7,"Press E to begin",vec2(256,256))
  79. EGP:egpSize(7,35)
  80. EGP:egpAlign(7,1)
  81. }
  82.  
  83. if(State == 1){
  84. #Basically this is like a shitty intro with animations, bla bla hacker style etc. OPS rush inbound :D
  85. EGP:egpText(4,"Launching C:/Users/Liam/Store.exe",vec2(456,31))
  86. EGP:egpAlign(4,2,1)
  87. EGP:egpSize(4,30)
  88.  
  89. EGP:egpBox(8,vec2(156,133),vec2(230,30))
  90. EGP:egpText(9,"Command Prompt - X",vec2(46,123))
  91. EGP:egpSize(9,20)
  92. EGP:egpColor(9,vec(0,0,0))
  93.  
  94. EGP:egpBox(10,vec2(156,266),vec2(230,240))
  95. EGP:egpColor(10,vec(0,0,0))
  96.  
  97. EGP:egpText(11,"Microsoft Windows [Version 10.0.10586]",vec2(46,150))
  98. EGP:egpSize(11,10)
  99.  
  100. EGP:egpText(12,"exec 'C:/Users/Liam/Store.exe'",vec2(46,160))
  101. EGP:egpSize(12,10)
  102. EGP:egpAlpha(12,0)
  103.  
  104. EGP:egpText(13,"C:/Users/Liam/Store.exe starting...",vec2(46,170))
  105. EGP:egpSize(13,10)
  106. EGP:egpAlpha(13,0)
  107.  
  108. EGP:egpText(14,"C:/Users/Liam/Store.exe loaded",vec2(46,180))
  109. EGP:egpSize(14,10)
  110. EGP:egpAlpha(14,0)
  111.  
  112. if(Shipments:count() < 1){
  113. EGP:egpText(15,"ERROR Couldn't include C:/Users/Liam/Shipments.pby",vec2(46,190))
  114. EGP:egpSize(15,10)
  115. EGP:egpAlpha(15,0)
  116.  
  117. EGP:egpText(16,"Exitting CMD",vec2(46,200))
  118. EGP:egpSize(16,10)
  119. EGP:egpAlpha(16,0)
  120. } else {
  121. EGP:egpText(15,"Included C:/Users/Liam/Shipments.pby",vec2(46,190))
  122. EGP:egpSize(15,10)
  123. EGP:egpAlpha(15,0)
  124.  
  125. EGP:egpText(16,"Launching executable",vec2(46,200))
  126. EGP:egpSize(16,10)
  127. EGP:egpAlpha(16,0)
  128. }
  129.  
  130. EGP:egpBox(17,vec2(256,233),vec2(230,30))
  131. EGP:egpAlpha(17,0)
  132.  
  133. EGP:egpText(18,"Store.exe - X",vec2(146,223))
  134. EGP:egpSize(18,20)
  135. EGP:egpColor(18,vec(0,0,0))
  136. EGP:egpAlpha(18,0)
  137.  
  138. EGP:egpBox(19,vec2(256,276),vec2(230,60))
  139. EGP:egpColor(19,vec(0,0,0))
  140. EGP:egpAlpha(19,0)
  141.  
  142. EGP:egpBox(20,vec2(256,276),vec2(180,30))
  143. EGP:egpColor(20,vec(0,0,155))
  144. EGP:egpAlpha(20,0)
  145.  
  146. EGP:egpText(21,"Loaded",vec2(216,263))
  147. EGP:egpSize(21,25)
  148. EGP:egpAlpha(21,0)
  149. }
  150.  
  151. if(State == 2){
  152. EGP:egpText(4,"Application: Store.exe (x64)",vec2(472,31))
  153. EGP:egpAlign(4,2,1)
  154. EGP:egpSize(4,40)
  155.  
  156. EGP:egpBox(22,vec2(256,100),vec2(356,30))
  157.  
  158. EGP:egpBox(23,vec2(256,266),vec2(356,300))
  159. EGP:egpColor(23,vec(0,0,0))
  160.  
  161. EGP:egpBox(24,vec2(406,100),vec2(30,30))
  162. EGP:egpColor(24,vec(255,255,255))
  163.  
  164. EGP:egpText(25,"Store.exe - X",vec2(90,85))
  165. EGP:egpSize(25,30)
  166. EGP:egpColor(25,vec(0))
  167.  
  168. EGP:egpBox(46,vec2(286,100),vec2(30,30))
  169. EGP:egpMaterial(46,"vgui/servers/icon_password")
  170.  
  171. for(I = 1,Shipments:count()){
  172. EGP:egpBoxOutline(I + 26,vec2(256,85 + (I * 60)),vec2(296,50))
  173. if(Shipments[I,entity]){
  174. EGP:egpText(I + 31,"Purchase "+Shipments[I,entity]:shipmentName()+ " : $"+(Shipments[I,entity]:shipmentPrice() / 10 + Profit),vec2(236,85 + (I * 60) - 10))
  175. EGP:egpAlign(I + 31, 1)
  176.  
  177. EGP:egpBox(I + 38,vec2(393,85 + (I * 60)),vec2(20,48))
  178. if(User:money() >= (Shipments[I,entity]:shipmentPrice() / 10 + Profit)){
  179. EGP:egpColor(I + 38,vec(0,255,0))
  180. } else {
  181. EGP:egpColor(I + 38,vec(255,0,0))
  182. }
  183. }
  184. }
  185. if(Shipments:count() > 5){
  186. EGP:egpBoxOutline(50, vec2(256, 452), vec2(216, 50))
  187.  
  188. EGP:egpText(51,"Next Page", vec2(256, 452))
  189. EGP:egpSize(51, 30)
  190. EGP:egpAlign(51,1,1)
  191. }
  192. }
  193.  
  194. if(State == 3){
  195. EGP:egpText(4,"Application: Thanks.exe (x64)",vec2(472,31))
  196. EGP:egpAlign(4,2,1)
  197. EGP:egpSize(4,40)
  198.  
  199. EGP:egpText(45,"Thanks for shopping!",vec2(256,256))
  200. EGP:egpSize(45,30)
  201. EGP:egpAlign(45,1,45)
  202. }
  203.  
  204. if(State == 4){
  205. EGP:egpText(4,"Injecting root/bin/inj/boot.pby",vec2(456,31))
  206. EGP:egpAlign(4,2,1)
  207. EGP:egpSize(4,30)
  208.  
  209. EGP:egpBox(8,vec2(156,133),vec2(230,30))
  210. EGP:egpText(9,"Command Prompt - X",vec2(46,123))
  211. EGP:egpSize(9,20)
  212. EGP:egpColor(9,vec(0,0,0))
  213.  
  214. EGP:egpBox(10,vec2(156,266),vec2(230,240))
  215. EGP:egpColor(10,vec(0,0,0))
  216.  
  217. EGP:egpText(11,"Microsoft Windows [Version 10.0.10586]",vec2(46,150))
  218. EGP:egpSize(11,10)
  219.  
  220. EGP:egpText(12,"exec 'root/bin/inj/boot.pby'",vec2(46,160))
  221. EGP:egpSize(12,10)
  222. EGP:egpAlpha(12,0)
  223.  
  224. EGP:egpText(13,"root/bin/inj/boot.pby starting...",vec2(46,170))
  225. EGP:egpSize(13,10)
  226. EGP:egpAlpha(13,0)
  227.  
  228. EGP:egpText(14,"root/bin/inj/boot.pby loading " + Percent + "%...",vec2(46,180))
  229. EGP:egpSize(14,10)
  230. EGP:egpAlpha(14,0)
  231.  
  232. EGP:egpText(15,"root/bin/inj/boot.pby injected.",vec2(46,190))
  233. EGP:egpSize(15,10)
  234. EGP:egpAlpha(15,0)
  235. }
  236. }
  237.  
  238. if(chatClk(owner())){
  239. local Msg = owner():lastSaid():explode(" ")
  240. local Cmd = Msg[1,string]
  241.  
  242. if(Cmd == "!del"){
  243. if(Shipments:count() > 0){
  244. Shipments:clear()
  245. cMsg("Cleared Array: Shipments")
  246. } else {
  247. cMsg("Unable to clear an empty array.")
  248. }
  249. }
  250. if(Cmd == "!profit"){
  251. hideChat(1)
  252. if(Msg[2,string] != ""){
  253. Profit = Msg[2,string]:toNumber()
  254. cMsg("Profit set to: " + Profit:toString())
  255. } else {
  256. cMsg("Please enter a valid number... E.G '!profit 2500'")
  257. }
  258. }
  259. if(Cmd == "!checkupdate"){
  260. hideChat(1)
  261. CheckUpdate = 1
  262. }
  263. if(Cmd == "!update"){
  264. hideChat(1)
  265. Update = 1
  266. }
  267. }
  268.  
  269. if(Scan == 1){
  270. findClearBlackList()
  271. findClearWhiteList()
  272. findIncludeClass("spawned_shipment")
  273. findInSphere(entity():pos(),200)
  274. Shipments = findToArray()
  275.  
  276. if(!SScan){
  277. if(Shipments:count() > 0){
  278. cMsg("Found: " + Shipments:count() + " shipments!")
  279. } else {
  280. cMsg("Unable to find any shipments. Please place some")
  281. }
  282. }
  283. Scan = 0
  284. }
  285.  
  286. if(State == 0){
  287. if(EGP["User",entity]:isPlayer()){
  288. User = EGP["User",entity]
  289. State = 1
  290. EGP:entity():sound(1,"buttons/button16.wav")
  291. }
  292. }
  293.  
  294. if(State == 1){
  295. timer("1",500)
  296. if(clk("1")){
  297. EGP:egpAlpha(12,255)
  298. timer("2",500)
  299. }
  300. if(clk("2")){
  301. EGP:egpAlpha(13,255)
  302. timer("3",500)
  303. }
  304. if(clk("3")){
  305. EGP:egpAlpha(14,255)
  306. timer("4",500)
  307. }
  308. if(clk("4")){
  309. EGP:egpAlpha(15,255)
  310. timer("5",500)
  311. }
  312. if(clk("5")){
  313. EGP:egpAlpha(16,255)
  314. if(Shipments:count() < 1){
  315. timer("exit",1000)
  316. } else {
  317. timer("load",500)
  318. }
  319. }
  320. if(clk("load")){
  321. for(I = 17, 21){
  322. EGP:egpAlpha(I,255)
  323. }
  324. timer("state",1000)
  325. }
  326. if(clk("state")){
  327. State = 2
  328. }
  329. if(clk("exit")){
  330. State = 0
  331. exit()
  332. }
  333. }
  334.  
  335. if(State > 0 && State < 4){
  336. if(User:pos():distance(EGP:entity():pos()) > 120){
  337. State = 0
  338. exit()
  339. }
  340. }
  341.  
  342. if(State == 0){
  343. timer("Silent_Check",TimerCheck * 1000)
  344.  
  345. if(clk("Silent_Check")){
  346. Shipments:clear()
  347. Scan = 1
  348. SScan = 1
  349. }
  350. }
  351.  
  352. if(State == 2){
  353. E = User:keyUse()
  354.  
  355. if(changed(E) & E){
  356. if(onClick(24)){
  357. State = 0
  358. exit()
  359. EGP:entity():sound(1,"buttons/button16.wav")
  360. }
  361. if(onClick(46) && User:team():teamName():find("Thief")){
  362. State = 4
  363. }
  364. if(onClick(50) && Shipments:count() > 3){
  365. State = -2
  366. }
  367. for(I = 1, Shipments:count()){
  368. if(onClick(I + 26)){
  369. EGP:entity():sound(1,"buttons/button16.wav")
  370. Request = I
  371. moneyRequest(User,(Shipments[Request,entity]:shipmentPrice() / 10 + Profit), "Liam's Arms -> Checkout")
  372. }
  373. }
  374. }
  375.  
  376. if(moneyNoClk()){
  377. State = 0
  378. exit()
  379. }
  380. if(moneyClk()){
  381. State = 3
  382. cMsg(User:name() + " has purchased a " + Shipments[Request,entity]:shipmentName() + " : $"+Shipments[Request,entity]:shipmentPrice() / 10 + " ($" + Profit + " profit.)")
  383. }
  384. }
  385.  
  386. if(State == 3){
  387. timer("init",100)
  388. if(clk("init")){
  389. U:setPos(Shipments[Request,entity]:pos() + vec(0,0,10))
  390. U:setAng(ang(0,-90,0))
  391. timer("fire",100)
  392. }
  393. if(clk("fire")){
  394. Fire = 1
  395. timer("reset",5000)
  396. }
  397. if(clk("reset")){
  398. Scan = 1
  399. Fire = 0
  400. State = 0
  401. U:setPos(entity():pos() + vec(0,0,10))
  402. exit()
  403. }
  404. }
  405.  
  406. if(State == 4){
  407. if(Hack){
  408. Percent++
  409. EGP:egpSetText(14,"root/bin/inj/boot.pby loading " + Percent + "%...")
  410. }
  411. timer("1",100)
  412. if(clk("1")){
  413. EGP:egpAlpha(12,255)
  414. timer("2",500)
  415. }
  416. if(clk("2")){
  417. EGP:egpAlpha(13,255)
  418. timer("3",500)
  419. }
  420. if(clk("3")){
  421. EGP:egpAlpha(14,255)
  422. Hack = 1
  423. }
  424. if(Percent >= 100){
  425. Hack = 0
  426. EGP:egpAlpha(15,255)
  427. timer("move",1000)
  428. }
  429. if(clk("move")){
  430. timer("reset_store",10000)
  431. Door = 1
  432. }
  433. if(clk("reset_store")){
  434. Door = 0
  435. State = 0
  436. exit()
  437. }
  438. }
  439.  
  440. ## AUTO UPDATING ##
  441.  
  442. ## CHECKING ##
  443.  
  444. if(CheckUpdate){
  445. httpRequest("https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/VERSION")
  446.  
  447. if(httpClk() & httpRequestUrl() == "https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/VERSION"){
  448. NewVersion = httpData():trim()
  449. timer("update verify",1000)
  450. }
  451.  
  452. if(clk("update verify")){
  453. if(Version != NewVersion){
  454. cMsg("New Version Detected: Type !update to download version [" + NewVersion + "]")
  455. CheckUpdate = 0
  456. } else {
  457. cMsg("You're currently up to date!")
  458. CheckUpdate = 0
  459. }
  460. }
  461. }
  462.  
  463. ## UPDATING ##
  464.  
  465. if(Update){
  466. timer("begin_update",1000)
  467.  
  468. if(clk("begin_update")){
  469. if(httpCanRequest()){
  470. httpRequest("https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/lshop3.txt")
  471. } else {
  472. cMsg("Cannot reach address to update, please try again or download manually. How to is on the github.")
  473. cMsg("https://github.com/imLiaMxo/lShop-3/edit/master/README.md")
  474. }
  475. }
  476. if(httpClk() & httpRequestUrl() == "https://raw.githubusercontent.com/imLiaMxo/lShop-3/master/lshop3.txt"){
  477. Code = httpData()
  478. if(fileCanWrite()){
  479. fileWrite(">e2shared/"+"lshop3 - "+NewVersion+".txt",Code)
  480. cMsg("Saved file to: e2shared/"+"lshop3 - "+NewVersion+".txt !")
  481. Update = 0
  482. } else {
  483. cMsg("Failed to download latest E2! Please do it manually! How to is on the github.")
  484. cMsg("https://github.com/imLiaMxo/lShop-3/edit/master/README.md")
  485. Update = 0
  486. }
  487. }
  488. }
  489. ## AUTO UPDATING ##
  490.  
  491. ## MODE ##
  492.  
  493. if(Mode){
  494. findIncludeClass("player")
  495. findInSphere(EGP:entity():pos(),200)
  496. local Player = findClosest(EGP:entity():pos())
  497.  
  498. if(Player:pos():distance(EGP:entity():pos()) < 100){
  499. if(GAIN < 46){
  500. GAIN += 2
  501. P:setPos(PStart + vec(0,0,GAIN))
  502. if(GAIN >= 46){
  503. P:soundPlay("Music",0,SoundPath)
  504. GAIN = 46
  505. State = 0
  506. }
  507. }
  508. } else {
  509. if(GAIN != 0){
  510. GAIN -= 2
  511. P:setPos(PStart + vec(0,0,GAIN))
  512. if(GAIN == 0){
  513. GAIN = 0
  514. soundStop("Music")
  515. exit()
  516. if(State != 0){
  517. State = 0
  518. }
  519. }
  520. }
  521. }
  522. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement