Guest User

lexx meth

a guest
Aug 4th, 2022
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. @name Lexx meth
  2. @inputs EGP:wirelink
  3. @outputs
  4. @persist Stats:table
  5. @trigger
  6.  
  7. local Coc = clkName()
  8.  
  9. if(first() | ~EGP & EGP){
  10.  
  11. Stats = table("StartCash" = getMoney(),"Earned" = 0,"Used" = 0,"Pallets" = 0)
  12.  
  13. runOnAllChat(1)
  14.  
  15. timer("Refresh",1000)
  16.  
  17. function string moneyFormat(Amount:number){
  18. Formatted = Amount:toString()
  19. LastFormatted = "None"
  20.  
  21. while(1){
  22. Formatted = Formatted:replaceRE("(-?%d+)(%d%d%d)","%1.%2")
  23. if(Formatted == LastFormatted){
  24. return Formatted+"kr"
  25. }
  26. LastFormatted = Formatted
  27. }
  28. }
  29.  
  30. function string getTime(){
  31. Date = date()
  32. Date["hour",string] = Date["hour",number] > 9 ? ""+Date["hour",number] : "0"+Date["hour",number]
  33. Date["min",string] = Date["min",number] > 9 ? ""+Date["min",number] : "0"+Date["min",number]
  34. return Date["hour",string]+":"+Date["min",string]
  35. }
  36.  
  37. function void printChat(S:string){
  38. printColor(vec(41,128,185),"Lexx meth - "+getTime(),vec(225),": "+S)
  39. }
  40.  
  41. function void orderMeth(Amount:number){
  42. local Destination = entity(getDestinationIDs()[1,number])
  43. local Firm = getDeliveryCompanyIDs()[1,string]
  44.  
  45. if(Destination){
  46. orderProduct("SR",26,50 * Amount,Firm,Destination)
  47. orderProduct("SR",28,50 * Amount,Firm,Destination)
  48. orderProduct("SR",27,16 * Amount,Firm,Destination)
  49. orderProduct("SR",30,12 * Amount,Firm,Destination)
  50. orderProduct("SR",45,1 * Amount,Firm,Destination)
  51. }
  52. else{
  53. printChat("Fejl - du ejer ikke en bygning!")
  54. }
  55. }
  56.  
  57. EGP:egpClear()
  58. EGP:egpBox(1,vec2(256,256),vec2(512,512))
  59. EGP:egpBox(2,vec2(256,24),vec2(512,48)) EGP:egpColor(2,41,128,185,255)
  60. EGP:egpText(3,"Lexx meth",vec2(12,24)) EGP:egpAlign(3,0,1) EGP:egpFont(3,"Roboto",30)
  61. EGP:egpText(4,+getTime()+" ("+players():count()+" online)",vec2(500,24)) EGP:egpAlign(4,2,1) EGP:egpFont(4,"Roboto",25)
  62. EGP:egpBox(5,vec2(256,48),vec2(512,4)) EGP:egpColor(5,52,152,219,255)
  63. EGP:egpBox(6,vec2(256,126),vec2(376,66)) EGP:egpColor(6,39,174,96,255)
  64. EGP:egpBox(7,vec2(256,206),vec2(376,66)) EGP:egpColor(7,243,156,18,255)
  65. EGP:egpBox(8,vec2(256,286),vec2(376,66)) EGP:egpColor(8,231,76,60,255)
  66. EGP:egpBox(9,vec2(256,366),vec2(376,66)) EGP:egpColor(9,142,68,173,255)
  67. EGP:egpText(10,"Tjent: 0kr",vec2(86,126)) EGP:egpAlign(10,0,1) EGP:egpFont(10,"Roboto",30)
  68. EGP:egpText(11,"Paller bestilt: 0",vec2(86,206)) EGP:egpAlign(11,0,1) EGP:egpFont(11,"Roboto",30)
  69. EGP:egpText(12,"Brugt: 0kr",vec2(86,286)) EGP:egpAlign(12,0,1) EGP:egpFont(12,"Roboto",30)
  70. EGP:egpText(13,"Start penge: "+moneyFormat(Stats["StartCash",number]),vec2(86,366)) EGP:egpAlign(13,0,1) EGP:egpFont(13,"Roboto",30)
  71. EGP:egpBox(14,vec2(256,482),vec2(512,60)) EGP:egpColor(14,185,185,185,255)
  72. EGP:egpText(15,"OBS: Brug !bestil <antal> for at bestille materialer til meth!",vec2(256,482)) EGP:egpAlign(15,1,1) EGP:egpFont(15,"Roboto",20)
  73.  
  74. }
  75.  
  76. if(chatClk(owner())){
  77. local LastZ = lastSaid():lower():explode(" ")
  78. local Cmd = LastZ[1,string]
  79.  
  80. switch(Cmd){
  81. case "!bestil",
  82. MethAmount = round(LastZ[2,string]:toNumber())
  83. Request = MethAmount * 89300
  84.  
  85. if(MethAmount & MethAmount <= 10){
  86. printChat("Anmoder om "+moneyFormat(Request)+" til at bestille "+MethAmount+" paller!")
  87. moneyRequest(owner(),Request,"LexxPay")
  88. hideChat(1)
  89. }
  90. else{
  91. printChat("Mellem 1-10 paller pr. bestilling!")
  92. }
  93. break
  94.  
  95. case "!list",
  96. printChat(" \n\Udstyr----------Pris----------Levering----------Antal------------Udgift\n\Aluminium----500kr--------2000kr-------------50stk------------27000kr\n\Methylamin---650kr--------2000kr-------------50stk------------34500kr\n\Filter------------1000kr------2000kr--------------16stk------------18000kr\n\Plastikkasse--400kr-------2000kr--------------12stk------------6800kr\n\Palle-------------1000kr-----2000kr---------------1stk-------------3000kr\n\Samlet--------------------------------------------------------------------89300kr")
  97. hideChat(1)
  98. break
  99.  
  100. case "!help",
  101. printChat("Kommandoer: bestil - list - help")
  102. hideChat(1)
  103. break
  104. }
  105. }
  106.  
  107. if(moneyClk("LexxPay")){
  108. orderMeth(MethAmount)
  109. printChat("Bestilling fuldf"+oe()+"rt!")
  110. Stats["Pallets",number] = Stats["Pallets",number] + MethAmount
  111. Stats["Used",number] = Stats["Used",number] + Request
  112. }
  113.  
  114. if(clk(Coc)){
  115. switch(Coc){
  116. case "Refresh",
  117. if(ops() < 125){
  118. Stats["Earned",number] = getMoney() - Stats["StartCash",number]
  119.  
  120. EGP:egpSetText(4,+getTime()+" ("+players():count()+" online)")
  121. EGP:egpSetText(10,"Tjent: "+moneyFormat(Stats["Earned",number]))
  122. EGP:egpSetText(11,"Paller bestilt: "+Stats["Pallets",number])
  123. EGP:egpSetText(12,"Brugt: "+moneyFormat(Stats["Used",number]))
  124. }
  125. timer("Refresh",1000)
  126. break
  127. }
  128. }
Add Comment
Please, Sign In to add comment