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

Wysłany: 2014-05-24, 09:09


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Witam,
mam kod na tekst 3d, wszystko ?adnie dzia?a, tylko nie wiem jak zrobi?, aby tekst by? widoczny w maksymalnej odleg?o?ci 20m. W tym kodzie tekst wida? na ca?ej mapie :/
Bardzo prosz? o pomoc. Browce czekaj? :piwo: .

Cytat:

addEventHandler("onClientRender", getRootElement(),
function()
cx, cy, cz = getCameraMatrix()
px, py, pz = 1487.6473388672, 661.15960693359, 10.812507629395
if isLineOfSightClear( cx, cy, cz, px, py, pz, true, false, false, true, false, false, false, getLocalPlayer()) then
local x, y = getScreenFromWorldPosition(px, py, pz)
dxDrawText("WITAJ NA SPAWNIE", x, y, x, y, tocolor(131, 255, 255), 1, "pricedown")
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 11:25


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Cze??
Przyk?ad kodu :

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
);


potem tylko nadajesz :

dxDraw3DText( "Tre??", x, y, z,wielko??,"default",255,255,255, 25)

Pozdrawiam

Podpis

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

 
Wysłany: 2014-05-24, 11:55


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Zrobi?em tak jak mi poda?e? jednak nie dzia?a.
Je?li mo?esz wype?nij mi ten kod, oto kordy napisu:
1487.6473388672, 661.15960693359, 10.812507629395
Napis niech b?dzie: Witaj na spawnie. Czcionka Pricedown.

Piwko czeka :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 11:56


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Wklej kod wy?ej a pod nim


Kod:

tekst = dxDraw3DText( "Witaj na spawnie", 1487.6473388672, 661.15960693359, 10.812507629395,2,"pricedown",255,255,255, 25)


Prosze bardzo.


@edit

U mnie ?miga :)




Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 12:14


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Niestety co? mi nie wchodzi, wkleisz ca?y gotowy kod?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 12:24


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

da?e? jako c-side ?

Podpis

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

 
Wysłany: 2014-05-24, 12:34


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

Nie rozumiem, mo?esz mi da? ten wype?niony kod?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 12:35


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

To jest kod na client side. Daj swoj? meta.xml

Podpis

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

 
Wysłany: 2014-05-24, 12:39


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Nie wiesz to nie m?w :) To co jest w ".." nie ma znaczenia jak wpiszesz. LUA czyta to jako ca?? zawarto?? i pobiera j? z wbudowanym table.concat.

@edit

a je?li ci chodzi?o o zmienn?, ona te? nie ma nic do rzeczy. Ch?opak nie prze?o?y? pliku na c-side.

Ostatnio zmieniony przez MeeShuffle 2014-05-24, 12:41, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 12:39


Zgredek666

LUA






Wiek: 27
Na forum: 4722 dni
Posty: 251
Nick w MP: Zgredek

Piwa: 442

Respekt: 70,1

Meta ma wygl?da? tak

Kod:



<srcipt src="nazwa.lua" type="client" />



Podpis
Piszę skrypty lua na serwery Truck/RPG/Race/DayZ. Kontakt pw!

Pomogłem? Wystarczy jak postawisz :piwo:



Zapraszam na mój kanał na yt:
https://www.youtube.com/c...vgsF65M-Xw5hEDQ
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 12:40


xBolekk







Wiek: 24
Na forum: 4474 dni
Posty: 113
Nick w MP: Bolek.

Piwa: 190

Respekt: 60

S?uchaj, to m?j kod:

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
);
tekst = dxDraw3DText( "Witaj na spawnie", 1487.6473388672, 661.15960693359, 10.812507629395,2,"pricedown",255,255,255, 25)


Meta:

Kod:

<meta>
<info name="3d" author"bolek" type="script" version"1.0.0" />
<script src="napis3d.lua" type="client" />
</meta>


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-24, 12:42


MeeShuffle

Programista/Grafik






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

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Gdzie znajduj? si? te kordy ? Sprawdz? u Siebie.

Podpis

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

 
Tagi: text :: jak :: zrobić :: aby :: było :: widać :: max :: metrów?
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