May 31, 2020, 07:26 pm

Author Topic: Can you pretty this up :D  (Read 1018 times)

Offline Shikaru

  • ByB Newbie
  • *
  • Posts: 12
    • View Profile
Can you pretty this up :D
« on: May 15, 2017, 08:07 am »
Since I know ByB = Wiregods I figured I would ask if you guys would do me a favor and pretty this up and make the EGP look nice, its very default but it works
Code: [Select]
@name Gunshop
@inputs [RnEnt Drop Stack]:entity EGP:wirelink
@outputs Use Plyr:entity
@persist Stack1 Stack2 Stack3 Shipments:array StackSize ScNT Profit Buy Use
@persist [Stk1 Stk2 Stk3]:array StoredShip:entity Pos:vector
function number button(EGP:wirelink,E,Ply:entity) {
    local P1=vec2(1,27+(40*(E-1)))
    local P2=vec2(257,55+(40*(E-1)))
    local Cur=EGP:egpCursor(Ply)
    if(inrange(Cur,P1,P2)) {return 1}
    else{return 0}
}
if(first()) {
    Profit=0.15 #0 = no profit 0.5 = 50% profit#
    StackSize=3
    Stack1=0
    Stack2=0
    Stack3=0
    EGP:egpClear()
    for(I=1,3*StackSize) {
        EGP:egpCircleOutline(I,vec2(129,0+(40*I)),vec2(128,15))
        EGP:egpColor(I,vec(100,100,100)) EGP:egpSize(I,4)
        local Z=12+I
        EGP:egpText(Z,"This is a text!",vec2(76,-10+(40*I))) EGP:egpFont(Z,"Marlett",20)
    }
    EGP:egpRoundedBoxOutline(25,vec2(384),vec2(50))
    EGP:egpText(26,"Buy",vec2(370,374))
    EGP:egpBox(27,vec2(0),vec2(10)) EGP:egpMaterial(27,"vgui/cursors/arrow") EGP:egpParentToCursor(27)
    EGP:egpText(28,"Weapon.Exe",vec2(357,100))
    EGP:egpText(29,"$7000",vec2(357,120))
}
if(changed(RnEnt)&RnEnt:shipmentType()!="invalid_shipment"&Shipments:count()<(3*StackSize)) {Shipments:pushEntity(RnEnt)
    if(Stack1<StackSize) {Stk1:pushEntity(RnEnt) Stack1+=1 RnEnt:propManipulate(Stack:pos()+vec(0,0,18*Stack1),ang(0),0,1,0)}
    elseif(Stack2<StackSize) {Stk2:pushEntity(RnEnt) Stack2+=1 RnEnt:propManipulate(Stack:pos()+vec(0,0,18*Stack2)+Stack:toLocal(Stack:toWorld(vec(30,0,0))),ang(0),0,1,0)}
    else{Stk3:pushEntity(RnEnt) Stack3+=1 RnEnt:propManipulate(Stack:pos()+vec(0,0,18*Stack2)+Stack:toLocal(Stack:toWorld(vec(60,0,0))),ang(0),0,1,0)}
}
if(!ScNT) {timer("scnt",1000) ScNT=1}
if(clk("scnt")) {for(I=1,12) {
    local En=Shipments[I,entity] local Z=12+I
    local Name=En:shipmentName():replace(" Single","")
    if(En:shipmentType()!="invalid_shipment") {EGP:egpSetText(Z,Name)}
    else{EGP:egpSetText(Z," ")}
} for(I=1,Shipments:count()) {
    local En=Shipments[I,entity] local Type=En:shipmentType()
    if(Type=="invalid_shipment") {Shipments:remove(I)
        local Mod=I%StackSize
        local Mod=Mod==0 ? 4 : Mod
        if(Stk1[Mod,entity]==En) {Stk1:remove(Mod) Stack1-=1}
        if(Stk2[Mod,entity]==En) {Stk2:remove(Mod) Stack2-=1}
        if(Stk2[Mod,entity]==En) {Stk3:remove(Mod) Stack3-=1}
}} ScNT=0}
findByClass("player")
POS=EGP:egpToWorld(vec2(256))
findClipToSphere(POS,100)
Plyr=findClosest(POS)
if(Plyr) {
    for(I=1,Shipments:count()) {
        local En=Shipments[I,entity] local Name=En:shipmentName() local Type=En:shipmentType()
        local Price=En:shipmentPrice()*(0.1+Profit)
        if(button(EGP,I,Plyr)==1) {if(Plyr:keyUse()&Type!="invalid_shipment") {EGP:egpSetText(28,Name) EGP:egpSetText(29,"$"+Price) StoredShip=En Pos=En:pos()}}
} local P1=vec2(359)
local P2=vec2(409)
local Curs=EGP:egpCursor(Plyr)
if(inrange(Curs,P1,P2)) {EGP:egpColor(25,vec(100,100,255)) if(Plyr:keyUse()&!Buy) {Buy=1 moneyRequest(Plyr,StoredShip:shipmentPrice()*(0.1+Profit),"Weapon") timer("timeout",10000)}} else{EGP:egpColor(25,vec(255))}}
if(moneyTimeout()|moneyNoClk()|clk("timeout")) {Buy=0}
if(moneyClk()) {StoredShip:setPos(Drop:pos()+vec(0,0,25+(Drop:boxSize():z()*2))) StoredShip:setAng(ang(0,0,180)) timer("fire",800)}
if(clk("fire")) {Use=1 timer("reset",1300)}
if(clk("reset")) {Use=0 StoredShip:setPos(Pos) StoredShip:setAng(ang(0)) Buy=0}
interval(200)