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

Wysłany: 2014-07-29, 23:29


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4480 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
Witam zrobi?em skrypt na prace dorywcza i chce doda? napis na samochodzie jak si? ze spawni ?eby by? na g?rze a nie ma o to kawa?ek kodu

function(samochod)
        local betoniarka = auto[source] -- ?aduje auto (daje)
        if betoniarka then -- sprawdza
            if isElement( betoniarka ) then
                destroyElement( betoniarka )
            end
            auto[source]= nil -- czyste
        end
        
        if isElement(source) then
            local betoniarka = createVehicle ( 524, 780.79998779297, 838, 6.9000000953674 ) -- betoniarka x, y , z
            setElementData(betoniarka,"message","Praca Dorywcza - Kopalnia")
            warpPedIntoVehicle ( source, betoniarka ) -- tepa gracza do pojazdu 
            auto[source]= betoniarka -- zapisuje 
        end
    end
)


da?em w kodzie takie co?
setElementData(betoniarka,"message","Praca Dorywcza - Kopalnia")
 
ale nie daje tekstu na samochodzie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-29, 23:48


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

function(samochod)


co to jest ?...

Podpis

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

 
Wysłany: 2014-07-30, 11:36


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4480 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
ale mi chodzi o napis bo tworzy pojazd mi ale nie tworzy napisu na pojezdzie

o ten kawa?ek kodu

 local betoniarka = createVehicle ( 524, 780.79998779297, 838, 6.9000000953674 ) 
          setElementData(betoniarka,"message","Praca Dorywcza - Kopalnia")


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-30, 14:44


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Poka? funkcj? mojego kodu na 3dtexty.

Podpis

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

 
Wysłany: 2014-07-30, 15:53


kubak14







Wiek: 24
Na forum: 5346 dni
Posty: 119
Nick w MP: Heavy

Piwa: 149

Respekt: 45,8

Ostrzeżeń: 20%
function samochod()
        local betoniarka = auto[source] -- ?aduje auto (daje)
        if betoniarka then -- sprawdza
            if isElement( betoniarka ) then
                destroyElement( betoniarka )
            end
            auto[source]= nil -- czyste
        end
        
        if isElement(source) then
            local betoniarka = createVehicle ( 524, 780.79998779297, 838, 6.9000000953674 ) -- betoniarka x, y , z
            setElementData(betoniarka,"message","Praca Dorywcza - Kopalnia")
            warpPedIntoVehicle ( source, betoniarka ) -- tepa gracza do pojazdu 
            auto[source]= betoniarka -- zapisuje 
        end
    end
)


Tak apropo powinna wygl?da? funkcja samochod

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-30, 16:08


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Bo?e, m?j kod na 3dtext. Samo setElementData Ci nic nie da..


-- License: Do whatever you want to with it

function renderIng( )
    local x, y, z = getCameraMatrix( )
    local dimension = getElementDimension( localPlayer )
    for key, pickup in ipairs ( getElementsByType( "pickup" ) ) do
        if getElementDimension( pickup ) == dimension then
            local px, py, pz = getElementPosition( pickup )
            local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
            if distance <= 20 then
                local text = getElementData( pickup, "message" )    
                if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 0.7, true, true, true, true, false, false, true, localPlayer ) ) then
                    local sx, sy = getScreenFromWorldPosition( px, py, pz + 0.7 )
                    if sx and sy then
                        local w = dxGetTextWidth( tostring( text ) )
                        local h = ( text and 2 or 1 ) * dxGetFontHeight( )
                        dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 5, w + 10, h + 10, tocolor( 0, 0, 0, 200 ) )
                        dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
                    end
                end
            end
        end
    end
    for key, marker in ipairs ( getElementsByType( "marker" ) ) do
        if getElementDimension( marker ) == dimension then
            local px, py, pz = getElementPosition( marker )
            local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
            if distance <= 20 then
                local text = getElementData( marker, "message" )    
                if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.7, true, true, true, true, false, false, true, localPlayer ) ) then
                    local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.7 )
                    if sx and sy then
                        local w = dxGetTextWidth( tostring( text ) )
                        local h = ( text and 2 or 1 ) * dxGetFontHeight( )
                        dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 5, w + 10, h + 10, tocolor( 0, 0, 0, 200 ) )
                        dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
                    end
                end
            end
        end
    end
    for key, player in ipairs ( getElementsByType( "player" ) ) do
        if getElementDimension( player ) == dimension then
            local px, py, pz = getElementPosition( player )
            local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
            if distance <= 20 then
                local text = getElementData( player, "message" )    
                if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
                    local sx, sy = getScreenFromWorldPosition( px, py, pz + 0.2)
                    if sx and sy then
                        local w = dxGetTextWidth( tostring( text ) )
                        local h = ( text and 2 or 1 ) * dxGetFontHeight( )
                        -- dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 5, w + 10, h + 10, tocolor( 0, 0, 0, 200 ) )
                         dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1.2, "default", "center", "center" )
                    end
                end
            end
        end
    end        
    for key, ped in ipairs ( getElementsByType( "ped" ) ) do
        if getElementDimension( ped ) == dimension then
            local px, py, pz = getElementPosition( ped )
            local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
            if distance <= 20 then
                local text = getElementData( ped, "message" )    
                if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 0, true, true, true, true, false, false, true, localPlayer ) ) then
                    local sx, sy = getScreenFromWorldPosition( px, py, pz + 0.1)
                    if sx and sy then
                        local w = dxGetTextWidth( tostring( text ) )
                        local h = ( text and 2 or 1 ) * dxGetFontHeight( )
                        dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 1, w + 10, h, tocolor( 0, 0, 0, 200 ) )
                        dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
                    end
                end
            end
        end
    end    
    for key, vehicle in ipairs ( getElementsByType( "vehicle" ) ) do
        if getElementDimension( vehicle ) == dimension then
            local px, py, pz = getElementPosition( vehicle )
            local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
            if distance <= 20 then
                local text = getElementData( vehicle, "message" )    
                if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
                    local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.8 )
                    if sx and sy then
                        local w = dxGetTextWidth( tostring( text ) )
                        local h = ( text and 2 or 1 ) * dxGetFontHeight( )
                        dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 1, w + 10, h, tocolor( 0, 0, 0, 200 ) )
                        dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
                    end
                end
            end
        end
    end    
    for key, object in ipairs ( getElementsByType( "object" ) ) do
        if getElementDimension( object ) == dimension then
            local px, py, pz = getElementPosition( object )
            local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
            if distance <= 20 then
                local text = getElementData( object, "message" )    
                if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
                    local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.1 )
                    if sx and sy then
                        local w = dxGetTextWidth( tostring( text ) )
                        local h = ( text and 2 or 1 ) * dxGetFontHeight( )
                         dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 1, w + 10, h, tocolor( 0, 0, 0, 200 ) )
                        dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
                    end
                end
            end
        end
    end    
end
addEventHandler( "onClientRender", getRootElement( ),renderIng)


c-side

Podpis

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

 
Wysłany: 2014-07-30, 16:32


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4480 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
kubak14, nie chodzi mi o funkcje ona nie jest do tego potrzebna xD
PanMaszyna, ja dawno mia?em twoje 3dtext , ale i tak nie dawa?o napisu na samochodzie :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-07-30, 20:56


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

To zapewne co? ?le robisz.

Podpis

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

 
Tagi: tekst
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Tekst 3d 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