Вывести игроков рядом.

hinazuki

Потрачен
Автор темы
346
95
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия MoonLoader
.026-beta
Хмм.
Как вывести игроков рядом которые находиться в мәшине и вывести в имгуй?
 

sjsuhwhwhv

Известный
87
19
За имгуи не шарю
Lua:
function getLocalPlayerId()
    local _, local_player_id = sampGetPlayerIdByCharHandle(playerPed)
    return local_player_id
end

local instream = {}
function playerinstream()
    for id=0, sampGetMaxPlayerId(false) do
        if local_player_id ~= id and sampIsPlayerConnected(id) then
            local isInStream = sampGetCharHandleBySampPlayerId(id)
            nick = sampGetPlayerNickname(id)
            if isInStream then
            inCar = isCharSittingInAnyCar(isInStream)
                if inCar then
                table.insert(instream{
                nick,
                id
                })
                end
            end
        end
    end
end
 

hinazuki

Потрачен
Автор темы
346
95
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
За имгуи не шарю
Lua:
function getLocalPlayerId()
    local _, local_player_id = sampGetPlayerIdByCharHandle(playerPed)
    return local_player_id
end

local instream = {}
function playerinstream()
    for id=0, sampGetMaxPlayerId(false) do
        if local_player_id ~= id and sampIsPlayerConnected(id) then
            local isInStream = sampGetCharHandleBySampPlayerId(id)
            nick = sampGetPlayerNickname(id)
            if isInStream then
            inCar = isCharSittingInAnyCar(isInStream)
                if inCar then
                table.insert(instream{
                nick,
                id
                })
                end
            end
        end
    end
end
Как это исползвать?

UPD: Разобрался как исползвать, но функция не работает :(

UPD2: Вот я далб@еб, с end'ami попутал
 

ROBERT PUSHER

Известный
305
212
Запишет в массив.
Lua:
function getAllCharsInVehicles()
    local players = {}
    for i = 0, sampGetMaxPlayerId(true) do
        if sampIsPlayerConnected(i) and not sampIsPlayerNpc(i) then
            local result, ped = sampGetCharHandleBySampPlayerId(i)
            if result and isCharInAnyCar(ped) then
                local _, id = sampGetPlayerIdByCharHandle(ped)
                table.insert(players, sampGetPlayerNickname(id))
            end
        end
    end
end