Created
July 8, 2018 11:23
-
-
Save infowolfe/85e36991e816e53d3fe20b27e02ce386 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function is_local_player(entindex) | |
return entindex == entity.get_local_player() | |
end | |
local function is_local_player_userid(userid) | |
return is_local_player(client.userid_to_entindex(userid)) | |
end | |
local autobuy_checkbox = ui.new_checkbox("MISC", "Miscellaneous", "Autobuy") | |
local autobuy_dropbox = ui.new_combobox("MISC", "Miscellaneous", "Autobuy Snipers", "None", "AWP", "Autosniper", "Scout") | |
local autobuy_dropbox2 = ui.new_combobox("MISC", "Miscellaneous", "Autobuy Pistols", "None", "Deagle/R8", "Dualies", "p250", "usp/glock") | |
local autobuy_dropbox3 = ui.new_combobox("MISC", "Miscellaneous", "Autobuy Rifles", "None", "ak47", "m4a1/m4a1-s", "galil/famas", "aug/sg553") | |
function autobuy(e) | |
local autobuy_value = ui.get(autobuy_dropbox) | |
local checkbox, userid = ui.get(autobuy_checkbox), e.userid | |
if userid == nil then return end | |
local local_player = entity.get_local_player() | |
if not is_local_player_userid(userid) then return end | |
local primary = '' | |
client.log('Debug: ',autobuy_value) | |
if checkbox and autobuy_value ~= "None" then | |
if autobuy_value == "Autosniper" then | |
primary = 'buy scar20; buy g3sg1; ' | |
elseif autobuy_value == "Scout" then | |
primary = 'buy ssg08; ' | |
elseif autobuy_value == "AWP" then | |
primary = 'buy awp; ' | |
end | |
client.exec(primary, 'buy taser; buy defuser; buy vesthelm; buy vest; buy molotov; buy incgrenade; buy hegrenade; buy smokegrenade') | |
client.log('[autobuy] Bought ',autobuy_value,' setup!') | |
elseif checkbox and autobuy_value == "None" then | |
client.log('[autobuy] Autobuy value set to None.') | |
end | |
end | |
function autobuy2(e) | |
local autobuy_value2 = ui.get(autobuy_dropbox2) | |
local checkbox, userid = ui.get(autobuy_checkbox), e.userid | |
if userid == nil then return end | |
local local_player = entity.get_local_player() | |
if not is_local_player_userid(userid) then return end | |
local secondary = '' | |
--client.log('Debug: ',autobuy_value) | |
if checkbox and autobuy_value2 ~= "None" then | |
if autobuy_value2 == "Deagle/R8" then | |
secondary = 'buy deagle; buy revolver; ' | |
elseif autobuy_value2 == "Dualies" then | |
secondary = 'buy elite; ' | |
elseif autobuy_value2 == "p250" then | |
secondary = 'buy p250; ' | |
elseif autobuy_value2 == "usp/glock" then | |
secondary = 'buy usp_silencer; buy glock; ' | |
end | |
client.exec(secondary, 'buy taser; buy defuser; buy vesthelm; buy vest; buy molotov; buy incgrenade; buy hegrenade; buy smokegrenade') | |
client.log('[autobuy] Bought ',autobuy_value2,' setup!') | |
elseif checkbox and autobuy_value2 == "None" then | |
client.log('[autobuy] Autobuy2 value set to None.') | |
end | |
end | |
function autobuy3(e) | |
local autobuy_value3 = ui.get(autobuy_dropbox3) | |
local checkbox, userid = ui.get(autobuy_checkbox), e.userid | |
if userid == nil then return end | |
local local_player = entity.get_local_player() | |
if not is_local_player_userid(userid) then return end | |
local primaryrifle = '' | |
--client.log('Debug: ',autobuy_value) | |
if checkbox and autobuy_value3 ~= "None" then | |
if autobuy_value3 == "ak47" then | |
primaryrifle = 'buy ak47; ' | |
elseif autobuy_value3 == "m4a1/m4a1-s" then | |
primaryrifle = 'buy m4a1; buy m4a1_silencer ;' | |
elseif autobuy_value3 == "galil/famas" then | |
primaryrifle = 'buy galilar; buy famas ;' | |
elseif autobuy_value3 == "aug/sg553" then | |
primaryrifle = 'buy aug; buy sg556 ;' | |
end | |
client.exec(primaryrifle, 'buy taser; buy defuser; buy vesthelm; buy vest; buy molotov; buy incgrenade; buy hegrenade; buy smokegrenade') | |
client.log('[autobuy] Bought ',autobuy_value3,' setup!') | |
elseif checkbox and autobuy_value3 == "None" then | |
client.log('[autobuy] Autobuy3 value set to None.') | |
end | |
end | |
local result = client.set_event_callback('player_spawn', autobuy2) | |
local result = client.set_event_callback('player_spawn', autobuy) | |
local result = client.set_event_callback('player_spawn', autobuy3) | |
if result then | |
client.log('set_event_callback failed: ', result) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment