added getgun key G

update
rubin 2 years ago
parent aeb081b4c2
commit d17dec0265
  1. 95
      mafia-tools.lua

@ -548,7 +548,42 @@ get_guns = {}
get_guns.warehouse = false
get_guns.isCanOpen = false
get_guns.onServerMessage = function(color, message)
if message == "{FFFFFF} Вы можете использовать {00AB06}/getgun [ID игрока]{FFFFFF}, чтобы выдать оружие другим членам организации" then
if get_guns.getgun then
get_guns.stop = os.time()
return true, false
end
end
if message == " Вы не на складе оружия своей организации / у вас нет доступа!" or message == " Склад закрыт" then
if get_guns.getgun then
get_guns.stop = os.time()
end
end
if message:find("^ Склад .+ %{C42100%}закрыт") or message == " Склад закрыт" then
get_guns.warehouse = false
end
if message:find("^ Склад .+ %{00AB06%}открыт") or message == " Склад открыт" then
get_guns.warehouse = true
end
if message:find("^ .+%[%d+%]: (.+)") then
if config.data.stats.rank >= 8 then
end
end
end
get_guns.enter_textdrawId = -1
get_guns.enter_textdraw = false
get_guns.onShowTextDraw = function(id, textdraw)
if textdraw.text:find("VEHICLE_ENTER_EXIT") then
get_guns.enter_textdrawId = id
get_guns.enter_textdraw = true
end
end
get_guns.onTextDrawHide = function(id)
if id == get_guns.enter_textdrawId then
get_guns.enter_textdrawId = -1
get_guns.enter_textdraw = false
end
end
get_guns.onShowDialog = function(id, style, title, button1, button2, text)
if title == "Статистика персонажа" then
@ -560,13 +595,31 @@ get_guns.onShowDialog = function(id, style, title, button1, button2, text)
config.save(config.data)
if not get_guns.check_stats then
get_guns.check_stats = true
get_guns.antiflood = os.time() - 28
return true, false
end
end
if title == "Склад оружия" then
if get_guns.getgun then
if #get_guns.list > 0 then
sampSendDialogResponse(id,1,get_guns.list[1],"")
table.remove(get_guns.list, 1)
else
get_guns.getgun = false
end
return true, false
end
end
end
get_guns.loop = function()
get_guns.check_stats = false
get_guns.antiflood = 0
get_guns.check_stats = false
get_guns.check_warehouse = false
get_guns.warehouse = false
get_guns.getgun = false
get_guns.stop = 0
get_guns.list = {}
while true do
wait(0)
if not get_guns.check_stats then
@ -574,8 +627,35 @@ get_guns.loop = function()
get_guns.antiflood = os.time()
antiflood.send[#antiflood.send+1] = "/stats"
end
elseif not get_guns.check_warehouse then
if sampIsLocalPlayerSpawned() and os.time() - get_guns.antiflood > 30 then
get_guns.antiflood = os.time()
antiflood.send[#antiflood.send+1] = "/warehouse"
end
end
if get_guns.enter_textdraw and isKeyCanBePressed() and wasKeyPressed(vkeys[config.data.get_guns.key]) and not get_guns.getgun then
get_guns.start_get()
end
if get_guns.getgun and get_guns.stop ~= 0 and os.time() - get_guns.stop > 1 then
get_guns.getgun = false
end
end
end
get_guns.start_get = function()
get_guns.list = {}
for i = 1, #config.data.get_guns.list do
if config.data.get_guns.list[i][2] > 0 then
for n = 1, config.data.get_guns.list[i][2] do
get_guns.list[#get_guns.list+1] = i - 1
end
end
end
get_guns.getgun = true
get_guns.stop = 0
antiflood.send[#antiflood.send+1] = "/getgun"
end
get_guns.check_warelock = function()
end
@ -1110,7 +1190,12 @@ function sampev.onShowDialog(id, style, title, button1, button2, text)
return result
end
end
function sampev.onShowTextDraw(id, data)
get_guns.onShowTextDraw(id, data)
end
function sampev.onTextDrawHide(id)
get_guns.onTextDrawHide(id)
end
-->> NEW FUNCTION
function getLocalPlayerNickname()
return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)))
@ -1229,6 +1314,12 @@ function isPlayerInList(sender)
end
return result
end
function isKeyCanBePressed()
if sampIsDialogActive() or sampIsChatInputActive() or sampIsCursorActive() or isSampfuncsConsoleActive() then
return false
end
return true
end
-->> UPDATE MODULE
function openURL(url, fpath, message_off)

Loading…
Cancel
Save