Заказ script help

famela1337

Известный
Автор темы
3
1
Hello
I need a script when I press the B button to automatically type /wi this player's ID

1707235837100.png
 

recxvery

Участник
90
27
Hello
I need a script when I press the B button to automatically type /wi this player's ID

Посмотреть вложение 231297
Lua:
require 'lib.moonloader'

function main()
    while not isSampAvailable() do wait(0) end
   
    while true do
        wait(0)
        if isKeyJustPressed(VK_B) then
            if getClosestPlayerId() ~= -1 or nil then
                sampSendChat('/wi ' .. getClosestPlayerId())
            else
                return false
            end
        end
    end
end

function getClosestPlayerId()
    local closestId = -1
    mydist = 30
    local x, y, z = getCharCoordinates(PLAYER_PED)
    for i = 0, 999 do
        local streamed, pedID = sampGetCharHandleBySampPlayerId(i)
        if streamed and getCharHealth(pedID) > 0 and not sampIsPlayerPaused(pedID) then
            local xi, yi, zi = getCharCoordinates(pedID)
            local dist = getDistanceBetweenCoords3d(x, y, z, xi, yi, zi)
            if dist <= mydist then
                mydist = dist
                closestId = i
            end
        end
    end
    return closestId
end
 

Вложения

  • wi.lua
    986 байт · Просмотры: 3