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

Wysłany: 2014-07-26, 00:57


Maciąg







Wiek: 26
Na forum: 4376 dni
Posty: 211
Nick w MP: Dawirzo

Piwa: 149

Respekt: 31

Witam, pragn? prosi? Was o pomoc. Przejd? do tematu :) Potrzebuj? pomocy co do napis?w w powietrzu na serwerze. Nie prosz? od razu o gotowy kod, ale o podpowiedzi, jakie? linki gdzie mo?na o tym poczyta?. Drug? rzecz? jednak s? napisy na samochodach. Bo chcia?bym oznaczy? par? samochod?w :) Prosz? o pomoc, oczywi?cie za ka?d? pomoc leci zimne piwsko :D :piwo:

Podpis
Status prac nad Time to play RPG 25%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-26, 01:00


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Kod i jego zastosowanie podaje ju? 6 raz na tym forum :

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

function dxDraw3DTexttextxyzscalefontrgbmaxDistance )

    asserttypetext ) == "string""Bad argument @ dxDraw3DText" );
    asserttype) == "number""Bad argument @ dxDraw3DText" );
    asserttype) == "number""Bad argument @ dxDraw3DText" );
    asserttype) == "number""Bad argument @ dxDraw3DText" );

    if not scale or typescale ) ~= "number" or scale <= 0 then
        scale 2
    end
    if not font or typefont ) ~= "string" or not fontsfont then
        font "default"
    end
    if not r or type) ~= "number" or or 255 then
        r 255
    end
    if not g or type) ~= "number" or or 255 then
        g 255
    end
    if not b or type) ~= "number" or or 255 then
        b 255
    end
    if not maxDistance or typemaxDistance ) ~= "number" or maxDistance <= 1 then
        maxDistance 20
    end
    local textElement createElement"text" );

    if textElement then 

        setElementDatatextElement"text"text );
        setElementDatatextElement"x");
        setElementDatatextElement"y");
        setElementDatatextElement"z");
        setElementDatatextElement"scale"scale );
        setElementDatatextElement"font"font );
        setElementDatatextElement"rgba", { rgb255 } );
        setElementDatatextElement"maxDistance"maxDistance );

        return textElement
    end

    return false
end

addEventHandler"onClientRender"root,
    function( )
        local texts getElementsByType"text" );
        if #texts > 0 then
            local pXpYpZ getElementPositionlocalPlayer );
            for 1#texts do
                local text getElementDatatexts[i], "text" );
                local tXtYtZ getElementDatatexts[i], "x" ), getElementDatatexts[i], "y" ), getElementDatatexts[i], "z" );
                local font getElementDatatexts[i], "font" );
                local scale getElementDatatexts[i], "scale" );
                local color getElementDatatexts[i], "rgba" );
                local maxDistance getElementDatatexts[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 typecolor ) ~= "table" then
                    color = { 255255255255 };
                end
                if not maxDistance then maxDistance 20 end
                local distance getDistanceBetweenPoints3DpXpYpZtXtYtZ );
                if distance <= maxDistance then
                    local xgetScreenFromWorldPositiontXtYtZ );
                    if and y then
                        dxDrawTexttextxy__tocolorcolor[1], color[2], color[3], color[4] ), scalefont"center""center" );
                    end
                end
            end
        end
    end
);


local napis dxDraw3DText"Magazyn ( Aby wej?? wci?nij E )"2376.228515625, -81.09179687527.567346572876,2.3,"clear",255,255,25525)


Podpis

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

 
Wysłany: 2014-07-26, 01:11


Maciąg







Wiek: 26
Na forum: 4376 dni
Posty: 211
Nick w MP: Dawirzo

Piwa: 149

Respekt: 31

Ale to jest po prostu na te napisy w powietrzu tak? A masz mo?e na autach te? ? :)

Podpis
Status prac nad Time to play RPG 25%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-26, 01:27


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

font dxCreateFont "zachary.ttf"20 )

function renderIng( )
    local xygetCameraMatrix( )
    local dimension getElementDimensionlocalPlayer )
    for keypickup in ipairs getElementsByType"pickup" ) ) do
        if getElementDimensionpickup ) == dimension then
            local pxpypz getElementPositionpickup )
            local distance getDistanceBetweenPoints3Dpxpypzxy)
            if distance <= 20 then
                local text getElementDatapickup"message" )    
                if text and ( distance or isLineOfSightClearxyzpxpypz 0.7truetruetruetruefalsefalsetruelocalPlayer ) ) then
                    local sxsy getScreenFromWorldPositionpxpypz 0.7 )
                    if sx and sy then
                        local w dxGetTextWidthtostringtext ) )
                        local h = ( text and or ) * dxGetFontHeight( )
                        dxDrawRectanglesx 5sy 51010tocolor000200 ) )
                        dxDrawTexttostringtext ), sxsysxsytocolor255255255255 ), 1"default""center""center" )
                    end
                end
            end
        end
    end
    for keymarker in ipairs getElementsByType"marker" ) ) do
        if getElementDimensionmarker ) == dimension then
            local pxpypz getElementPositionmarker )
            local distance getDistanceBetweenPoints3Dpxpypzxy)
            if distance <= 20 then
                local text getElementDatamarker"message" )    
                if text and ( distance or isLineOfSightClearxyzpxpypz 1.7truetruetruetruefalsefalsetruelocalPlayer ) ) then
                    local sxsy getScreenFromWorldPositionpxpypz 1.7 )
                    if sx and sy then
                        local w dxGetTextWidthtostringtext ) )
                        local h = ( text and or ) * dxGetFontHeight( )
                        dxDrawRectanglesx 5sy 51010tocolor000200 ) )
                        dxDrawTexttostringtext ), sxsysxsytocolor255255255255 ), 1"default""center""center" )
                    end
                end
            end
        end
    end
    for keyplayer in ipairs getElementsByType"player" ) ) do
        if getElementDimensionplayer ) == dimension then
            local pxpypz getElementPositionplayer )
            local distance getDistanceBetweenPoints3Dpxpypzxy)
            if distance <= 20 then
                local text getElementDataplayer"message" )    
                if text and ( distance or isLineOfSightClearxyzpxpypz 1.1truetruetruetruefalsefalsetruelocalPlayer ) ) then
                    local sxsy getScreenFromWorldPositionpxpypz 0.2)
                    if sx and sy then
                        local w dxGetTextWidthtostringtext ) )
                        local h = ( text and or ) * dxGetFontHeight( )
                        -- dxDrawRectanglesx 5sy 51010tocolor000200 ) )
                         dxDrawTexttostringtext ), sxsysxsytocolor255255255255 ), 1.2"default""center""center" )
                    end
                end
            end
        end
    end        
    for keyped in ipairs getElementsByType"ped" ) ) do
        if getElementDimensionped ) == dimension then
            local pxpypz getElementPositionped )
            local distance getDistanceBetweenPoints3Dpxpypzxy)
            if distance <= 20 then
                local text getElementDataped"message" )    
                if text and ( distance or isLineOfSightClearxyzpxpypz 0truetruetruetruefalsefalsetruelocalPlayer ) ) then
                    local sxsy getScreenFromWorldPositionpxpypz 0.1)
                    if sx and sy then
                        local w dxGetTextWidthtostringtext ) )
                        local h = ( text and or ) * dxGetFontHeight( )
                        dxDrawRectanglesx 5sy 110htocolor000200 ) )
                        dxDrawTexttostringtext ), sxsysxsytocolor255255255255 ), 1"default""center""center" )
                    end
                end
            end
        end
    end    
    for keyvehicle in ipairs getElementsByType"vehicle" ) ) do
        if getElementDimensionvehicle ) == dimension then
            local pxpypz getElementPositionvehicle )
            local distance getDistanceBetweenPoints3Dpxpypzxy)
            if distance <= 20 then
                local text getElementDatavehicle"message" )    
                if text and ( distance or isLineOfSightClearxyzpxpypz 1.1truetruetruetruefalsefalsetrue ) ) then
                    local sxsy getScreenFromWorldPositionpxpypz+0.2 )
                    if sx and sy then
                        local w dxGetTextWidthtostringtext ) )
                        local h = ( text and or ) * dxGetFontHeight( )
                        --dxDrawRectanglesx 25sy 1+50htocolor000200 ) )
                        dxDrawText"Na kartce napisane:"sxsysxsy-30tocolor255255255255 ), 0.8"bankgothic""center""center" )
                        --dxDrawRectanglesx 25sy 3030030tocolor000200 ) )
                        dxDrawTexttostringtext ), sxsy+30sxsytocolor255255255255 ), 0.7"bankgothic""center""center" )
                    end
                end
            end
        end
    end    
    for keyobject in ipairs getElementsByType"object" ) ) do
        if getElementDimension( object ) == dimension then
            local pxpypz getElementPosition( object )
            local distance getDistanceBetweenPoints3Dpxpypzxy)
            if distance <= 20 then
                local text getElementDataobject"message" )    
                if text and ( distance or isLineOfSightClearxyzpxpypz 1.1truetruetruetruefalsefalsetruelocalPlayer ) ) then
                    local sxsy getScreenFromWorldPositionpxpypz 1.1 )
                    if sx and sy then
                        local w dxGetTextWidthtostringtext ) )
                        local h = ( text and or ) * dxGetFontHeight( )
                         dxDrawRectanglesx 5sy 110htocolor000200 ) )
                        dxDrawTexttostringtext ), sxsysxsytocolor255255255255 ), 1"default""center""center" )
                    end
                end
            end
        end
    end    
end
addEventHandler"onClientRender"getRootElement( ),renderIng)



Do tego wgraj swoj? czcionk? o nazwie zachary.ttf

Podpis

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

 
Wysłany: 2014-07-26, 01:32


Maciąg







Wiek: 26
Na forum: 4376 dni
Posty: 211
Nick w MP: Dawirzo

Piwa: 149

Respekt: 31

Dzi?ki, +10 repy dosta?e?, teraz dostaniesz kolejne piwo :)

Podpis
Status prac nad Time to play RPG 25%
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-26, 15:07


Mizy1999

I <3 Mta






Wiek: 28
Na forum: 4995 dni
Posty: 157
Nick w MP: xxx

Piwa: 154

Respekt: 40

Maci?g, pom?g? by? z tymi 3d textami, nigdy nie chc? mi dzia?a?, podpinam to pod c-side, na dole edytuje napis, by by? na kordach 0,0,3 a i tak wywala mi error na linijce 55:
Kod:

'<name>' expected near '1'


Postaw piwo autorowi tego posta
 

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


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Poka? t? linijk?.

Podpis

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

 
Wysłany: 2014-07-26, 20:52


Mizy1999

I <3 Mta






Wiek: 28
Na forum: 4995 dni
Posty: 157
Nick w MP: xxx

Piwa: 154

Respekt: 40

Kod:

local text = getElementData( texts[i], "text" );

Prosz? :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-26, 21:05


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Na pewno w tej jest b??d ? Nikomu innemu nie pokazuje sie on.

Podpis

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

 
Wysłany: 2014-07-26, 21:12


Mizy1999

I <3 Mta






Wiek: 28
Na forum: 4995 dni
Posty: 157
Nick w MP: xxx

Piwa: 154

Respekt: 40

100% P??niej si? zajm? tym skryptem, obecnie bawi? si? z grupami.

Postaw piwo autorowi tego posta
 

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