Hop til indhold
Stavox

Auto Gunshop af Emoyly (6.1)


Emoyly

Recommended Posts

Simpel gunshop jeg lavede, fordi jeg kedede mig...

Er lidt en tard til E2, så den er relativt dårligt lavet.

Der kan være otte våben, og E2'en registrerer selv pris + profit, og navne på våben.

Tutorial kommer når/hvis jeg orker det

 

http://pastebin.com/WJztdTba

 

@name Auto Gunshop v6.1 By Emoyly
@inputs E1:wirelink User:entity R1:entity R2:entity R3:entity R4:entity R5:entity R6:entity R7:entity R8:entity Open
@outputs U1:normal U2:normal U3:normal U4:normal U5:normal U6:normal U7:normal U8:normal AntalKoeb
@persist Gun1:string Gun2:string Gun3:string Gun4:string Gun5:string Gun6:string Profit Farve1R Farve1G Farve1B Farve2R Farve2G Farve2B AntalKoeb Lukket
@trigger
OPS = ops()
if(OPS < 100){
runOnChat(1)
A = owner():lastSaid():explode(" ")
if(A[1,string]=="!profit" & chatClk(owner())){
hideChat(1)
Profit = A[2,string]:toNumber()
}
if(A[1,string]=="!tl" & chatClk(owner())){
hideChat(1)
if(Lukket == 0){timer("SlukEGP",2)}
if(Lukket == 1){timer("TaendEGP",2)}
}
if(clk("SlukEGP")){Lukket = 1}
if(clk("TaendEGP")){Lukket = 0 E1:egpColor(600,255,255,255,0)}
 
}
if (first()){
AntalKoeb = 0
 
#Farve 2
Farve2R = 100
Farve2G = 200
Farve2B = 100
 
#Ik pil
Farve1R = 255
Farve1G = 255
Farve1B = 255
 
Profit = 300
 
Ejer = owner():name()
 
E1:egpClear()
 
E1:egpBox(1,vec2(256,256),vec2(512,512))
E1:egpColor(1,Farve1R,Farve1G,Farve1B,255)
E1:egpMaterial(1,"console/background02")
E1:egpBox(2,vec2(256,30),vec2(512,60))
E1:egpColor(2,Farve2R,Farve2G,Farve2B,255)
E1:egpText(3,""+Ejer+"'s Gunshop",vec2(256,30))
E1:egpAlign(3,1,1)
E1:egpSize(3,40)
 
E1:egpBox(11,vec2(256,90),vec2(430,40))
E1:egpBox(12,vec2(256,140),vec2(430,40))
E1:egpBox(13,vec2(256,190),vec2(430,40))
E1:egpBox(14,vec2(256,240),vec2(430,40))
E1:egpBox(15,vec2(256,290),vec2(430,40))
E1:egpBox(16,vec2(256,340),vec2(430,40))
E1:egpBox(17,vec2(256,390),vec2(430,40))
E1:egpBox(18,vec2(256,440),vec2(430,40))
 
 
E1:egpColor(11,Farve1R,Farve1G,Farve1B,255)
E1:egpColor(12,Farve1R,Farve1G,Farve1B,255)
E1:egpColor(13,Farve1R,Farve1G,Farve1B,255)
E1:egpColor(14,Farve1R,Farve1G,Farve1B,255)
E1:egpColor(15,Farve1R,Farve1G,Farve1B,255)
E1:egpColor(16,Farve1R,Farve1G,Farve1B,255)
E1:egpColor(17,Farve1R,Farve1G,Farve1B,255)
E1:egpColor(18,Farve1R,Farve1G,Farve1B,255)
 
}
 
 
if(OPS > 400){print("OPS H"+oe()+"j! ("+OPS+")")}
if(OPS < 300) {
 
#Priser
if(R1:shipmentPrice() > 4000){Pris1=R1:shipmentPrice() / 10 + 50 + Profit} if(R1:shipmentPrice() < 4000){Pris1 = R1:shipmentPrice() + Profit}
if(R2:shipmentPrice() > 4000){Pris2=R2:shipmentPrice() / 10 + 50 + Profit} if(R2:shipmentPrice() < 4000){Pris2 = R2:shipmentPrice() + Profit}
if(R3:shipmentPrice() > 4000){Pris3=R3:shipmentPrice() / 10 + 50 + Profit} if(R3:shipmentPrice() < 4000){Pris3 = R3:shipmentPrice() + Profit}
if(R4:shipmentPrice() > 4000){Pris4=R4:shipmentPrice() / 10 + 50 + Profit} if(R4:shipmentPrice() < 4000){Pris4 = R4:shipmentPrice() + Profit}
if(R5:shipmentPrice() > 4000){Pris5=R5:shipmentPrice() / 10 + 50 + Profit} if(R5:shipmentPrice() < 4000){Pris5 = R5:shipmentPrice() + Profit}
if(R6:shipmentPrice() > 4000){Pris6=R6:shipmentPrice() / 10 + 50 + Profit} if(R6:shipmentPrice() < 4000){Pris6 = R6:shipmentPrice() + Profit}
if(R7:shipmentPrice() > 4000){Pris7=R7:shipmentPrice() / 10 + 50 + Profit} if(R7:shipmentPrice() < 4000){Pris7 = R7:shipmentPrice() + Profit}
if(R8:shipmentPrice() > 4000){Pris8=R8:shipmentPrice() / 10 + 50 + Profit} if(R8:shipmentPrice() < 4000){Pris8 = R8:shipmentPrice() + Profit}
 
 
#Guns
Gun1 = R1:shipmentName():sub(4)
Gun2 = R2:shipmentName():sub(4)
Gun3 = R3:shipmentName():sub(4)
Gun4 = R4:shipmentName():sub(4)
Gun5 = R5:shipmentName():sub(4)
Gun6 = R6:shipmentName():sub(4)
Gun7 = R7:shipmentName():sub(4)
Gun8 = R8:shipmentName():sub(4)
 
 
 
function number wirelink:egpButton(Idx:number,Ply:entity,TopLeft:number)
{
    TL = This:egpPos(Idx) - This:egpSize(Idx) / 2 * (TopLeft ? 0 : 1)
    BR = This:egpPos(Idx) + This:egpSize(Idx) / (TopLeft ? 1 : 2)
    Cur = This:egpCursor(Ply)
    return inrange(Cur, TL, BR)
}
if(OPS < 200 & Lukket == 0){
G1 = R1:isShipment() G2 = R2:isShipment() G3 = R3:isShipment() G4 = R4:isShipment() G5 = R5:isShipment() G6 = R6:isShipment() G7 = R7:isShipment() G8 = R8:isShipment()
if(G1 == 1){E1:egpColor(11,Farve2R,Farve2G,Farve2B,255) E1:egpText(21,""+Gun1+" - "+Pris1+" DKK",vec2(256,90)) E1:egpAlign(21,1,1) E1:egpSize(21,35) if(~User & User & E1:egpButton(11, User, 0)) {moneyRequest(User, Pris1, Gun1)}}
if(G2 == 1){E1:egpColor(12,Farve2R,Farve2G,Farve2B,255) E1:egpText(22,""+Gun2+" - "+Pris2+" DKK",vec2(256,140)) E1:egpAlign(22,1,1) E1:egpSize(22,35) if(~User & User & E1:egpButton(12, User, 0)) {moneyRequest(User, Pris2, Gun2)}}
if(G3 == 1){E1:egpColor(13,Farve2R,Farve2G,Farve2B,255) E1:egpText(23,""+Gun3+" - "+Pris3+" DKK",vec2(256,190)) E1:egpAlign(23,1,1) E1:egpSize(23,35) if(~User & User & E1:egpButton(13, User, 0)) {moneyRequest(User, Pris3, Gun3)}}
if(G4 == 1){E1:egpColor(14,Farve2R,Farve2G,Farve2B,255) E1:egpText(24,""+Gun4+" - "+Pris4+" DKK",vec2(256,240)) E1:egpAlign(24,1,1) E1:egpSize(24,35) if(~User & User & E1:egpButton(14, User, 0)) {moneyRequest(User, Pris4, Gun4)}}
if(G5 == 1){E1:egpColor(15,Farve2R,Farve2G,Farve2B,255) E1:egpText(25,""+Gun5+" - "+Pris5+" DKK",vec2(256,290)) E1:egpAlign(25,1,1) E1:egpSize(25,35) if(~User & User & E1:egpButton(15, User, 0)) {moneyRequest(User, Pris5, Gun5)}}
if(G6 == 1){E1:egpColor(16,Farve2R,Farve2G,Farve2B,255) E1:egpText(26,""+Gun6+" - "+Pris6+" DKK",vec2(256,340)) E1:egpAlign(26,1,1) E1:egpSize(26,35) if(~User & User & E1:egpButton(16, User, 0)) {moneyRequest(User, Pris6, Gun6)}}
if(G7 == 1){E1:egpColor(17,Farve2R,Farve2G,Farve2B,255) E1:egpText(27,""+Gun7+" - "+Pris7+" DKK",vec2(256,390)) E1:egpAlign(27,1,1) E1:egpSize(27,35) if(~User & User & E1:egpButton(17, User, 0)) {moneyRequest(User, Pris7, Gun7)}}
if(G8 == 1){E1:egpColor(18,Farve2R,Farve2G,Farve2B,255) E1:egpText(28,""+Gun8+" - "+Pris8+" DKK",vec2(256,440)) E1:egpAlign(28,1,1) E1:egpSize(28,35) if(~User & User & E1:egpButton(18, User, 0)) {moneyRequest(User, Pris8, Gun8)}}
 
if(G1 == 0){E1:egpColor(11,Farve1R,Farve1G,Farve1B,0) E1:egpText(21,"",vec2(256,110))}
if(G2 == 0){E1:egpColor(12,Farve1R,Farve1G,Farve1B,0) E1:egpText(22,"",vec2(256,110))}
if(G3 == 0){E1:egpColor(13,Farve1R,Farve1G,Farve1B,0) E1:egpText(23,"",vec2(256,110))}
if(G4 == 0){E1:egpColor(14,Farve1R,Farve1G,Farve1B,0) E1:egpText(24,"",vec2(256,110))}
if(G5 == 0){E1:egpColor(15,Farve1R,Farve1G,Farve1B,0) E1:egpText(25,"",vec2(256,110))}
if(G6 == 0){E1:egpColor(16,Farve1R,Farve1G,Farve1B,0) E1:egpText(26,"",vec2(256,110))}
if(G7 == 0){E1:egpColor(17,Farve1R,Farve1G,Farve1B,0) E1:egpText(27,"",vec2(256,110))}
if(G8 == 0){E1:egpColor(18,Farve1R,Farve1G,Farve1B,0) E1:egpText(28,"",vec2(256,110))}
}
 
if(moneyClk(Gun1)){U1 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun1+" for "+Pris1:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
if(moneyClk(Gun2)){U2 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun2+" for "+Pris2:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
if(moneyClk(Gun3)){U3 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun3+" for "+Pris3:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
if(moneyClk(Gun4)){U4 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun4+" for "+Pris4:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
if(moneyClk(Gun5)){U5 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun5+" for "+Pris5:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
if(moneyClk(Gun6)){U6 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun6+" for "+Pris6:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
if(moneyClk(Gun7)){U7 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun7+" for "+Pris7:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
if(moneyClk(Gun8)){U8 = 1 timer("Sluk",100) AntalKoeb = AntalKoeb + 1 hint(""+moneyClkPlayer():name()+" k"+oe()+"bte en "+Gun8+" for "+Pris8:toString()+" DKK. Antal k"+oe()+"b siden sidste reset: "+AntalKoeb+"",2)}
 
if(clk("Sluk")){U1 = 0 U2 = 0 U3 = 0 U4 = 0 U5 = 0 U6 = 0 U7 = 0 U8 = 0}
 
}
 
if(Lukket == 1){E1:egpBox(600,vec2(256,256),vec2(512,512)) E1:egpColor(600,0,0,0,255)}

 

Link til kommentar
Del på andre sites

I dine inputs, outputs, og persists

kan du vælge at skrive det sådan:

 

@inputs E1:wirelink User:entity R1:entity R2:entity R3:entity R4:entity R5:entity R6:entity R7:entity R8:entity Open
@outputs U1:normal U2:normal U3:normal U4:normal U5:normal U6:normal U7:normal U8:normal AntalKoeb
@persist Gun1:string Gun2:string Gun3:string Gun4:string Gun5:string Gun6:string Profit Farve1R Farve1G Farve1B Farve2R Farve2G Farve2B AntalKoeb Lukket

 

Eller

du kan vælge at skrive det sådan her: 

 

[R1,R2,R3,R4,R5,R6,R7,R8]:entity

[U1,U2,U3,U4,U5,U6,U7,U8]:normal

[Gun1,Gun2,Gun3,Gun4,Gun5,Gun6]:string

 

da det fylder noget mindre, og har bedre overblik over det, syntes jeg ihvertfald

 

 

Link til kommentar
Del på andre sites

22 hours ago, [EBP] Emil said:

if(G1 == 1){E1:egpColor(11,Farve2R,Farve2G,Farve2B,255) E1:egpText(21,""+Gun1+" - "+Pris1+" DKK",vec2(256,90)) E1:egpAlign(21,1,1) E1:egpSize(21,35) if(~User & User & E1:egpButton(11, User, 0)) {moneyRequest(User, Pris1, Gun1)}}

else{}....

 

 

Du kan skrive dette som if (G1){TING}else{TING}

Link til kommentar
Del på andre sites

Emløj du har lavet en mini fejl. Alle Kan ændre !profit. Imens jeg var igang med at lave min egen, med samme system, fandt jeg buggen, så jeg fiksede den.

 

A = lastSpoke():lastSaid():explode(" ")
if(chatClk() & lastSpoke() == owner()) {
    if(A[1, string] == "!profit" & lastSpoke()) {
        Tjen = A[2, string]:toNumber()
    }
}

FIXED IN YA FACE!

Link til kommentar
Del på andre sites

On 5/6/2016 at 23:40, Chutney☢ said:

Emløj du har lavet en mini fejl. Alle Kan ændre !profit. Imens jeg var igang med at lave min egen, med samme system, fandt jeg buggen, så jeg fiksede den.

 


A = lastSpoke():lastSaid():explode(" ")
if(chatClk() & lastSpoke() == owner()) {
    if(A[1, string] == "!profit" & lastSpoke()) {
        Tjen = A[2, string]:toNumber()
    }
}

FIXED IN YA FACE!

I has fikset the problem!

Link til kommentar
Del på andre sites

  • 2 months later...

Arkiveret

Dette emne er nu arkiveret og er lukket for yderligere svar

×
×
  • Tilføj...

COOKIE- OG PRIVATLIVSPOLITIK PÅ STAVOX.DK

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privatlivspolitik - Vilkår for brug.