Wysłany: 2014-07-17, 16:13
Maximerr
Programmer PHP, LUA
Wiek: 25 Na forum: 4427 dni Posty: 548
Piwa : 1051
Witam! Ot??, mam pewien problem. Jak zrobi? text 3d w interiorze? Za pomoc =
Wysłany: 2014-07-17, 16:15
krydianero
Samotny Wilk
Wiek: 33 Na forum: 4782 dni Posty: 395
Nick w MP: Yoshida
Piwa : 1798
Taki skrypt ju? istnieje: Kod: http://community.mtasa.com/index.php?p=resources&s=details&id=3090
prosz?
Podpis
Multi Drive Unlimited:Nowy projekt już wkrótce
Wysłany: 2014-07-17, 16:22
Maximerr
Programmer PHP, LUA
Wiek: 25 Na forum: 4427 dni Posty: 548
Piwa : 1051
Ta, widzia?em go. Ale wola?bym sam to zrobi?. Prosi?bym o kod..
Wysłany: 2014-07-17, 16:44
krydianero
Samotny Wilk
Wiek: 33 Na forum: 4782 dni Posty: 395
Nick w MP: Yoshida
Piwa : 1798
No to skoro chcesz kod no to wyjmij ze skryptu...
Podpis
Multi Drive Unlimited:Nowy projekt już wkrótce
Wysłany: 2014-07-17, 17:07
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
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 )
Client side
na dole masz przyk?ad u?ycia potem po prostu setElementInterior zmiennej.
Tagi: text
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: