- 68
- 9
какая строка в арз качере отвечает за нажатие ентер (ловли лавки)
arzcatcher:
script_name("ARZCatcher")
script_author("ANONIMazer")
events = require "samp.events"
local font = renderCreateFont("Arial", 8, 5)
local status = false
function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage("{FF0000}[AC]{FFFFFF} Скрипт запущен! {ffb400}Разработчик: {FFFFFF}ANONIMazer. || {ffb400}ВК: {FFFFFF}@pu1seanon", -1)
sampRegisterChatCommand('ARZCatcher', function()
status = not status
if status then
sampAddChatMessage("{FF0000}[AC]{FFFFFF} Скрипт включен...", -1)
else
sampAddChatMessage("{FF0000}[AC]{FFFFFF} Скрипт выключен...", -1)
end
end)
while true do
wait(0)
end
end
function events.onShowDialog(dialogId)
if dialogId == 3010 and status then
sampSendDialogResponse(dialogId, 1, 0, 0)
sampAddChatMessage("{FF0000}[AC]{FFFFFF} Вы поймали {ffb400}лавку!", -1)
end
end
function events.onSetObjectMaterialText(ev, data)
local Object = sampGetObjectHandleBySampId(ev)
if doesObjectExist(Object) and getObjectModel(Object) == 18663 and string.find(data.text, "(.-) {30A332}Свободная!") then
if get_distance(Object) and status then
lua_thread.create(press_key)
end
end
end
function press_key()
setGameKeyState(21, 256)
end
function get_distance(Object)
local result, posX, posY, posZ = getObjectCoordinates(Object)
if result then
if doesObjectExist(Object) then
local pPosX, pPosY, pPosZ = getCharCoordinates(PLAYER_PED)
local distance = (math.abs(posX - pPosX)^2 + math.abs(posY - pPosY)^2)^0.5
local posX, posY = convert3DCoordsToScreen(posX, posY, posZ)
if round(distance, 2) <= 0.9 then
return true
end
end
end
return false
end
function round(x, n)
n = math.pow(10, n or 0)
x = x * n
if x >= 0 then x = math.floor(x + 0.5) else x = math.ceil(x - 0.5) end
return x / n
end