Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2021-02-19, 13:20


NekeYT







Wiek: 23
Na forum: 2528 dni
Posty: 58
Nick w MP: Cytrus

Piwa: 6

Respekt: 50

Siemka! Mam problem z cbb, a mianowicie wiadomo?? w cbb si? wy?wietla, lecz po ?rodku postaci si? r?wnie? wy?wiwetla



Je?li kto? mo?e to prosi?bym o popraw? kodu

local textsToDraw = {}

local hideown false
local showtime 2000
local characteraddition 100
local maxbubbles 1
local showthebubbles true
local dxfont3_SegoeLight dxCreateFont(":sr-files/fonts/SegoeLight.ttf")

function income(message,messagetype)
    if source ~= getLocalPlayer() or not hideown then
        if messagetype == 2 then
            if getPlayerTeam(source) == getPlayerTeam(getLocalPlayer()) then
                addText(source,message,messagetype)
            end
        else
            addText(source,message,messagetype)
        end
    end
end
    addEvent("onChatbubblesMessageIncome",true)
    addEventHandler("onChatbubblesMessageIncome",getRootElement(),income)
function addText(source,message,messagetype)
    local notfirst false
    for i,v in ipairs(textsToDraw) do
        if v[1] == source then
            v[4] = v[4] +1
            notfirst true
        end
    end
    local infotable = {source,message,messagetype,0}
    table.insert(textsToDraw,infotable)
    if not notfirst then
        setTimer(removeText,showtime + (tonumber(#message) * 100),1,infotable)
    end
end

function removeText(infotable)
    for i,v in ipairs(textsToDraw) do
        if v[1] == infotable[1] and v[2] == infotable[2then
            for i2,v2 in ipairs(textsToDraw) do
                if v2[1] == v[1] and v[4] - v2[4] == 1 then
                    setTimer(removeText,showtime + (tonumber(#v2[2]) * 100),1,v2)
                end
            end
            table.remove(textsToDraw,i)
            break
        end
    end
end

function getTextsToRemove()
    for i,v in ipairs(textsToDraw) do
        if v[1] == source then
            removeText(v)
        end
    end
end

function handleDisplay()
    if showthebubbles then
        for i,v in ipairs(textsToDraw) do
            if isElement(v[1]) then
                if getElementHealth(v[1]) > 0 then
                    local camPosXlcamPosYlcamPosZl getPedBonePosition (v[1], 6)
                    local camPosXrcamPosYrcamPosZr getPedBonePosition (v[1], 7)
                    local x,y,= (camPosXl camPosXr) / 2, (camPosYl camPosYr) / 2, (camPosZl camPosZr) / 2
                    local cx,cy,cz getCameraMatrix()
                    local px,py,pz getElementPosition(v[1])
                    local distance getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz)
                    local posx,posy getScreenFromWorldPosition(x,y,z+0.020*distance+0.10)
                    local elementtoignore1 getPedOccupiedVehicle(getLocalPlayer()) or getLocalPlayer()
                    local elementtoignore2 getPedOccupiedVehicle(v[1]) or v[1]
                    if posx and distance <= 45 and ( isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore1) or isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore2) ) and ( not maxbubbles or  v[4] < maxbubbles then -- change this when multiple ignored elements can be specified
                        local width dxGetTextWidth(v[2],1,"default")
                        
                        dxDrawRectangle(posx - (+ (0.5 width)),posy - (+ (v[4] * 20)),width 5,19,tocolor(535353,150))
                        dxDrawRectangle(posx - (+ (0.5 width)),posy - (+ (v[4] * 20)),width 11,19,tocolor(535353,100))
                        dxDrawRectangle(posx - (+ (0.5 width)),posy - (+ (v[4] * 20)),width 15,17,tocolor(535353,100))
                        dxDrawRectangle(posx - (10 + (0.5 width)),posy - (+ (v[4] * 20)),width 19,17,tocolor(535353,100))
                        dxDrawRectangle(posx - (10 + (0.5 width)),posy - (v[4] * 20) + 1,width 19,13,tocolor(535353,100))
                        dxDrawRectangle(posx - (12 + (0.5 width)),posy - (v[4] * 20) + 1,width 23,13,tocolor(535353,100))
                        dxDrawRectangle(posx - (12 + (0.5 width)),posy - (v[4] * 20) + 4,width 23,7,tocolor(535353100))
                        
                        local r,g,1790179
                        if v[3] == 2 then
                            r,g,getTeamColor(getPlayerTeam(v[1]))
                        end
                        
                        dxDrawText(v[2],posx - (0.5 width),posy - (v[4] * 20),posx - (0.5 width),posy - (v[4] * 20),tocolor(r,g,b,255),1.01dxfont3_SegoeLight"left","top",false,false,false)
                    end
                end
            end
        end
    end
end





function toggleBubblesOnOff()
    showthebubbles not showthebubbles
    outputChatBox("Toggled chatbubbles " ..( not showthebubbles and "#FF0000off#FFFFFF." or "#00FF00on#FFFFFF." ),255,255,255,true)
end

addEventHandler("onClientPlayerQuit",getRootElement(),getTextsToRemove)
addEventHandler("onClientRender",getRootElement(),handleDisplay)
addCommandHandler("chatbubbles",toggleBubblesOnOff)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-19, 13:21


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Sprawdz czy nie masz w??czonego 2 skryptu na ten czat

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-19, 13:30


NekeYT







Wiek: 23
Na forum: 2528 dni
Posty: 58
Nick w MP: Cytrus

Piwa: 6

Respekt: 50

"Matikmontana" napisał/a:

Sprawdz czy nie masz w??czonego 2 skryptu na ten czat

nie mam

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-19, 13:44


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3365 dni
Posty: 281
Nick w MP: AxyZ

Piwa: 234

Respekt: 110
Respekt: 110

Mo?e to jaki? skrypt z paczki uruchamia ten tekst w ?rodku postaci?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-19, 13:49


NekeYT







Wiek: 23
Na forum: 2528 dni
Posty: 58
Nick w MP: Cytrus

Piwa: 6

Respekt: 50

"VVirmex" napisał/a:

Mo?e to jaki? skrypt z paczki uruchamia ten tekst w ?rodku postaci?


w core by? jeden, pozosta? mi drugi tekst

[ Dodano: 2021-02-19, 14:09 ]
"VVirmex" napisał/a:

Mo?e to jaki? skrypt z paczki uruchamia ten tekst w ?rodku postaci?


to musi by? w tym skrypcie bo jak wy??czam to nie ma nic

[ Dodano: 2021-02-19, 14:17 ]
dobra ogarno?em, zamykam temat

Postaw piwo autorowi tego posta
 

 
Tagi: chat :: bubbles
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku