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

Wysłany: 2014-08-14, 12:01


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Witam serdecznie kochani. Jestem nowy na forum. Ale pisz? bo mam pewien problem. Jestem przekonany ?e mi pomo?ecie bo kolega poleci? to forum, m?wi? ?e wspaniali ludzie. A wi?c przejd?my do rzeczy ;) Chodzi o napisy. Dok?adnie o to ?e w danych kordach wy?wietla si? napis. Ja mam takowy skrypt bo przegl?da?em forum jako go?? i znalaz?em jak PanMaszyna podawa? jakiemu? innemu kolesiowi. U?y?em kodu, ale wyskakuj? b??dy. Podam kod :D

 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)


[ Dodano: 2014-08-14, 12:04 ]
Oczywi?cie za pomoc :piwo: , a tutaj ss jakie b??dy wyszukuje MTA Script Editor:



[ Dodano: 2014-08-14, 12:04 ]
http://zapodaj.net/5f20b23c1c347.png.html

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-14, 15:33


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Dixers, usu? ":", ";" na koncu wierszy jak masz ): lub );

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-14, 16:57


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Nadal nic :( Macie jakie? pomys?y ?

[ Dodano: 2014-08-14, 17:00 ]
A dzi?ki ch?opie za pomoc, ale ju? nie potrzebuje ;) Wy?apa?em sam ju? b??dy :) Piwko leci za ch?ci :D

[ Dodano: 2014-08-14, 17:14 ]
A jednak pojawi?y si? problemy. Kod jest taki. MTA Script editor nic nie pokazuje ale jest db3

 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:1", "text" )
            local tX, tY, tZ = getElementData( texts"i:2", "x" ), getElementData( texts"i:3", "y" ), getElementData( texts"i:4", "z" )
                local font = getElementData( texts"i:5", "font" )
                local scale = getElementData( texts"i:6", "scale" )
                local color = getElementData( texts"i:7", "rgba" )
                local maxDistance = getElementData( texts"i:8", "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( "Zak?ad Pogrzebowy Rado??", -2127.1999511719, -80.5, 35.299999237061,2.3,"clear",255,255,255, 25)

A o to db3:
ERROR:rpg/skrypty/napis1.lua:55:attempt to call local "texts" (a table value)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-14, 18:53


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

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:1], "text" );
                local tX, tY, tZ = getElementData( texts[i:2], "x" ), getElementData( texts[i:3], "y" ), getElementData( texts[i:4], "z" );
                local font = getElementData( texts[i:5], "font" );
                local scale = getElementData( texts[i:6], "scale" );
                local color = getElementData( texts[i:7], "rgba" );
                local maxDistance = getElementData( texts[i:8], "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( "Zak?ad Pogrzebowy Rado??", -2127.1999511719, -80.5, 35.299999237061,2.3,"default",255,255,255, 25)

Sprawdz Strona c-side.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-14, 22:03


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Nadal taki sam db3 i dodatkowo :
ERROR: Loading script failed rpg/skrypty.napis1.lua:55: '<name' expected near '1'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-15, 12:09


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Dixers, w nazwie nie mo?e by? . tylko _ lub razem

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-15, 20:51


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

luki123luki123, nie ma przepraszam, to tylko liter?wka.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-16, 15:51


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Dixers, po jakiej stronie masz ten skrypt ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-16, 17:55


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

No po stronie clienta

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-17, 15:55


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Dixers, nie wiem czemu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-08-17, 18:40


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Hmmm, mo?e Maszyna b?dzie wiedzia? bo to jego kod. Napisz? do niego, dzi?ki luki za pomoc.

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 » Napisy 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