Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Lexx meth
- @inputs EGP:wirelink
- @outputs
- @persist Stats:table
- @trigger
- local Coc = clkName()
- if(first() | ~EGP & EGP){
- Stats = table("StartCash" = getMoney(),"Earned" = 0,"Used" = 0,"Pallets" = 0)
- runOnAllChat(1)
- timer("Refresh",1000)
- function string moneyFormat(Amount:number){
- Formatted = Amount:toString()
- LastFormatted = "None"
- while(1){
- Formatted = Formatted:replaceRE("(-?%d+)(%d%d%d)","%1.%2")
- if(Formatted == LastFormatted){
- return Formatted+"kr"
- }
- LastFormatted = Formatted
- }
- }
- function string getTime(){
- Date = date()
- Date["hour",string] = Date["hour",number] > 9 ? ""+Date["hour",number] : "0"+Date["hour",number]
- Date["min",string] = Date["min",number] > 9 ? ""+Date["min",number] : "0"+Date["min",number]
- return Date["hour",string]+":"+Date["min",string]
- }
- function void printChat(S:string){
- printColor(vec(41,128,185),"Lexx meth - "+getTime(),vec(225),": "+S)
- }
- function void orderMeth(Amount:number){
- local Destination = entity(getDestinationIDs()[1,number])
- local Firm = getDeliveryCompanyIDs()[1,string]
- if(Destination){
- orderProduct("SR",26,50 * Amount,Firm,Destination)
- orderProduct("SR",28,50 * Amount,Firm,Destination)
- orderProduct("SR",27,16 * Amount,Firm,Destination)
- orderProduct("SR",30,12 * Amount,Firm,Destination)
- orderProduct("SR",45,1 * Amount,Firm,Destination)
- }
- else{
- printChat("Fejl - du ejer ikke en bygning!")
- }
- }
- EGP:egpClear()
- EGP:egpBox(1,vec2(256,256),vec2(512,512))
- EGP:egpBox(2,vec2(256,24),vec2(512,48)) EGP:egpColor(2,41,128,185,255)
- EGP:egpText(3,"Lexx meth",vec2(12,24)) EGP:egpAlign(3,0,1) EGP:egpFont(3,"Roboto",30)
- EGP:egpText(4,+getTime()+" ("+players():count()+" online)",vec2(500,24)) EGP:egpAlign(4,2,1) EGP:egpFont(4,"Roboto",25)
- EGP:egpBox(5,vec2(256,48),vec2(512,4)) EGP:egpColor(5,52,152,219,255)
- EGP:egpBox(6,vec2(256,126),vec2(376,66)) EGP:egpColor(6,39,174,96,255)
- EGP:egpBox(7,vec2(256,206),vec2(376,66)) EGP:egpColor(7,243,156,18,255)
- EGP:egpBox(8,vec2(256,286),vec2(376,66)) EGP:egpColor(8,231,76,60,255)
- EGP:egpBox(9,vec2(256,366),vec2(376,66)) EGP:egpColor(9,142,68,173,255)
- EGP:egpText(10,"Tjent: 0kr",vec2(86,126)) EGP:egpAlign(10,0,1) EGP:egpFont(10,"Roboto",30)
- EGP:egpText(11,"Paller bestilt: 0",vec2(86,206)) EGP:egpAlign(11,0,1) EGP:egpFont(11,"Roboto",30)
- EGP:egpText(12,"Brugt: 0kr",vec2(86,286)) EGP:egpAlign(12,0,1) EGP:egpFont(12,"Roboto",30)
- EGP:egpText(13,"Start penge: "+moneyFormat(Stats["StartCash",number]),vec2(86,366)) EGP:egpAlign(13,0,1) EGP:egpFont(13,"Roboto",30)
- EGP:egpBox(14,vec2(256,482),vec2(512,60)) EGP:egpColor(14,185,185,185,255)
- 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)
- }
- if(chatClk(owner())){
- local LastZ = lastSaid():lower():explode(" ")
- local Cmd = LastZ[1,string]
- switch(Cmd){
- case "!bestil",
- MethAmount = round(LastZ[2,string]:toNumber())
- Request = MethAmount * 89300
- if(MethAmount & MethAmount <= 10){
- printChat("Anmoder om "+moneyFormat(Request)+" til at bestille "+MethAmount+" paller!")
- moneyRequest(owner(),Request,"LexxPay")
- hideChat(1)
- }
- else{
- printChat("Mellem 1-10 paller pr. bestilling!")
- }
- break
- case "!list",
- 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")
- hideChat(1)
- break
- case "!help",
- printChat("Kommandoer: bestil - list - help")
- hideChat(1)
- break
- }
- }
- if(moneyClk("LexxPay")){
- orderMeth(MethAmount)
- printChat("Bestilling fuldf"+oe()+"rt!")
- Stats["Pallets",number] = Stats["Pallets",number] + MethAmount
- Stats["Used",number] = Stats["Used",number] + Request
- }
- if(clk(Coc)){
- switch(Coc){
- case "Refresh",
- if(ops() < 125){
- Stats["Earned",number] = getMoney() - Stats["StartCash",number]
- EGP:egpSetText(4,+getTime()+" ("+players():count()+" online)")
- EGP:egpSetText(10,"Tjent: "+moneyFormat(Stats["Earned",number]))
- EGP:egpSetText(11,"Paller bestilt: "+Stats["Pallets",number])
- EGP:egpSetText(12,"Brugt: "+moneyFormat(Stats["Used",number]))
- }
- timer("Refresh",1000)
- break
- }
- }
Add Comment
Please, Sign In to add comment