Помощь по LUA

N1NGAGO

Известный
Автор темы
83
8
Версия SA-MP
  1. 0.3.7-R2
  2. Любая
Здравствуйте, мне нужно переделать эту функцию, что бы указывало не НИК напарника, а ИД напарника.


Lua:
function naparnik()
    local v = {}

    for i = 0, sampGetMaxPlayerId(true) do
        if sampIsPlayerConnected(i) then
            local ichar = select(2, sampGetCharHandleBySampPlayerId(i))
            if doesCharExist(ichar) then
                if isCharInAnyCar(PLAYER_PED) then
                    if isCharInAnyCar(ichar) then
                        local veh  = storeCarCharIsInNoSave(PLAYER_PED)
                        local iveh = storeCarCharIsInNoSave(ichar)
                        if veh == iveh then
                            if isInSuit(i) then
                                local inick, ifam = sampGetPlayerNickname(i):match('(.+)_(.+)')
                                if inick and ifam then
                                    table.insert(v, string.format('%s.%s', inick:sub(1,1), ifam))
                                end
                            end
                        end
                    end
                else
                    local myposx, myposy, myposz = getCharCoordinates(PLAYER_PED)
                    local ix, iy, iz = getCharCoordinates(ichar)
                    if getDistanceBetweenCoords3d(myposx, myposy, myposz, ix, iy, iz) <= 100 then
                        if isInSuit(i) then
                            local inick, ifam = sampGetPlayerNickname(i):match('(.+)_(.+)')
                            if inick and ifam then
                                table.insert(v, string.format('%s.%s', inick:sub(1,1), ifam))
                            end
                        end
                    end
                end

            end
        end
    end

    if #v == 0 then
        return 'Напарников нет.'
    elseif #v == 1 then
        return 'Напарник: '..table.concat(v, ', ').. '.'
    elseif #v >=2 then
        return 'Напарники: '..table.concat(v, ', ').. '.'
    end
end
Код: