SHARE
TWEET

Autobuy

The_Belch Jul 21st, 2019 789 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local MSC_OTHER_REF = gui.Reference( "MISC", "AUTOMATION", "Other" );
  2.  
  3. local Autobuy_Text = gui.Text( MSC_OTHER_REF, "Autobuy" );
  4. local Autobuy_Enable = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_enable", "Enable", 0 );
  5.  
  6. local Autobuy_PrimaryWeapon = gui.Combobox( MSC_OTHER_REF, "lua_autobuy_primaryweapon", "Primary Weapon", "Off", "Auto", "Scout", "AWP", "Rifle", "Famas : Galil AR", "AUG : SG 553", "MP9 : MAC-10", "MP7 : MP5-SD", "UMP-45", "P90", "PP-Bizon", "Nova", "XM1014", "MAG-7 : Sawed-Off", "M249", "Negev" );
  7. local Autobuy_SecondaryWeapon = gui.Combobox( MSC_OTHER_REF, "lua_autobuy_secondaryweapon", "Secondary Weapon", "Off", "Dual Berettas", "P250", "Five-Seven : CZ75-Auto : Tec-9", "Desert Eagle : R8 Revolver" );
  8.  
  9. local Autobuy_Armor = gui.Combobox( MSC_OTHER_REF, "lua_autobuy_armor", "Armor", "Off", "Kevlar", "Kevlar + Helmet" );
  10. local Autobuy_Defuser = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_defuser", "Defuser", 0 );
  11. local Autobuy_Taser = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_taser", "Taser", 0 );
  12.  
  13. local Autobuy_HEGrenade = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_hegrenade", "HE Grenade", 0 );
  14. local Autobuy_Smoke = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_smoke", "Smoke", 0 );
  15. local Autobuy_Molotov = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_molotov", "Molotov", 0 );
  16. local Autobuy_Flashbang = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_flashbang", "Flashbang", 0 );
  17. local Autobuy_Decoy = gui.Checkbox( MSC_OTHER_REF, "lua_autobuy_decoy", "Decoy", 0 );
  18.  
  19. local Money = 0
  20.  
  21. local function LocalPlayerMoney()
  22.     if Autobuy_Enable:GetValue() then
  23.         if entities.GetLocalPlayer() ~= nil then
  24.             Money = entities.GetLocalPlayer():GetProp( "m_iAccount" )
  25.         end
  26.     end
  27. end
  28.  
  29. local function Autobuy( Event )
  30.  
  31.     local PrimaryWeapon = Autobuy_PrimaryWeapon:GetValue()
  32.     local SecondaryWeapon = Autobuy_SecondaryWeapon:GetValue()
  33.     local Armor = Autobuy_Armor:GetValue()
  34.  
  35.     if Autobuy_Enable:GetValue() then
  36.  
  37.         if Event:GetName() ~= "player_spawn" then
  38.             return;
  39.         end
  40.  
  41.         local INT_UID = Event:GetInt( "userid" );
  42.         local PlayerIndex = client.GetPlayerIndexByUserID( INT_UID );
  43.        
  44.         if client.GetLocalPlayerIndex() == PlayerIndex then
  45.             ME = true
  46.         else
  47.             ME = false
  48.         end
  49.  
  50.         if ME and Money == 0 then
  51.             -- Primary Weapon
  52.             if PrimaryWeapon == 1 then client.Command( "buy scar20", true ); -- Auto
  53.             elseif PrimaryWeapon == 2 then client.Command( "buy ssg08", true ); -- Scout
  54.             elseif PrimaryWeapon == 3 then client.Command( "buy awp", true ); -- AWP
  55.             elseif PrimaryWeapon == 4 then client.Command( "buy ak47", true ); -- Rifle
  56.             elseif PrimaryWeapon == 5 then client.Command( "buy famas", true ); -- Famas : Galil AR
  57.             elseif PrimaryWeapon == 6 then client.Command( "buy aug", true ); -- AUG : SG 553
  58.             elseif PrimaryWeapon == 7 then client.Command( "buy mac10", true ); --  MP9 : MAC-10
  59.             elseif PrimaryWeapon == 8 then client.Command( "buy mp7", true ); -- MP7 : MP5-SD
  60.             elseif PrimaryWeapon == 9 then client.Command( "buy ump45", true ); -- UMP-45
  61.             elseif PrimaryWeapon == 10 then client.Command( "buy p90", true ); -- P90
  62.             elseif PrimaryWeapon == 11 then client.Command( "buy bizon", true ); -- PP-Bizon
  63.             elseif PrimaryWeapon == 12 then client.Command( "buy nova", true ); -- Nova
  64.             elseif PrimaryWeapon == 13 then client.Command( "buy xm1014", true ); -- XM1014
  65.             elseif PrimaryWeapon == 14 then client.Command( "buy mag7", true ); -- MAG-7 : Sawed-Off
  66.             elseif PrimaryWeapon == 15 then client.Command( "buy m249", true ); -- M249
  67.             elseif PrimaryWeapon == 16 then client.Command( "buy negev", true ); -- Negev
  68.             end
  69.             -- Secondary Weapon
  70.             if SecondaryWeapon == 1 then client.Command( "buy elite", true ); -- Dual Berettas
  71.             elseif SecondaryWeapon == 2 then client.Command( "buy p250", true ); -- P250
  72.             elseif SecondaryWeapon == 3 then client.Command( "buy tec9", true ); -- Five-Seven : CZ75-Auto : Tec-9
  73.             elseif SecondaryWeapon == 4 then client.Command( "buy deagle", true ); -- Desert Eagle : R8 Revolver
  74.             end
  75.             -- Taser
  76.             if Autobuy_Taser:GetValue() then
  77.                 client.Command( "buy taser", true );
  78.             end
  79.         elseif ME and Money <= 800 then
  80.             -- Secondary Weapon
  81.             if SecondaryWeapon == 1 then client.Command( "buy elite", true ); -- Dual Berettas
  82.             elseif SecondaryWeapon == 2 then client.Command( "buy p250", true ); -- P250
  83.             elseif SecondaryWeapon == 3 then client.Command( "buy tec9", true ); -- Five-Seven : CZ75-Auto : Tec-9
  84.             elseif SecondaryWeapon == 4 then client.Command( "buy deagle", true ); -- Desert Eagle : R8 Revolver
  85.             end
  86.             -- Taser
  87.             if Autobuy_Taser:GetValue() then
  88.                 client.Command( "buy taser", true );
  89.             end
  90.         elseif ME and Money > 800 then
  91.             -- Primary Weapon
  92.             if PrimaryWeapon == 1 then client.Command( "buy scar20", true ); -- Auto
  93.             elseif PrimaryWeapon == 2 then client.Command( "buy ssg08", true ); -- Scout
  94.             elseif PrimaryWeapon == 3 then client.Command( "buy awp", true ); -- AWP
  95.             elseif PrimaryWeapon == 4 then client.Command( "buy ak47", true ); -- Rifle
  96.             elseif PrimaryWeapon == 5 then client.Command( "buy famas", true ); -- Famas : Galil AR
  97.             elseif PrimaryWeapon == 6 then client.Command( "buy aug", true ); -- AUG : SG 553
  98.             elseif PrimaryWeapon == 7 then client.Command( "buy mac10", true ); --  MP9 : MAC-10
  99.             elseif PrimaryWeapon == 8 then client.Command( "buy mp7", true ); -- MP7 : MP5-SD
  100.             elseif PrimaryWeapon == 9 then client.Command( "buy ump45", true ); -- UMP-45
  101.             elseif PrimaryWeapon == 10 then client.Command( "buy p90", true ); -- P90
  102.             elseif PrimaryWeapon == 11 then client.Command( "buy bizon", true ); -- PP-Bizon
  103.             elseif PrimaryWeapon == 12 then client.Command( "buy nova", true ); -- Nova
  104.             elseif PrimaryWeapon == 13 then client.Command( "buy xm1014", true ); -- XM1014
  105.             elseif PrimaryWeapon == 14 then client.Command( "buy mag7", true ); -- MAG-7 : Sawed-Off
  106.             elseif PrimaryWeapon == 15 then client.Command( "buy m249", true ); -- M249
  107.             elseif PrimaryWeapon == 16 then client.Command( "buy negev", true ); -- Negev
  108.             end
  109.             -- Secondary Weapon
  110.             if SecondaryWeapon == 1 then client.Command( "buy elite", true ); -- Dual Berettas
  111.             elseif SecondaryWeapon == 2 then client.Command( "buy p250", true ); -- P250
  112.             elseif SecondaryWeapon == 3 then client.Command( "buy tec9", true ); -- Five-Seven : CZ75-Auto : Tec-9
  113.             elseif SecondaryWeapon == 4 then client.Command( "buy deagle", true ); -- Desert Eagle : R8 Revolver
  114.             end
  115.  
  116.             -- Armor
  117.             if Armor == 1 then client.Command( "buy vest", true );
  118.             elseif Armor == 2 then client.Command( "buy vesthelm", true );
  119.             end
  120.             -- Defuser
  121.             if Autobuy_Defuser:GetValue() then
  122.                 client.Command( "buy defuser", true );
  123.             end
  124.             -- Taser
  125.             if Autobuy_Taser:GetValue() then
  126.                 client.Command( "buy taser", true );
  127.             end
  128.  
  129.             -- HE Grenade
  130.             if Autobuy_HEGrenade:GetValue() then
  131.                 client.Command( "buy hegrenade", true );
  132.             end
  133.             -- Smoke
  134.             if Autobuy_Smoke:GetValue() then
  135.                 client.Command( "buy smokegrenade", true );
  136.             end
  137.             -- Molotov
  138.             if Autobuy_Molotov:GetValue() then
  139.                 client.Command( "buy molotov", true );
  140.             end
  141.             -- Flashbang
  142.             if Autobuy_Flashbang:GetValue() then
  143.                 client.Command( "buy flashbang", true );
  144.             end
  145.             -- Decoy
  146.             if Autobuy_Decoy:GetValue() then
  147.                 client.Command( "buy decoy", true );
  148.             end
  149.         end
  150.  
  151.     end
  152.  
  153. end
  154.  
  155. client.AllowListener( "player_spawn" )
  156.  
  157. callbacks.Register( "Draw", "Local Player Money", LocalPlayerMoney )
  158. callbacks.Register( "FireGameEvent", "Autobuy", Autobuy )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top