@name ChronoStore_Public_V1
@inputs EGP:wirelink R1 R2 R3 R4 R5 R6 UP DOWN SELECT MONEY Target:entity
@outputs U1 U2 U3 U4 U5 U6 UM
@persist Index
runOnChat(1)


EGP:egpClear()

if(first()){EGP:egpClear()}
if(Target:steamID()=="STEAM_0:1:61542937"){
    hint("Kill him" ,12)
    }
EGP:egpText(7,"Ruthless Vending Machine",vec2(10,10))
EGP:egpSize(7,40)
for(I=0, 6){
    EGP:egpCircle(I,vec2(50,30+(60*I)),vec2(10,10))
    }
List = array("AWP","XM1041","M4A1","AK47","AUG","TMP")


for(I=0, 6){
        EGP:egpText(8+I,List[I, string],vec2(70, 23+(60*I)))
    }

Price = array(1200,450,480,475,630,330)

for(I=0, 6){
    
        EGP:egpText(15+I,"$"+Price[I, number],vec2(150,23+(60*I)))
        EGP:egpRemove(15)
    }
    
for(I=0, 6){
        EGP:egpText(24+I,"In Stock",vec2(250, 23+(60*I)))
        EGP:egpRemove(24)
    }

if(UP==1){Index--
    soundPlay(1,1,"buttons/button3.wav")
    }
if(DOWN==1){Index++
    soundPlay(3,3,"buttons/button3.wav")
    }
if(Index>6){Index=1}
if(Index<1){Index=6}

if(SELECT==1 & MONEY>=Price[1, number]){soundPlay(0,0,"buttons/button24.wav") U1 = 1 UM=1 print(Index)}else{UM=0 U1 = 0}
if(SELECT==1 & MONEY>=Price[2, number]){soundPlay(0,0,"buttons/button24.wav") U2 = 1 UM=1 print(Index)}else{UM=0 U1 = 0}
if(SELECT==1 & MONEY>=Price[3, number]){soundPlay(0,0,"buttons/button24.wav") U3 = 1 UM=1 print(Index)}else{UM=0 U1 = 0}
if(SELECT==1 & MONEY>=Price[4, number]){soundPlay(0,0,"buttons/button24.wav") U4 = 1 UM=1 print(Index)}else{UM=0 U1 = 0}
if(SELECT==1 & MONEY>=Price[5, number]){soundPlay(0,0,"buttons/button24.wav") U5 = 1 UM=1 print(Index)}else{UM=0 U1 = 0}
if(SELECT==1 & MONEY>=Price[6, number]){soundPlay(0,0,"buttons/button24.wav") U6 = 1 UM=1 print(Index)}else{UM=0 U1 = 0}


if(SELECT==1 & MONEY<Price[Index, number]){
    soundPlay(2,2,"buttons/button10.wav")
    
    }
EGP:egpText(23,"Money: $"+MONEY,vec2(12,44))
if(Index==1){EGP:egpColor(1,vec(0,255,0))}else{EGP:egpColor(1,vec(0,150,150))}
if(Index==2){EGP:egpColor(2,vec(0,255,0))}else{EGP:egpColor(2,vec(0,150,150))}
if(Index==3){EGP:egpColor(3,vec(0,255,0))}else{EGP:egpColor(3,vec(0,150,150))}
if(Index==4){EGP:egpColor(4,vec(0,255,0))}else{EGP:egpColor(4,vec(0,150,150))}
if(Index==5){EGP:egpColor(5,vec(0,255,0))}else{EGP:egpColor(5,vec(0,150,150))}
if(Index==6){EGP:egpColor(6,vec(0,255,0))}else{EGP:egpColor(6,vec(0,150,150))}
if(R1>=1){EGP:egpColor(25,vec(0,255,0))}else{print(List[1, string] + " is out of stock!") EGP:egpColor(25,vec(255,0,0))}
if(R2>=1){EGP:egpColor(26,vec(0,255,0))}else{print(List[2, string] + " is out of stock!") EGP:egpColor(26,vec(255,0,0))}
if(R3>=1){EGP:egpColor(27,vec(0,255,0))}else{print(List[3, string] + " is out of stock!") EGP:egpColor(27,vec(255,0,0))}
if(R4>=1){EGP:egpColor(28,vec(0,255,0))}else{print(List[4, string] + " is out of stock!") EGP:egpColor(29,vec(255,0,0))}
if(R5>=1){EGP:egpColor(28,vec(0,255,0))}else{print(List[5, string] + " is out of stock!") EGP:egpColor(29,vec(255,0,0))}
if(R6>=1){EGP:egpColor(30,vec(0,255,0))}else{print(List[6, string] + " is out of stock!") EGP:egpColor(30,vec(255,0,0))}
