@name Erza GunShop EGP For StarGate
@inputs CS:wirelink Center Cup Cdown Cdoor Cash
@inputs Preset Presetall Pup Pdown Pleft Pright Enter PCS:wirelink
@inputs Rangeshot Rangemac Rangemp Rangem Rangeak Rangesnip Rangecheck
@outputs Screenreset Inc Userm Userak Usersnip Usershot Usermac Usermp
@outputs Cashhatch Doorhatch Credits Credcash Fdoortimer Fdoor String:string
@persist S:string H1 H2 H3 H4 H5 H6 Indshot Indmac Indmp Indm Indak Indsnip
@persist Newcred Credcheat Timecheat
@persist Indoutshot Indoutmac Indoutmp Indoutm Indoutak Indoutsnip Gunselect
@persist Ph1 Ph2 Ph3 Ph4 Ph5 Ph6 Ph7 Ph8 Ph9 Ph10 Ph11 Ph12 Ph13
@persist Cred Moneymade Gunssold Shoptime Profit
@persist Shoptimer Shotc Macc Mpc Mc Akc Snipc Spriceshot Spricemac Spricemp Spricem
@persist Spriceak Spricesnip Sprice Creddepo Pricemp Pricem
@persist Priceshotc Pricemacc Pricempc Pricemc Priceakc Pricesnipc Priceshot Pricemac
@persist Priceak Pricesnip Changerate Lockprices Menu
@persist Autoclose Autotimer Screen Song Volume Pitch
@trigger All 

#Gunshop chip made by Holywiremod

interval(10)
runOnChat(10)

#Chat commands

if(owner():lastSaid() == "!lockprices" | owner():lastSaid() == "!lp") {Lockprices = 1, Screenreset = 1}
if(owner():lastSaid() == "!unlockprices" | owner():lastSaid() == "!up") {Lockprices = 0, Screenreset = 1}
if(owner():lastSaid() == "!resetprices" & Lockprices == 0| 
owner():lastSaid() == "!rp" & Lockprices == 0) {Priceshot = 200, 
    Pricemac = 220, Pricemp = 250, Pricem = 300, Priceak = 300,
    Pricesnip = 400, Screenreset = 1}
if(owner():lastSaid() == "!maxprices" & Lockprices == 0 | 
owner():lastSaid() == "!max" & Lockprices == 0) {Priceshot = 400, 
    Pricemac = 440, Pricemp = 500, Pricem = 600, Priceak = 600,
    Pricesnip = 800, Screenreset = 1}
if(owner():lastSaid() == "!minprices" & Lockprices == 0 | 
owner():lastSaid() == "!min" & Lockprices == 0) {Priceshot = 100, 
    Pricemac = 110, Pricemp = 120, Pricem = 150, Priceak = 150,
    Pricesnip = 200, Screenreset = 1}
if(owner():lastSaid() == "!debug") {Screenreset = 1, Cashhatch  = 20.45}

#Front door

if(Cdoor & (Fdoor < 67) & Fdoortimer == 0) {
    Fdoor = 68.15,
    Fdoortimer = 144
    }
elseif(Cdoor & (Fdoortimer > 0)) {
    Fdoortimer = 3
    }
if(Fdoortimer > 0) {
    interval(200)
    Fdoortimer--
    }
elseif(Fdoortimer == 0) {
    Fdoor = 20
    }

#Credit system

Credcash = Credits + Cash
if(Cred == 0) {
    Priceshotc = Priceshot - Credits, 
    Pricemacc = Pricemac - Credits, 
    Pricempc = Pricemp - Credits,
    Pricemc = Pricem - Credits,
    Priceakc = Priceak - Credits,
    Pricesnipc = Pricesnip - Credits,
    if(Credits < 1) {Credits = 1}
    if(Priceshotc < 0) {Priceshotc = 0},
    if(Pricemacc < 0) {Pricemacc = 0},
    if(Pricempc < 0) {Pricempc = 0},
    if(Pricemc < 0) {Pricemc = 0},
    if(Priceakc < 0) {Priceakc = 0},
    if(Pricesnipc < 0) {Pricesnipc = 0},
    if(Creddepo & Credcheat == 0) {Hatchb = 0, Credcheat = 1, 
        Credits = Credits + Cash, Moneymade = Moneymade + Cash, Profit = Profit + Cash},
    if(Credcheat == 1) {interval(1000), Timecheat = Timecheat + 1},
    if(Timecheat == 5) {Credcheat = 0, Timecheat = 0},
    if(Credcash > Priceshot | Credcash > Pricemac | Credcash > Pricemp | Credcash > Pricem | 
    Credcash > Priceak | Credcash > Pricesnip) {
            if(Indshot == 1 & Rangeshot > 0 & Center & Inc == 0 & Credcheat == 0 & Rangecheck > 0) {interval(5000), 
                Credits = (Credits - (Priceshot)) + Cash, Credcheat == 1}
            if(Indmac == 1 &  Rangemac > 0 & Center & Inc == 1 & Credcheat == 0 & Rangecheck > 0) {interval(5000),
                Credits = (Credits - (Pricemac)) + Cash, Credcheat == 1}
            if(Indmp == 1 &  Rangemp > 0 & Center & Inc == 2 & Credcheat == 0 & Rangecheck > 0) {interval(5000),
                Credits = (Credits - (Pricemp)) + Cash, Credcheat == 1}
            if(Indm == 1 &  Rangem > 0 & Center & Inc == 3 & Credcheat == 0 & Rangecheck > 0) {interval(5000),
                Credits = (Credits - (Pricem)) + Cash, Credcheat == 1}
            if(Indak == 1 &  Rangeak > 0 & Center & Inc == 4 & Credcheat == 0 & Rangecheck > 0) {interval(5000),
                Credits = (Credits - (Priceak)) + Cash, Credcheat == 1}
            if(Indsnip == 1 &  Rangesnip > 0 & Center & Inc == 5 & Credcheat == 0 & Rangecheck > 0) {interval(5000),
                Credits = (Credits - (Pricesnip)) + Cash, Credcheat == 1}
            }
    } else {
    Priceshotc = Priceshot,
    Pricemacc = Pricemac,
    Pricempc = Pricemp,
    Pricemc = Pricem,
    Priceakc = Priceak,
    Pricesnipc = Pricesnip}
    
#Adjust prices.

if(Pdown) {interval(250), Gunselect = Gunselect + 1,  Screenreset = 0},
if(Pup) {interval(250), Gunselect = Gunselect - 1,  Screenreset = 0},
if(Priceshot < 100) {Priceshot = 100}
if(Pricemac < 110) {Pricemac = 110}
if(Pricemp < 120) {Pricemp = 120}
if(Pricem < 150) {Pricem = 150}
if(Priceak < 150) {Priceak = 150}
if(Pricesnip < 200) {Pricesnip = 200}
if(Gunselect == 0) {Ph1 = 900} else {Ph1 = 0},
if(Gunselect == 1) {Ph2 = 900} else {Ph2 = 0},
if(Gunselect == 2) {Ph3 = 900} else {Ph3 = 0},
if(Gunselect == 3) {Ph4 = 900} else {Ph4 = 0},
if(Gunselect == 4) {Ph5 = 900} else {Ph5 = 0},
if(Gunselect == 5) {Ph6 = 900} else {Ph6 = 0},
if(Gunselect == 6) {Ph7 = 900} else {Ph7 = 0},
if(Gunselect == 7) {Ph8 = 900} else {Ph8 = 0},
if(Gunselect == 8) {Ph9 = 900} else {Ph9 = 0},
if(Gunselect == 9) {Ph10 = 900} else {Ph10 = 0},
if(Gunselect == 10) {Ph11 = 900} else {Ph11 = 0},
if(Screenreset == 1) {interval(250), Screen = Screen + 1}
if(Screen == 1) {Screenreset = 0, Screen = 0}
if(Presetall & Lockprices == 0) {Priceshot = 200, Pricemac = 220, Pricemp = 250, Pricem = 300,
        Priceak = 300, Pricesnip = 400, Volume = 1, Pitch = 100, Autoclose = 1, Screenreset = 1} else {Screenreset = 0},


if(Menu == 0) {
    #Main Menu
    if(Gunselect < 0) {Gunselect = 3},
    if(Gunselect > 3) {Gunselect = 0},
    PCS:writeString("Main Menu",10,0,999,0),
    PCS:writeString("Gunshop Menu ",0,2,999,Ph1),
    PCS:writeString("Music Menu   ",0,3,999,Ph2),
    PCS:writeString("Help Menu    ",0,4,999,Ph3),
    PCS:writeString("Lag Reduction",0,5,999,Ph4),
    if(Gunselect == 0 & Enter) {interval(1000),
        Menu=1,Screenreset = 1,Gunselect = 0}
    elseif(Gunselect == 1 & Enter) {interval(1000),
        Menu=2,Screenreset = 1,Gunselect = 0}
    elseif(Gunselect == 2 & Enter) {interval(1000),
        Menu=3,Screenreset = 1,Gunselect = 0}
    elseif(Gunselect == 3 & Enter) {interval(1000),
        Menu=4,Screenreset = 1,Gunselect = 0
    }
   }
elseif(Menu == 1) {
    #Gunshop Menu
    PCS:writeString("Gunshop Menu",7,0,999,0),
    PCS:writeString("Shotgun      $"+Priceshot,0,2,999,Ph1),
    PCS:writeString("Mac10        $"+Pricemac,0,3,999,Ph2),
    PCS:writeString("Mp5          $"+Pricemp,0,4,999,Ph3),
    PCS:writeString("M4           $"+Pricem,0,5,999,Ph4),
    PCS:writeString("Ak47         $"+Priceak,0,6,999,Ph5),
    PCS:writeString("Sniper       $"+Pricesnip,0,7,999,Ph6),
    PCS:writeString("Change Rate   ",0,8,999,Ph7),
    PCS:writeString(toString(Changerate),14,8,999,Ph7),
    PCS:writeString("Credit System  ",0,9,999,Ph8),
    if(Cred == 0) {PCS:writeString(" On",14,9,999,Ph8)} else {
        PCS:writeString("Off",14,9,999,Ph8)},
    PCS:writeString("Price Lock     ",0,10,999,0),
    if(Lockprices == 0) {PCS:writeString("Off",14,10,999,0)} else {
        PCS:writeString(" On",14,10,999,0)},
    PCS:writeString("Main Menu",0,12,999,Ph9),

    if(Gunselect < 0) {Gunselect = 8},
    if(Gunselect > 8) {Gunselect = 0},
    if(Gunselect == 0 & Preset & Lockprices == 0) {Priceshot = 200},
    if(Gunselect == 1 & Preset & Lockprices == 0) {Pricemac = 220},
    if(Gunselect == 2 & Preset & Lockprices == 0) {Pricemp = 250},
    if(Gunselect == 3 & Preset & Lockprices == 0) {Pricem = 300},
    if(Gunselect == 4 & Preset & Lockprices == 0) {Priceak = 300},
    if(Gunselect == 5 & Preset & Lockprices == 0) {Pricesnip = 400},
    if(Gunselect == 0 & Pleft & Priceshot < 400 & Lockprices == 0) {
        interval(250), Priceshot = Priceshot - Changerate},
    if(Gunselect == 1 & Pleft & Pricemac < 440  & Lockprices == 0) {
        interval(250), Pricemac = Pricemac - Changerate},
    if(Gunselect == 2 & Pleft & Pricemp < 500  & Lockprices == 0) {
       interval(250), Pricemp = Pricemp - Changerate},
    if(Gunselect == 3 & Pleft & Pricem < 600  & Lockprices == 0) {
        interval(250), Pricem = Pricem - Changerate},
    if(Gunselect == 4 & Pleft & Priceak < 600  & Lockprices == 0) {
      interval(250), Priceak = Priceak - Changerate},
    if(Gunselect == 5 & Pleft & Pricesnip < 800  & Lockprices == 0) {
        interval(250), Pricesnip = Pricesnip - Changerate},
    if(Gunselect == 0 & Pright & Priceshot > 99 & Lockprices == 0) {
        interval(250), Priceshot = Priceshot + Changerate},
    if(Gunselect == 1 & Pright & Pricemac > 99 & Lockprices == 0) {
        interval(250), Pricemac = Pricemac + Changerate},
    if(Gunselect == 2 & Pright & Pricemp > 99 & Lockprices == 0) {
       interval(250), Pricemp = Pricemp + Changerate},
    if(Gunselect == 3 & Pright & Pricem > 99 & Lockprices == 0) {
      interval(250), Pricem = Pricem + Changerate},
    if(Gunselect == 4 & Pright & Priceak > 99 & Lockprices == 0) {
       interval(250), Priceak = Priceak + Changerate},
    if(Gunselect == 5 & Pright & Pricesnip > 99 & Lockprices == 0) {
       interval(250), Pricesnip = Pricesnip + Changerate},
    if(Changerate < 10) {Changerate = 10},
    if(Gunselect == 6 & Pleft & Changerate > 0) {interval(250), Changerate = Changerate - 10, Screenreset = 1},
    if(Gunselect == 6 & Pright & Changerate < 100) {interval(250), Changerate = Changerate + 10, Screenreset = 1},
    if(Gunselect == 7 & Pright) {Cred = 0, Screenreset = 1},
    if(Gunselect == 7 & Pleft) {Cred = 1, Screenreset = 1},
    if(Gunselect == 8 & Enter) {interval(1000),Menu = 0, Screenreset = 1,
        Gunselect = 0}
    } 
elseif(Menu==2) {
    #Music Menu
    soundVolume(1,Volume)
    soundPitch(1,Pitch)
    if(Gunselect < 0) {Gunselect = 4},
    if(Gunselect > 4) {Gunselect = 0},
    if(Song < 0) {Song = 46},
    if(Song > 46) {Song = 0},
    PCS:writeString("Music Menu",10,0,999,0),
    PCS:writeString("Song:   "+Song,0,2,999,Ph1),
    PCS:writeString("Volume: "+Volume,0,3,999,Ph2),
    PCS:writeString("Pitch:  "+Pitch,0,4,999,Ph3),
    PCS:writeString("Stop",0,5,999,Ph4),
    PCS:writeString("Main Menu",0,7,999,Ph5),
    if(Preset) {Volume = 1, Pitch = 100}
    if(Gunselect == 0 & Pleft) {interval(250), Song = Song - 1, Screenreset = 1},
    if(Gunselect == 0 & Pright) {interval(250), Song = Song + 1, Screenreset = 1},
    if(Gunselect == 1 & Pleft & Volume >= 2/20) {interval(250), Volume = Volume - 1/20, Screenreset = 1},
    if(Gunselect == 1 & Pright & Volume <= 19/20) {interval(250), Volume = Volume + 1/20, Screenreset = 1},
    if(Gunselect == 2 & Pleft & Pitch > 0) {interval(250), Pitch = Pitch - 5, Screenreset = 1},
    if(Gunselect == 2 & Pright & Pitch < 250) {interval(250), Pitch = Pitch + 5, Screenreset = 1},
    if(Gunselect == 3 & Enter) {entity():soundPlay(1,0,"")
        String = "Stopped"},
    if(Gunselect == 4 & Enter) {interval(1000),Menu = 0, Screenreset = 1, Gunselect = 0},
if(Song == 0) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_still_alive.mp3")
        String = ("Currently Playing: Portal - Still Alive")
    }
}
elseif(Song == 1) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ambient/music/looping_radio_mix.wav")
        String = ("Currently Playing: Portal - Still Alive Radio Loop")
    }
}
elseif(Song == 2) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_4000_degrees_kelvin.mp3")
        String = ("Currently Playing: Portal - 4000 Degrees Kelvin")
    }
}
elseif(Song == 3) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_youre_not_a_good_person.mp3")
        String = ("Currently Playing: Portal - You're Not a Good Person")
    }
}
elseif(Song == 4) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_you_cant_escape_you_know.mp3")
        String = ("Currently Playing: Portal - You Can't Escape You Know")
    }
}
elseif(Song == 5) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_taste_of_blood.mp3")
        String = ("Currently Playing: Portal - Taste of Blood")
    }
}
elseif(Song == 6) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_subject_name_here.mp3")
        String = ("Currently Playing: Portal - Subject Name Here")
    }
}
elseif(Song == 7) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_stop_what_you_are_doing.mp3")
        String = ("Currently Playing: Portal - Stop What You Are Doing")
    }
}
elseif(Song == 8) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_self_esteem_fund.mp3")
        String = ("Currently Playing: Portal - Self Esteem Fund")
    }
}
elseif(Song == 9) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_party_escort.mp3")
        String = ("Currently Playing: Portal - Party Escort")
    }
}
elseif(Song == 10) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/portal_android_hell.mp3")
        String = ("Currently Playing: Portal - Android Hell")
    }
}
elseif(Song == 11) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ui/gamestartup1.mp3")
        String = ("Currently Playing: Team Fortress 2 - Game Startup 1")
    }
}
elseif(Song == 12) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ui/gamestartup2.mp3")
        String = ("Currently Playing: Team Fortress 2 - Game Startup 2")
    }
} 
elseif(Song == 13) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ui/gamestartup3.mp3")
        String = ("Currently Playing: Team Fortress 2 - Game Startup 3")
    }
} 
elseif(Song == 14) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ui/gamestartup4.mp3")
        String = ("Currently Playing: Team Fortress 2 - Game Startup 4")
    }
} 
elseif(Song == 15) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ui/gamestartup5.mp3")
        String = ("Currently Playing: Team Fortress 2 - Game Startup 5")
    }
} 
elseif(Song == 16) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ui/gamestartup6.mp3")
        String = ("Currently Playing: Team Fortress 2 - Game Startup 6")
    }
} 
elseif(Song == 17) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"ui/gamestartup7.mp3")
        String = ("Currently Playing: Team Fortress 2 - Game Startup 7")
    }
}
if(Song == 18) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_intro.mp3")
        String = ("Currently Playing: Half Life 2 - Intro")
    }
}
elseif(Song == 19) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song0.mp3")
        String = ("Currently Playing: Half Life 2 - Song 0")
    }
} 
elseif(Song == 20) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song1.mp3")
        String = ("Currently Playing: Half Life 2 - Song 1")
    }
} 
elseif(Song == 21) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song10.mp3")
        String = ("Currently Playing: Half Life 2 - Song 10")
    }
} 
elseif(Song == 22) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song11.mp3")
        String = ("Currently Playing: Half Life 2 - Song 11")
    }
} 
elseif(Song == 23) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song12_long.mp3")
        String = ("Currently Playing: Half Life 2 - Song 12")
    }
} 
elseif(Song == 24) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song13.mp3")
        String = ("Currently Playing: Half Life 2 - Song 13")
    }
}
elseif(Song == 25) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song14.mp3")
        String = ("Currently Playing: Half Life 2 - Song 14")
    }
} elseif(Song == 26) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song15.mp3")
        String = ("Currently Playing: Half Life 2 - Song 15")
    }
} elseif(Song == 27) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song16.mp3")
        String = ("Currently Playing: Half Life 2 - Song 16")
    }
} elseif(Song == 28) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song17.mp3")
        String = ("Currently Playing: Half Life 2 - Song 17")
    }
} elseif(Song == 29) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song19.mp3")
        String = ("Currently Playing: Half Life 2 - Song 19")
    }
} elseif(Song == 30) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song2.mp3")
        String = ("Currently Playing: Half Life 2 - Song 2")
    }
} elseif(Song == 31) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song20_submix0.mp3")
        String = ("Currently Playing: Half Life 2 - Song 20 Mix 0")
    }
} elseif(Song == 32) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song20_submix4.mp3")
        String = ("Currently Playing: Half Life 2 - Song 20 Mix 4")
    }
} elseif(Song == 33) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song23_suitsong3.mp3")
        String = ("Currently Playing: Half Life 2 - Song 23")
    }
} elseif(Song == 34) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song25_teleporter.mp3")
        String = ("Currently Playing: Half Life 2 - Song 25")
    }
} elseif(Song == 35) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song26.mp3")
        String = ("Currently Playing: Half Life 2 - Song 26")
    }
} elseif(Song == 36) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song26_trainstation1.mp3")
        String = ("Currently Playing: Half Life 2 - Song 26 Trainstation")
    }
} elseif(Song == 37) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song27_trainstation2.mp3")
        String = ("Currently Playing: Half Life 2 - Song 27")
    }
} elseif(Song == 38) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song28.mp3")
        String = ("Currently Playing: Half Life 2 - Song 28")
    }
} elseif(Song == 39) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song29.mp3")
        String = ("Currently Playing: Half Life 2 - Song 29")
    }
} elseif(Song == 40) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song3.mp3")
        String = ("Currently Playing: Half Life 2 - Song 3")
    }
} elseif(Song == 41) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song30.mp3")
        String = ("Currently Playing: Half Life 2 - Song 30")
    }
} elseif(Song == 42) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song31.mp3")
        String = ("Currently Playing: Half Life 2 - Song 31")
    }
} elseif(Song == 43) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song32.mp3")
        String = ("Currently Playing: Half Life 2 - Song 32")
    }
} elseif(Song == 44) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song33.mp3")
        String = ("Currently Playing: Half Life 2 - Song 33")
    }
} elseif(Song == 45) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song4.mp3")
        String = ("Currently Playing: Half Life 2 - Song 4")
    }
} elseif(Song == 46) {
    if(Pleft | Pright) {
        entity():soundPlay(1,0,"music/HL2_song6.mp3")
        String = ("Currently Playing: Half Life 2 - Song 6")
    }
} 

}
elseif(Menu==3)
    {if(Gunselect < 0) {Gunselect = 6},
    if(Gunselect > 6) {Gunselect = 0},
    PCS:writeString("Help Menu",10,0,999,0),
    PCS:writeString("Chat commands:",0,1,999,0),
    PCS:writeString("!debug             ",0,2,999,Ph1),
    PCS:writeString("!minprices / !min  ",0,3,999,Ph2),
    PCS:writeString("!maxprices / !max  ",0,4,999,Ph3),
    PCS:writeString("!resetprices / !rp ",0,5,999,Ph4),
    PCS:writeString("!lockprice  / !lp  ",0,6,999,Ph5),
    PCS:writeString("!unlockprices / !up",0,7,999,Ph6),
    PCS:writeString("Main Menu",0,9,999,Ph7),
    if(Gunselect == 0 & Enter) {interval(1000),
        hint("Fixes all screens and doors. Only useable once.",5)}
        else {},
    if(Gunselect == 1 & Enter) {interval(1000),
        hint("Sets all gun prices to thier minimum price.",5)}
        else {},
    if(Gunselect == 2 & Enter) {interval(1000),
        hint("Sets all gun prices to thier maximum price.",5)}
        else {},
    if(Gunselect == 3 & Enter) {interval(1000),
        hint("Sets all gun prices to thier recommended price.",5)}
        else {},
    if(Gunselect == 4 & Enter) {interval(1000),
        hint("Makes all prices unchangeable.",5)}
        else {},
    if(Gunselect == 5 & Enter) {interval(1000),
        hint("Makes all prices changeable.",5)}
        else {},
    if(Gunselect == 6 & Enter) {interval(1000),Menu = 0, Screenreset = 1,
        Gunselect = 0}
    }
elseif(Menu == 4) {
    if(Gunselect < 0) {Gunselect = 0},
    if(Gunselect > 0) {Gunselect = 0},
    PCS:writeString("Screen Off",10,0,999,0),
    PCS:writeString("Turn On [Enter]",7,6,999,Ph1),

    if(Gunselect == 0 & Enter) {interval(1000),
        Menu=0,Screenreset = 1,Gunselect = 0}
   }

#Price checkers

if((Credcash >= Priceshot & Cred == 0) | (Cash >= Priceshot & Cred == 1)) {Indshot = 1} else {Indshot = 0}
if((Credcash >= Pricemac & Cred == 0) | (Cash >= Pricemac & Cred == 1)) {Indmac = 1} else {Indmac = 0}
if((Credcash >= Pricemp & Cred == 0) | (Cash >= Pricemp & Cred == 1)) {Indmp = 1} else {Indmp = 0}
if((Credcash >= Pricem & Cred == 0) | (Cash >= Pricem & Cred == 1)) {Indm = 1} else {Indm = 0}
if((Credcash >= Priceak & Cred == 0) | (Cash >= Priceak & Cred == 1)) {Indak = 1} else {Indak = 0}
if((Credcash >= Pricesnip & Cred == 0) | (Cash >= Pricesnip & Cred == 1)) {Indsnip = 1} else {Indsnip = 0}

#Taking the money and giving the gun.

if(Rangeshot > 0 & Indshot == 1 & Center & Inc == 0 & Shoptime == 0 & Rangecheck > 0) {Usershot = 1, Hatchb = 0,
    hint("A shotgun has been bought!",3), Moneymade = Moneymade + Cash,
    Profit = Profit + Cash, Shotc = Shotc + 1, Gunssold = Gunssold + 1, Shoptime = 1,
        if(Shotc == 1) {Profit = Profit - Spriceshot}, Cashhatch  = 1, Autoclose = 1, Screenreset = 1
        } else {Usershot = 0}
if(Rangemac > 0 &  Indmac == 1 & Center & Inc == 1 & Shoptime == 0 & Rangecheck > 0) {Usermac = 1, Hatchb = 0,
    hint("A mac10 has been bought!",3), Moneymade = Moneymade + Cash,
    Profit = Profit + Cash, Macc = Macc + 1, Gunssold = Gunssold + 1, Shoptime = 1,
    if(Macc == 1) {Profit = Profit - Spricemac}, Cashhatch  = 1, Autoclose = 1, Screenreset = 1
    } else {Usermac = 0}
if(Rangemp > 0 &  Indmp == 1 & Center & Inc == 2 & Shoptime == 0 & Rangecheck > 0) {Usermp = 1, Hatchb = 0
    hint("A mp5 has been bought!",3), Moneymade = Moneymade + Cash,
    Profit = Profit + Cash, Mpc = Mpc + 1, Gunssold = Gunssold + 1, Shoptime = 1,
    if(Mpc == 1){Profit = Profit - Spricemp}, Cashhatch  = 1, Autoclose = 1, Screenreset = 1
    } else {Usermp = 0}
if(Rangem > 0 &  Indm == 1 & Center & Inc == 3 & Shoptime == 0 & Rangecheck > 0) {Userm = 1, Hatchb = 0
    hint("A m4 has been bought!",3), Moneymade = Moneymade + Cash,
    Profit = Profit + Cash, Mc = Mc + 1, Gunssold = Gunssold + 1, Shoptime = 1,
        if(Mc == 1) {Profit = Profit - Spricem}, Cashhatch  = 1, Autoclose = 1, Screenreset = 1
            } else {Userm = 0}
if(Rangeak > 0 &  Indak == 1 & Center & Inc == 4 & Shoptime == 0 & Rangecheck > 0) {Userak = 1, Hatchb = 0
    hint("A ak47 has been bought!",3), Moneymade = Moneymade + Cash,
    Profit = Profit + Cash, Akc = Akc + 1, Gunssold = Gunssold + 1, Shoptime = 1,
        if(Akc == 1) {Profit = Profit - Spriceak}, Cashhatch  = 1, Autoclose = 1, Screenreset = 1
            } else {Userak = 0}
if(Rangesnip > 0 &  Indsnip == 1 & Center & Inc == 5 & Shoptime == 0 & Rangecheck > 0) {Usersnip = 1, Hatchb = 0
    hint("A sniper rifle has been bought!",3), Moneymade = Moneymade + Cash,
    Profit = Profit + Cash, Snipc = Snipc + 1, Gunssold = Gunssold + 1, Shoptime = 1,
        if(Snipc == 1) {Profit = Profit - Spricesnip}, Cashhatch  = 1, Autoclose = 1, Screenreset = 1
            } else {Usersnip = 0}
if(Shoptime == 1) {interval(1000), Shoptimer = Shoptimer + 1}
if(Shoptimer == 5) {Shoptime = 0, Shoptimer = 1}
if(Autoclose == 1) {interval(1000), Autotimer = Autotimer + 1}
if(Autotimer == 2) {Autoclose = 0, Autotimer  = 0, Cashhatch = 20.45}

#The following was coded by non-toxic and edited by Holy
#Text highlighting.

if(Inc == 0) {H1 = 50} else{H1 = 0}
if(Inc == 1) {H2 = 50} else{H2 = 0}
if(Inc == 2) {H3 = 50} else{H3 = 0}
if(Inc == 3) {H4 = 50} else{H4 = 0}
if(Inc == 4) {H5 = 50} else{H5 = 0}
if(Inc == 5) {H6 = 50} else{H6 = 0}
if(Inc < 0) {Inc = 5}
if(Inc > 5) {Inc = 0}
if(Cup) {interval(250), Inc = Inc - 1}
if(Cdown) {interval(250), Inc = Inc + 1}

#Text display

CS:writeString("Auto Gunshop Silver",6,0,660,111,1)
CS:writeString("Shotgun $"+Priceshotc,0,2,999,H1)
CS:writeString("Mac10   $"+Pricemacc,0,3,999,H2)
CS:writeString("Mp5     $"+Pricemc,0,4,999,H3)
CS:writeString("M4      $"+Pricemc,0,5,999,H4)
CS:writeString("Ak47    $"+Priceakc,0,6,999,H5)
CS:writeString("Sniper  $"+Pricesnipc,0,7,999,H6)
if(Cred == 0) {CS:writeString("Credit System  On",6,12,999,50)} else {
    CS:writeString("Credit System Off",6,12,777,222)}

#Stock check

if(Rangeshot > 0) {CS:writeString("  In Stock  ",15,2,999,50)} else {
    CS:writeString("Out of Stock",15,2,777,222)}
if(Rangemac > 0) {CS:writeString("  In Stock  ",15,3,999,50)} else {
    CS:writeString("Out of Stock",15,3,777,222)}
if(Rangemp > 0) {CS:writeString("  In Stock  ",15,4,999,50)} else {
    CS:writeString("Out of Stock",15,4,777,222)}
if(Rangem > 0) {CS:writeString("  In Stock  ",15,5,999,50)} else {
    CS:writeString("Out of Stock",15,5,777,222)}
if(Rangeak > 0) {CS:writeString("  In Stock  ",15,6,999,50)} else {
    CS:writeString("Out of Stock",15,6,777,222)}
if(Rangesnip > 0) {CS:writeString("  In Stock  ",15,7,999,50)} else {
    CS:writeString("Out of Stock",15,7,777,222)}

#Credits

CS:writeString("Made by Holywiremod",5,16,660)
