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

Wysłany: 2014-06-22, 14:59


Mizy1999

I <3 Mta






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

Piwa: 154

Respekt: 40

Cze??, chcia?bym zrobi? 3D Texty, takie jak na Play Your Life, prosi? bym o kodzik, i? potrzebuje do oznaczenia poszczeg?lnych budynk?w ;p . Pozdro, b?d? :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-22, 16:14


Maciąg







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

Piwa: 149

Respekt: 31

A ta? bardzo potrzebuj?, je?li kto? mia?by gotowego skrypta prosi? bym tak jak kolega wy?ej :) Bardzo mi na tym zale?y, oczywi?cie za podes?anie daje :piwo:

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

 
Wysłany: 2014-06-22, 17:21


MeeShuffle

Programista/Grafik






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

Piwa: 8575

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 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,"default",255,255,25525)



Ni?ej podany od razu przyk?ad. Skrypt pod c-side.

Podpis

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

 
Wysłany: 2014-06-22, 19:04


Mizy1999

I <3 Mta






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

Piwa: 154

Respekt: 40

Mam ma?y problem, daj? tak:
Kod:

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( "Urz?d Miasta Fort Carson", -206.90, 1119.19, 20.42,2.3,"default",255,255,255, 25)

I tak? met?:
Kod:

<meta>
<info author="ToMasz" description="test 3d" type="script" version="1.0" />
<script src="3dtext.lua" type="server" />
</meta>

Co jest ?le ? Jak w??czam to wy??cza mi skrypt ;P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-22, 19:15


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Napisa?em Ci wyra?nie, c-side nie s-side

Podpis

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

 
Wysłany: 2014-06-22, 20:29


Mizy1999

I <3 Mta






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

Piwa: 154

Respekt: 40

Okej, zrobi?em na c-side, i co, niby running, ale i tak nie dzia?a. Nie pokazuje si? ten tekst.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-06-22, 20:40


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Mizy1999, w ostatniej linijce kt?ra Ci da?em uzupe?niasz tekst i kordy.

Podpis

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

 
Tagi: texty.
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