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

Wysłany: 2014-12-27, 12:25


Lysy_Kappa







Wiek: 25
Na forum: 4336 dni
Posty: 10
Nick w MP: Lysy



Respekt: 45,3

Siema, tutaj ?ysy, ja z problemem:
Napisa?em skrypt z poradnika, i nie dzia?a :/ .
Mogliby?cie pom?c? Oczywi?cie, daje Grza?ca, na ocieplenie :) .
Chcia?bym aby w kodzie znajdowa? si? w markerze text3d, z napisem: Darmowe Buffalo, ale nie wiem jak to zrobi? ;/.
KOD:
Kod:

function auto ( thePlayer )
createVehicle ( 402, -2534.1706542969, 2361.3276367188, 4.9856700897217 )
marker = createMarker ( -2534.1706542969, 2361.3276367188, 4.9856700897217, "cylinder", 1.5, 255, 255, 255, 170 )
end
addEventHandler ( "onMarkerHit", marker, auto )

Pozdrawiam,
?ysy.

[ Dodano: 2014-12-27, 12:29 ]
Wydaje mi si?, ?e musz? dwa razy end da?, ale nie jestem pewien.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-27, 12:43


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

createMarker wywal na g?r? funkcji.

Co do 3dtext :

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+2, y+2, _, _, tocolor( 0, 0, 0, 255 ), scale, font, "center", "center" );
                        dxDrawText( text, x, y, _, _, tocolor( color[1], color[2], color[3], color[4] ), scale, font, "center", "center" );
                    end
                end
            end
        end
    end
);


Podpis

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

 
Wysłany: 2014-12-27, 12:48


Lysy_Kappa







Wiek: 25
Na forum: 4336 dni
Posty: 10
Nick w MP: Lysy



Respekt: 45,3

Czyli ma to wygl?da? tak?:
Kod:

marker = createMarker ( -2534.1706542969, 2361.3276367188, 4.9856700897217, "cylinder", 1.5, 255, 255, 255, 170 )
function auto ( thePlayer )
createVehicle ( 402, -2534.1706542969, 2361.3276367188, 4.9856700897217 )
end
addEventHandler ( "onMarkerHit", marker, auto )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-27, 12:57


MeeShuffle

Programista/Grafik






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

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Teraz tylko Ci auto da :)

Podpis

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

 
Wysłany: 2014-12-27, 13:00


Lysy_Kappa







Wiek: 25
Na forum: 4336 dni
Posty: 10
Nick w MP: Lysy



Respekt: 45,3

Ok- dziala, dziena.

[ Dodano: 2014-12-27, 13:00 ]
A jak zrobi?, ?eby dawa?o mi auto, i ?eby od razu do niego tepa?o, bo w twoim poradniku tego nie zobaczy?em. ;-;

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-27, 13:54


Jeey

Lua, Grafik






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

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%

marker = createMarker ( -2534.1706542969, 2361.3276367188, 4.9856700897217, "cylinder", 1.5, 255, 255, 255, 170 ) 
function auto ( thePlayer ) 
auto = createVehicle ( 402, -2534.1706542969, 2361.3276367188, 4.9856700897217 ) 
 warpPedIntoVehicle ( thePlayer, auto) 
end 
addEventHandler ( "onMarkerHit", marker, auto )


Postaw piwo autorowi tego posta
 

 
Tagi: dawanie :: auta
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