Ники игроков в зоне стрима.

Aizen Sosuke

Участник
Автор темы
120
20
Версия MoonLoader
.026-beta
Получить игроков, которых я вижу перед собой и вывести их ники в чат. Как это сделать? Подскажите, пожалуйста.
 
Решение
Lua:
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do wait(0)
                local per,zad = '', ''
                for id = 0, 1000 do
                    local res, hn = sampGetCharHandleBySampPlayerId(id)
                    if res then
                        local xx,yy,zz = getCharCoordinates(hn)
                        local x,y,z = getCharCoordinates(playerPed)
                        if getCharHeading(playerPed) >= 0 and getCharHeading(playerPed) <= 90 then
                            if x <...

qdIbp

Автор темы
Проверенный
1,436
1,178
Lua:
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do wait(0)
                local per,zad = '', ''
                for id = 0, 1000 do
                    local res, hn = sampGetCharHandleBySampPlayerId(id)
                    if res then
                        local xx,yy,zz = getCharCoordinates(hn)
                        local x,y,z = getCharCoordinates(playerPed)
                        if getCharHeading(playerPed) >= 0 and getCharHeading(playerPed) <= 90 then
                            if x < xx and y < yy or x < xx and y > yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                            elseif x > xx and y > yy or x > xx and y < yy then per = per ..'\n'..sampGetPlayerNickname(id)
                            
                            else
                                sampAddChatMessage('xz',-1)
                            end
                        elseif getCharHeading(playerPed) >= 90 and getCharHeading(playerPed) <= 180 then
                            if x < xx and y < yy or x > xx and y < yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                            elseif x < xx and y > yy or x > xx and y > yy then per = per ..'\n'..sampGetPlayerNickname(id)
                            
                            else
                                sampAddChatMessage('xz',-1)
                            end           
                        elseif getCharHeading(playerPed) >= 180 and getCharHeading(playerPed) <= 270 then
                            if x < xx and y < yy or x < xx and y > yy then per = per ..'\n'..sampGetPlayerNickname(id)
                            elseif x > xx and y > yy or x > xx and y < yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                            else
                                sampAddChatMessage('xz',-1)
                            end       
                        elseif getCharHeading(playerPed) >= 270 and getCharHeading(playerPed) <= 360 then
                            if x < xx and y < yy or x > xx and y < yy then per = per ..'\n'..sampGetPlayerNickname(id)
                            elseif x < xx and y > yy or x > xx and y > yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                            
                            else
                                sampAddChatMessage('xz',-1)
                            end   
                        
                        end
    
                    end
                end
                renderFontDrawText(my_font, 'Перед тобой: {FFFF00}'..per..'\n{FFFFFF}За тобой: {FFFF00}'..zad, 10, 400, 0xFFFFFFFF)
    end
end
 
  • Нравится
Реакции: Aizen Sosuke

SomaGnoma

Известный
436
150
Lua:
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end

    while true do wait(0)
                local per,zad = '', ''
                for id = 0, 1000 do
                    local res, hn = sampGetCharHandleBySampPlayerId(id)
                    if res then
                        local xx,yy,zz = getCharCoordinates(hn)
                        local x,y,z = getCharCoordinates(playerPed)
                        if getCharHeading(playerPed) >= 0 and getCharHeading(playerPed) <= 90 then
                            if x < xx and y < yy or x < xx and y > yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                            elseif x > xx and y > yy or x > xx and y < yy then per = per ..'\n'..sampGetPlayerNickname(id)
                          
                            else
                                sampAddChatMessage('xz',-1)
                            end
                        elseif getCharHeading(playerPed) >= 90 and getCharHeading(playerPed) <= 180 then
                            if x < xx and y < yy or x > xx and y < yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                            elseif x < xx and y > yy or x > xx and y > yy then per = per ..'\n'..sampGetPlayerNickname(id)
                          
                            else
                                sampAddChatMessage('xz',-1)
                            end         
                        elseif getCharHeading(playerPed) >= 180 and getCharHeading(playerPed) <= 270 then
                            if x < xx and y < yy or x < xx and y > yy then per = per ..'\n'..sampGetPlayerNickname(id)
                            elseif x > xx and y > yy or x > xx and y < yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                            else
                                sampAddChatMessage('xz',-1)
                            end     
                        elseif getCharHeading(playerPed) >= 270 and getCharHeading(playerPed) <= 360 then
                            if x < xx and y < yy or x > xx and y < yy then per = per ..'\n'..sampGetPlayerNickname(id)
                            elseif x < xx and y > yy or x > xx and y > yy then zad = zad ..'\n'..sampGetPlayerNickname(id)
                          
                            else
                                sampAddChatMessage('xz',-1)
                            end 
                      
                        end
  
                    end
                end
                renderFontDrawText(my_font, 'Перед тобой: {FFFF00}'..per..'\n{FFFFFF}За тобой: {FFFF00}'..zad, 10, 400, 0xFFFFFFFF)
    end
end
[/QUOTE]
[QUOTE="qdIbp, post: 947970, member: 437764"]
Lua:
local font_flag = require('moonloader').font_flag
local my_font = renderCreateFont('Verdana', 12, font_flag.BOLD + font_flag.SHADOW)

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do wait(0)
        for id = 0, sampGetPlayerCount(false) do
               local streamed, hn = sampGetCharHandleBySampPlayerId(id)
            if streamed then
                local xx,yy,zz = getCharCoordinates(hn)
                local x,y,z = getCharCoordinates(playerPed)
                if isCharOnScreen(hn) then -- если чел на экране
                renderFontDrawText(my_font, 'Спереди тебя: {FFFF00}'..sampGetPlayerNickname(id), 10, 400, 0xFFFFFFFF)
                end
            end
        end
    end
end
можно и так сделать)
 
  • Нравится
Реакции: Aizen Sosuke