--------------------------------------------------
-- Player Classes Script by Unreal Software     --
-- 28.02.2009 - 
www.UnrealSoftware.de           --
-- Adds Player Classes to your server           --
--------------------------------------------------
if sample==nil then sample={} end
sample.classes={}
-----------------------
-- INITIAL SETUP     --
-----------------------
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
     menu(id,"WEAPON MENU@b,M4A1|§3.100,Aug|$3.500,Deagle|$650,Five-Seven|$750,M3|$1.700,XM1014|$3.000,AWP|$4.750,Scout|$2.750,HE|$300,Kevlar|$1.000,Bandage|$500,Medikit|$2.500,Light Armor|§7.500,Heavy Armor|$10.000,Stealth Suit|$5.000,Wrench|§2.000,Snowball|$1.000,Claw|$1.750,Shield|$1.000,Grenade Launcher|$7.000,Rocket Launcher|$12.000,RPG Launcher|$13.000,Air Strike|$7.000,Flamethrower|$12.500,Chainsaw|$10.000,Laser|$16.000,Gas Grenade|$2.000,Machete|$4.550")     
end
-----------------------                                         
-- TEAM -> CLASS     --
-----------------------
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
     if (team>0) then
          sample.classes.classmenu(id)
     end
end
-----------------------
-- SERVERACTION      --
-----------------------
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
     sample.classes.classmenu(id)
end
-----------------------
-- CLASS SELECTION   --
-----------------------
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
     if (menu=="WEAPON MENU@b") then
          if (sel>=0 and sel<=27) then
               sample.classes.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
               end
          end
     end
end
-----------------------
-- SPAWN             --
-----------------------
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
     -- M4A1
     if (sample.classes.class[id]<=1) then
          if player(id,"money") >=1000 then
          parse ("equip "..id.." 32")          
          end
     -- Aug
     if (sample.classes.class[id]==2) then
          if player(id,"money") >=3500 then
          parse ("equip "..id.." 33")
     end
     -- Deagle
     if (sample.classes.class[id]==3) then
         if player(id,"money") >=650 then 
          parse ("equip "..id.." 3")
     end
     -- Five Seven
     if (sample.classes.class[id]==4) then
          if player(id,"money") >=750 then
          parse ("equip "..id.." 6")
     end
     -- M3
     if (sample.classes.class[id]==5) then
          if player(id,"money") >=1700 then
          parse ("equip "..id.." 10")
     end
     -- XM1014
     if (sample.classes.class[id]==6) then
          if player(id,"money") >=3000 then
          parse ("equip "..id.." 11")
     end
     -- AWP
     if (sample.classes.class[id]==7) then
          if player(id,"money") >=4750 then
          parse ("equip "..id.." 35")
     end
    -- Scout 
     if (sample.classes.class[id]==8) then
          if player(id,"money") >=2750 then
          parse ("equip "..id.." 34")          
     end
     -- HE
     if (sample.classes.class[id]==9) then
          if player(id,"money") >=300 then
          parse ("equip "..id.." 51")          
     end
     -- Kevlar
     if (sample.classes.class[id]==10) then
          if player(id,"money") >=1000 then
          parse ("equip "..id.." 58")          
     end
     -- Bandage
     if (sample.classes.class[id]==11) then
          if player(id,"money") >=500 then
          parse ("equip "..id.." 65")          
     end
     -- Medikit                  
     if (sample.classes.class[id]==12) then
          if player(id,"money") >=2000 then
          parse ("equip "..id.." 64")          
     end
     -- Light Armor
     if (sample.classes.class[id]==13) then
          if player(id,"money") >=7500 then
          parse ("equip "..id.." 79")          
     end
     -- Heavy Armor
     if (sample.classes.class[id]==14) then
          if player(id,"money") >=10000 then
          parse ("equip "..id.." 81")          
     end
     -- Stealth Suit
     if (sample.classes.class[id]==15) then
          if player(id,"money") >=5000 then
          parse ("equip "..id.." 84")          
     end
     -- Wrench
     if (sample.classes.class[id]==16) then
          if player(id,"money") >=2000 then
          parse ("equip "..id.." 74")          
     end   
     -- Snowball
     if (sample.classes.class[id]==17) then
          if player(id,"money") >=1000 then
          parse ("equip "..id.." 75")          
     end
     -- Claw
     if (sample.classes.class[id]==18) then
          if player(id,"money") >=1750 then
          parse ("equip "..id.." 78")          
     end
     -- Shield
     if (sample.classes.class[id]==19) then
          if player(id,"money") >=1000 then
          parse ("equip "..id.." 41")          
     end
     -- Grenade Launcher
     if (sample.classes.class[id]==20) then
          if player(id,"money") >=7000 then
          parse ("equip "..id.." 49")          
     end
     -- Rocket Launcher
     if (sample.classes.class[id]==21) then
          if player(id,"money") >=12000 then
          parse ("equip "..id.." 48")          
     end
     -- RPG
     if (sample.classes.class[id]==22) then
          if player(id,"money") >=13000 then
          parse ("equip "..id.." 47")          
     end
     -- Air Strike
     if (sample.classes.class[id]==23) then
          if player(id,"money") >=7000 then
          parse ("equip "..id.." 76")          
     end
     -- Flamethrower
     if (sample.classes.class[id]==24) then
          if player(id,"money") >=12.500 then
          parse ("equip "..id.." 11")          
     end
     -- Chainsaw
     if (sample.classes.class[id]==25) then
          if player(id,"money") >=10000 then
          parse ("equip "..id.." 85")          
     end 
     -- Laser
     if (sample.classes.class[id]==26) then
          if player(id,"money") >=16000 then
          parse ("equip "..id.." 45")          
     end
     -- Gas Grenade
     if (sample.classes.class[id]==27) then
          if player(id,"money") >=2000 then
          parse ("equip "..id.." 42")          
     end     
     -- Machete
     if (sample.classes.class[id]==28) then
          if player(id,"money") >=4550 then
          parse ("equip "..id.." 69")     
     end
end
addhook("buy","no.buy")
function no.buy()
     return 1
end