! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
function dxDraw3DText( text, x, y, z, scale, font, r, g, b, maxDistance )
-- checking required arguments
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" );
-- checking optional arguments
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 = 12
end
local textElement = createElement( "text" );
-- checking if the element was created
if textElement then
-- setting the element datas
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 );
-- returning the text element
return textElement
end
-- returning false in case of errors
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 = 12 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( "Wjazd", x, y, _, _, tocolor( color[1], color[2], color[3], color[4] ), scale, font, "center", "center" );
end
end
end
end
end
);
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
defscale=1
defr=255
defg=255
defb=255
defa=255
defdd=100
defscale3d=true
deffont="default-bold"
local sx, sy = guiGetScreenSize ( )
local gx = sx * 0.1
local gy = sy * 0.1
local posX = 0
local posY = 0
local sizeX = 0
local sizeY = 0
local pd,pi
local teksty={}
function refreshNearbyTexts()
teksty=getElementsByType ( "text", getRootElement(), true )
local px,py,_ = getCameraMatrix()
pd=getElementDimension(localPlayer)
pi=getElementInterior(localPlayer)
for i, t in pairs ( teksty ) do
if (getElementDimension(t)~=pd or getElementInterior(t)~=pi) then
teksty[i]=nil
else
local cx, cy, _ = getElementPosition ( t )
local dist = getDistanceBetweenPoints2D ( px, py, cx, cy)
if (dist>defdd) then
teksty[i]=nil
end
end
end
end
setTimer(refreshNearbyTexts, 2000, 0)
addEventHandler ( "onClientRender", getRootElement ( ),
function ( )
local px,py,pz = getCameraMatrix()
for i, t in pairs ( teksty ) do
if (t and isElement(t) and getElementDimension(t)==pd and getElementInterior(t)==pi) then
local cx, cy, cz = getElementPosition ( t )
if ( getElementData(t, "attach") ) and (not getElementPosition(getElementData(t, "attach"))) then destroyElement(t) end
if getElementData(t, "attach") and isElement(getElementData(t, "attach")) and getElementType(getElementData(t, "attach"))=="ped" then
cx,cy,cz = getElementPosition(getElementData(t, "attach"))
end
if getElementData(t, "addz") then
cz = cz+getElementData(t, "addz") or cz
end
local dist = getDistanceBetweenPoints3D ( px, py, pz, cx, cy, cz )
if dist < defdd then
local scx, scy = getScreenFromWorldPosition ( cx, cy, cz, 100, true )
if scx and scy and isLineOfSightClear ( px, py, pz, cx, cy, cz, true,false, true, true ) then
--The text default parameters
local alpha = defa
local r = defr
local g = defg
local b = defb
local scale = defscale
local scale3d = defscale3d
local font = deffont
if getElementData ( t, "scale", false ) then scale = getElementData ( t, "scale", false ) end
if getElementData ( t, "font", false ) then font = getElementData ( t, "font", false) end
if scale3d == true then scale = scale * ( ( defdd - dist ) / defdd ) end
local text = getElementData ( t, "text" )
if not text or text == "" then return end
local c = getElementData ( t, "rgba" )
if c and type ( c ) == "table" then r = c[1] g = c[2] b = c[3] alpha = c[4] end
local ac=(r+g+b)/3
dxDrawText ( text, scx+2, scy+2, scx, scy, tocolor ( 255-ac, 255-ac, 255-ac, alpha ), scale, font, "center", "center" )
dxDrawText ( text, scx-2, scy+2, scx, scy, tocolor ( 255-ac, 255-ac, 255-ac, alpha ), scale, font, "center", "center" )
dxDrawText ( text, scx+2, scy-2, scx, scy, tocolor ( 255-ac, 255-ac, 255-ac, alpha ), scale, font, "center", "center" )
dxDrawText ( text, scx-2, scy-2, scx, scy, tocolor ( 255-ac, 255-ac, 255-ac, alpha ), scale, font, "center", "center" )
dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center" )
end
end
end
end
end )
tamten kod jest do tego, i normalnie robi mi 3d texty
--e_marker = createMarker(2151.5, -1318.5, 24.7, "cylinder", 3, 255, 0, 0, 0)
local auto = getPedOccupiedVehicle(localPlayer)
local marker = createMarker(2151.4306640625, -1321.1318359375, 25.312812805176, "cylinder", 3, 255, 0, 0, 0)
local zmienna1 = getVehicleHandling(auto, engineAcceleration)
--local zmienna2 = getElementData(auto, "mk2", true)
local konie = zmienna1*10
function jestwmarkerze(plr)
if auto then
if isElementWithinMarker(plr, marker) then
dxDrawText ( "Hamownia Gas Monkey\n Konie mechaniczne "..konie.."\n", sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), math.min ( 0.4*(150/distance)*1.4,4), "bankgothic", "center", "bottom", false, false, false )
end
end
end
addEventHandler('onMarkerHit', marker, jestwmarkerze)
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
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