помогите доделать скрипт

woodware

Потрачен
Автор темы
Проверенный
5,058
1,467
Версия MoonLoader
.026-beta
превратите пожалуйста этот огрызок в полноценный код
Lua:
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if valid and doesCharExist(ped) then
local result, id = sampGetPlayerIdByCharHandle(ped)
if result and isKeyDown(VK_I) then
sampSendChat(string.format("/lcontract offer %s", id) )
end
 
Решение
Lua:
require "lib.moonloader"

function main()
    while not isSampAvailable() do wait(100) end
    while true do wait(0)
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
        if valid and doesCharExist(ped) then
            local result, id = sampGetPlayerIdByCharHandle(ped)
            if result and isKeyJustPressed(VK_I) then
                sampSendChat(string.format("/lcontract offer %s", id))
            end
        end
    end
end

Dmitriy Makarov

25.05.2021
Проверенный
2,513
1,140
Lua:
require "lib.moonloader"

function main()
    while not isSampAvailable() do wait(100) end
    while true do wait(0)
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
        if valid and doesCharExist(ped) then
            local result, id = sampGetPlayerIdByCharHandle(ped)
            if result and isKeyJustPressed(VK_I) then
                sampSendChat(string.format("/lcontract offer %s", id))
            end
        end
    end
end
 
  • Нравится
Реакции: whyega52, qdIbp и YarikVL