|
|
|
@ -14,10 +14,10 @@ function main() |
|
|
|
|
lua_thread.create(script_update.main) |
|
|
|
|
repeat wait(0) until sampGetCurrentServerName() ~= "SA-MP" |
|
|
|
|
repeat wait(0) until sampGetCurrentServerName():find("Samp%-Rp.Ru") or sampGetCurrentServerName():find("SRP") |
|
|
|
|
local server = getSampRpServerName() |
|
|
|
|
if server == "" then |
|
|
|
|
thisScript():unload() |
|
|
|
|
end |
|
|
|
|
-- local server = getSampRpServerName() |
|
|
|
|
-- if server == "" then |
|
|
|
|
-- thisScript():unload() |
|
|
|
|
-- end |
|
|
|
|
config.init() |
|
|
|
|
lua_thread.create(timer_2min.loop) |
|
|
|
|
lua_thread.create(ammo_timer.loop) |
|
|
|
@ -30,6 +30,13 @@ function main() |
|
|
|
|
lua_thread.create(updateScoresAndPing) |
|
|
|
|
lua_thread.create(mafiawar.loop) |
|
|
|
|
lua_thread.create(mhcars.loop) |
|
|
|
|
lua_thread.create(healme.loop) |
|
|
|
|
|
|
|
|
|
sampRegisterChatCommand("int",function() |
|
|
|
|
local int = getActiveInterior() |
|
|
|
|
addChatMessage(int) |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
while true do |
|
|
|
|
wait(0) |
|
|
|
|
live = os.time() |
|
|
|
@ -600,6 +607,28 @@ menu.update = function() |
|
|
|
|
end, config.data.mhcars.offset_wait, "Введите на сколько секунд раньше нужно начать флудить"} |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> Разделитель |
|
|
|
|
title = " \t ", |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> ПРочее |
|
|
|
|
title = "{"..config.data.font.color1.."}".."Прочее\t", |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
menu.show = { true, "main" } |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
{ -->> Авто healme |
|
|
|
|
title = "{"..config.data.font.color1.."}"..">{ffffff} Использовать аптечку\t"..(config.data.healme and "вкл" or "выкл"), |
|
|
|
|
click = function(button, list, input , outs) |
|
|
|
|
if button ~= 1 then return end |
|
|
|
|
config.data.healme = not config.data.healme |
|
|
|
|
config.save(config.data) |
|
|
|
|
end |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
["edit"] = { |
|
|
|
@ -774,14 +803,86 @@ menu.loop = function() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- HEALME |
|
|
|
|
|
|
|
|
|
healme = {} |
|
|
|
|
healme.old_interior = -1 |
|
|
|
|
healme.sended = 0 |
|
|
|
|
healme.onServerMessage = function(color, message) |
|
|
|
|
if message == " Вы должны быть на своей базе или дома" or message == " В этом месте нет аптечки" then |
|
|
|
|
if os.time() - healme.sended < 5 then |
|
|
|
|
return false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
healme.onSetPlayerPos = function(position) |
|
|
|
|
local coords = { |
|
|
|
|
{ 246.2885, -0.1631, 1501.0837 }, |
|
|
|
|
{ -189.5952, -69.3178, 1497.3289 }, |
|
|
|
|
{ 1389.1643, -22.6256, 1000.9240 } |
|
|
|
|
} |
|
|
|
|
local result = false |
|
|
|
|
for k, v in pairs(coords) do |
|
|
|
|
local distance = getDistanceBetweenCoords3d(position.x, position.y, position.z, v[1], v[2], v[3]) |
|
|
|
|
if distance <= 5 then |
|
|
|
|
result = true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if result and config.data.healme then |
|
|
|
|
healme.start = true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
healme.onSendPickedUpPickup = function(id) |
|
|
|
|
local X, Y, Z = getCharCoordinates(PLAYER_PED) |
|
|
|
|
local coords = { |
|
|
|
|
{ 1396.63, -17.18, 1000.92 }, -- LCN |
|
|
|
|
{ 1371.64, -30.00, 1004.59 }, -- LCN |
|
|
|
|
{ 1455.21, 749.96, 11.02 }, -- LCN |
|
|
|
|
{ 938.19, 1732.91, 8.85 }, -- RM |
|
|
|
|
{ 1457.42, 2773.18, 10.82 }, -- Yaki |
|
|
|
|
{ 251.82, -12.46, 1501.00 }, -- Yaki |
|
|
|
|
} |
|
|
|
|
local result = false |
|
|
|
|
for k, v in pairs(coords) do |
|
|
|
|
local distance = getDistanceBetweenCoords3d(X, Y, Z, v[1], v[2], v[3]) |
|
|
|
|
if distance <= 5 then |
|
|
|
|
result = true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if result and config.data.healme then |
|
|
|
|
healme.start = true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
healme.start = false |
|
|
|
|
healme.loop = function() |
|
|
|
|
while true do |
|
|
|
|
wait(0) |
|
|
|
|
if config.data.healme and healme.start then |
|
|
|
|
local health = getCharHealth(PLAYER_PED) |
|
|
|
|
local hp = math.ceil((100 - health) / 25) |
|
|
|
|
if hp > 0 then |
|
|
|
|
for i = 1, hp do |
|
|
|
|
repeat |
|
|
|
|
wait(0) |
|
|
|
|
until antiflood.get() > 250 |
|
|
|
|
sampSendChat("/healme") |
|
|
|
|
healme.sended = os.time() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
healme.start = false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-->> MHCARS |
|
|
|
|
mhcars = {} |
|
|
|
|
mhcars.time = 0 |
|
|
|
|
mhcars.onServerMessage = function(color, message) |
|
|
|
|
if message == " Вы не являетесь лидером/замом мафии" then |
|
|
|
|
mhcars.time = os.time() + 1800 |
|
|
|
|
end |
|
|
|
|
if message == " Задание уже начато" then |
|
|
|
|
if message == " Вы не являетесь лидером/замом мафии" or |
|
|
|
|
message == " Ожидайте принятия задания" or |
|
|
|
|
message == " Задание уже начато" then |
|
|
|
|
mhcars.time = os.time() + 1800 |
|
|
|
|
end |
|
|
|
|
if message == " Задание по перегону машин завершено" then |
|
|
|
@ -871,7 +972,8 @@ mafiawar.onServerMessage = function(color, message) |
|
|
|
|
message == " Ваша мафия уже участвует в войне" or |
|
|
|
|
message == " Эта мафия уже начала войну за бизнес" or |
|
|
|
|
message == " Этот бизнес под контролем вашей мафии" or |
|
|
|
|
message:find("^ Начать войну за этот бизнес можно не раньше %d+:%d+$") then |
|
|
|
|
message:find("^ Начать войну за этот бизнес можно не раньше %d+:%d+$") or |
|
|
|
|
message == " Ваша мафия временно не может участвовать в войне" then |
|
|
|
|
if mafiawar.biz then |
|
|
|
|
mafiawar.biz = false |
|
|
|
|
mafiawar.time = 0 |
|
|
|
@ -1422,6 +1524,34 @@ ammo_timer.onServerMessage = function(color, message) |
|
|
|
|
request.wait = 0 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
ammo_timer.onSendPickedUpPickup = function(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} |
|
|
|
|
} |
|
|
|
|
local ignore_coord = { |
|
|
|
|
{ 300.95, -74.43, 1001.52 }, |
|
|
|
|
{ 301.60, -77.81, 1001.52 } |
|
|
|
|
} |
|
|
|
|
local ignore = false |
|
|
|
|
for k,v in pairs(ignore_coord) do |
|
|
|
|
local distance = getDistanceBetweenCoords3d(X, Y, Z, v[1], v[2], v[3]) |
|
|
|
|
if distance <= 5 then |
|
|
|
|
ignore = true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if not ignore then |
|
|
|
|
ammo_timer.last_ammo = "" |
|
|
|
|
for k, v in pairs(ammo) do |
|
|
|
|
local distance = getDistanceBetweenCoords3d(X, Y, Z, v.x, v.y, v.z) |
|
|
|
|
if distance <= 5 then |
|
|
|
|
ammo_timer.last_ammo = k |
|
|
|
|
end |
|
|
|
|
end --> by Benya |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
ammo_timer.data = { |
|
|
|
|
ls = { time = 0, text = "00:00:00" }, |
|
|
|
|
sf = { time = 0, text = "00:00:00" }, |
|
|
|
@ -1584,7 +1714,8 @@ config.default = { |
|
|
|
|
gang = "grove", |
|
|
|
|
wait = 200, |
|
|
|
|
offset_wait = 1 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
healme = true |
|
|
|
|
} |
|
|
|
|
config.directory = string.format("%s\\moonloader\\config\\%s\\", getGameDirectory(), thisScript().name) |
|
|
|
|
config.init = function() |
|
|
|
@ -1676,35 +1807,15 @@ function sampev.onServerMessage(color, message) |
|
|
|
|
if res then |
|
|
|
|
return table.unpack(res) |
|
|
|
|
end |
|
|
|
|
local res = processEvent(healme.onServerMessage, table.pack(color, message)) |
|
|
|
|
if res then |
|
|
|
|
return table.unpack(res) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
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} |
|
|
|
|
} |
|
|
|
|
local ignore_coord = { |
|
|
|
|
{ 300.95, -74.43, 1001.52 }, |
|
|
|
|
{ 301.60, -77.81, 1001.52 } |
|
|
|
|
} |
|
|
|
|
local ignore = false |
|
|
|
|
for k,v in pairs(ignore_coord) do |
|
|
|
|
local distance = getDistanceBetweenCoords3d(X, Y, Z, v[1], v[2], v[3]) |
|
|
|
|
if distance <= 5 then |
|
|
|
|
ignore = true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
if not ignore then |
|
|
|
|
ammo_timer.last_ammo = "" |
|
|
|
|
for k, v in pairs(ammo) do |
|
|
|
|
local distance = getDistanceBetweenCoords3d(X, Y, Z, v.x, v.y, v.z) |
|
|
|
|
if distance <= 5 then |
|
|
|
|
ammo_timer.last_ammo = k |
|
|
|
|
end |
|
|
|
|
end --> by Benya |
|
|
|
|
end |
|
|
|
|
ammo_timer.onSendPickedUpPickup(id) |
|
|
|
|
healme.onSendPickedUpPickup(id) |
|
|
|
|
end |
|
|
|
|
ScoresAndPings = {} |
|
|
|
|
function sampev.onUpdateScoresAndPings(data) |
|
|
|
@ -1759,6 +1870,9 @@ end |
|
|
|
|
function sampev.onResetPlayerWeapons() |
|
|
|
|
get_guns.onResetPlayerWeapons() |
|
|
|
|
end |
|
|
|
|
function sampev.onSetPlayerPos(position) |
|
|
|
|
healme.onSetPlayerPos(position) |
|
|
|
|
end |
|
|
|
|
-->> NEW FUNCTION |
|
|
|
|
function getLocalPlayerNickname() |
|
|
|
|
return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) |
|
|
|
|