|
|
|
@ -58,24 +58,41 @@ end |
|
|
|
|
request.handler = function(text) |
|
|
|
|
local info = decodeJson(text) |
|
|
|
|
if info["result"] == "ok" then |
|
|
|
|
sampfuncsLog("OK") |
|
|
|
|
for sender, sender_data in pairs(info["data"]) do |
|
|
|
|
for key, v in pairs(sender_data) do |
|
|
|
|
if ammo_timer.data[key] ~= nil then |
|
|
|
|
if ammo_timer.data[key]["time"] < v["time"] then |
|
|
|
|
ammo_timer.data[key]["time"] = v["time"] |
|
|
|
|
if ammo_timer.data[key]["text"] ~= nil then |
|
|
|
|
ammo_timer.data[key]["text"] = v["text"] |
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-->> AMMO TIMER |
|
|
|
|
ammo_timer = {} |
|
|
|
|
ammo_timer.last_ammo = "" |
|
|
|
|
ammo_timer.onServerMessage = function(color, message) |
|
|
|
|
if message:find("^ Следующее ограбление будет доступно в (%d+:%d+:%d+)") then |
|
|
|
|
request.send[#request.send + 1] = { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if ammo_timer.last_ammo ~= "" then |
|
|
|
|
request.send[#request.send + 1] = { |
|
|
|
|
key = ammo_timer.last_ammo, |
|
|
|
|
text = message:match("^ Следующее ограбление будет доступно в (%d+:%d+:%d+)") |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
ammo_timer.data = { |
|
|
|
|
ls = { time = 0, text = "00:00:00" }, |
|
|
|
|
sf = { time = 0, text = "00:00:00" }, |
|
|
|
|
lv = { time = os.time() - 1800, text = "10:00:00" }, |
|
|
|
|
lv = { time = 0, text = "00:00:00" }, |
|
|
|
|
mhcars = { time = 0, text = "00:00:00" }, |
|
|
|
|
} |
|
|
|
|
ammo_timer.loop = function() |
|
|
|
@ -89,7 +106,6 @@ ammo_timer.loop = function() |
|
|
|
|
return string.format("{%s}%s:{%s} %s (%d min)", config.data.font.color1, key:upper(), config.data.font.color2, ammo_timer.data[key]["text"], min) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
while true do |
|
|
|
|
wait(0) |
|
|
|
|
local text = string.format("%s\n%s\n%s\n%s", getText("ls"), getText("sf"), getText("lv"), getText("mhcars")) |
|
|
|
@ -110,6 +126,7 @@ ammo_timer.setpos = function() |
|
|
|
|
config.save(config.data) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-->> 2 MIN TIMER |
|
|
|
|
timer_2min = {} |
|
|
|
|
timer_2min.onServerMessage = function(color, message) |
|
|
|
@ -221,6 +238,20 @@ end |
|
|
|
|
function sampev.onServerMessage(color, message) |
|
|
|
|
timer_2min.onServerMessage(color, message) |
|
|
|
|
end |
|
|
|
|
function sampev.onSendPickedUpPickup(id) |
|
|
|
|
local X, Y, Z = getCharCoordinates(PLAYER_PED) |
|
|
|
|
local ammo = { |
|
|
|
|
["ls"] = {x = 1366.6401367188, y = -1279.4899902344, z = 13.546875}, |
|
|
|
|
["sf"] = {x = -2626.4050292969, y = 210.6088104248, z = 4.6033186912537}, |
|
|
|
|
["lv"] = {x = 2158.3286132813, y = 943.17541503906, z = 10.371940612793} |
|
|
|
|
} |
|
|
|
|
for k, v in pairs(ammo) do |
|
|
|
|
local distance = getDistanceBetweenCoords3d(X, Y, Z, v.x, v.y, v.z) |
|
|
|
|
if distance <= 5 then |
|
|
|
|
biz = k |
|
|
|
|
end |
|
|
|
|
end --> by Benya |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-->> NEW FUNCTION |
|
|
|
|
function getLocalPlayerNickname() |
|
|
|
|