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

Wysłany: 2014-07-17, 16:13


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4568 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

Witam! Ot??, mam pewien problem. Jak zrobi? text 3d w interiorze? Za pomoc = :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-17, 16:15


krydianero

Samotny Wilk






Wiek: 33
Na forum: 4924 dni
Posty: 395
Nick w MP: Yoshida

Piwa: 1799

Respekt: 117,3
Respekt: 117,3

Taki skrypt ju? istnieje:
Kod:

http://community.mtasa.com/index.php?p=resources&s=details&id=3090

prosz? :->

Podpis

Multi Drive Unlimited:Nowy projekt już wkrótce

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-17, 16:22


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4568 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

Ta, widzia?em go. Ale wola?bym sam to zrobi?. Prosi?bym o kod..

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-17, 16:44


krydianero

Samotny Wilk






Wiek: 33
Na forum: 4924 dni
Posty: 395
Nick w MP: Yoshida

Piwa: 1799

Respekt: 117,3
Respekt: 117,3

No to skoro chcesz kod no to wyjmij ze skryptu...

Podpis

Multi Drive Unlimited:Nowy projekt już wkrótce

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-17, 17:07


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3


local fonts = { [ "default" ] = true, [ "default-bold" ] = true,[ "clear" ] = true,[ "arial" ] = true,[ "sans" ] = true,
      [ "pricedown" ] = true, [ "bankgothic" ] = true,[ "diploma" ] = true,[ "beckett" ] = true
};

function dxDraw3DText( text, x, y, z, scale, font, r, g, b, maxDistance )

    assert( type( text ) == "string", "Bad argument @ dxDraw3DText" );
    assert( type( x ) == "number", "Bad argument @ dxDraw3DText" );
    assert( type( y ) == "number", "Bad argument @ dxDraw3DText" );
    assert( type( z ) == "number", "Bad argument @ dxDraw3DText" );

    if not scale or type( scale ) ~= "number" or scale <= 0 then
        scale = 2
    end
    if not font or type( font ) ~= "string" or not fonts[ font ] then
        font = "default"
    end
    if not r or type( r ) ~= "number" or r < 0 or r > 255 then
        r = 255
    end
    if not g or type( g ) ~= "number" or g < 0 or g > 255 then
        g = 255
    end
    if not b or type( b ) ~= "number" or b < 0 or b > 255 then
        b = 255
    end
    if not maxDistance or type( maxDistance ) ~= "number" or maxDistance <= 1 then
        maxDistance = 20
    end
    local textElement = createElement( "text" );

    if textElement then 

        setElementData( textElement, "text", text );
        setElementData( textElement, "x", x );
        setElementData( textElement, "y", y );
        setElementData( textElement, "z", z );
        setElementData( textElement, "scale", scale );
        setElementData( textElement, "font", font );
        setElementData( textElement, "rgba", { r, g, b, 255 } );
        setElementData( textElement, "maxDistance", maxDistance );

        return textElement
    end

    return false
end

addEventHandler( "onClientRender", root,
    function( )
        local texts = getElementsByType( "text" );
        if #texts > 0 then
            local pX, pY, pZ = getElementPosition( localPlayer );
            for i = 1, #texts do
                local text = getElementData( texts[i], "text" );
                local tX, tY, tZ = getElementData( texts[i], "x" ), getElementData( texts[i], "y" ), getElementData( texts[i], "z" );
                local font = getElementData( texts[i], "font" );
                local scale = getElementData( texts[i], "scale" );
                local color = getElementData( texts[i], "rgba" );
                local maxDistance = getElementData( texts[i], "maxDistance" );
                if not text or not tX or not tY or not tZ then
                    return
                end
                if not font then font = "default" end
                if not scale then scale = 2 end
                if not color or type( color ) ~= "table" then
                    color = { 255, 255, 255, 255 };
                end
                if not maxDistance then maxDistance = 20 end
                local distance = getDistanceBetweenPoints3D( pX, pY, pZ, tX, tY, tZ );
                if distance <= maxDistance then
                    local x, y = getScreenFromWorldPosition( tX, tY, tZ );
                    if x and y then
                        dxDrawText( text, x, y, _, _, tocolor( color[1], color[2], color[3], color[4] ), scale, font, "center", "center" );
                    end
                end
            end
        end
    end
);


local napis = dxDraw3DText( "Magazyn ( Aby wej?? wci?nij E )", 2376.228515625, -81.091796875, 27.567346572876,2.3,"clear",255,255,255, 25)



Client side

na dole masz przyk?ad u?ycia potem po prostu setElementInterior zmiennej.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Tagi: text
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