function samochod()
local betoniarka = auto[source] -- ?aduje auto (daje)
if betoniarka then -- sprawdza
if isElement( betoniarka ) then
destroyElement( betoniarka )
end
auto[source]= nil -- czyste
end
if isElement(source) then
local betoniarka = createVehicle ( 524, 780.79998779297, 838, 6.9000000953674 ) -- betoniarka x, y , z
setElementData(betoniarka,"message","Praca Dorywcza - Kopalnia")
warpPedIntoVehicle ( source, betoniarka ) -- tepa gracza do pojazdu
auto[source]= betoniarka -- zapisuje
end
end
)
Bo?e, m?j kod na 3dtext. Samo setElementData Ci nic nie da..
-- License: Do whatever you want to with it
function renderIng( )
local x, y, z = getCameraMatrix( )
local dimension = getElementDimension( localPlayer )
for key, pickup in ipairs ( getElementsByType( "pickup" ) ) do
if getElementDimension( pickup ) == dimension then
local px, py, pz = getElementPosition( pickup )
local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
if distance <= 20 then
local text = getElementData( pickup, "message" )
if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 0.7, true, true, true, true, false, false, true, localPlayer ) ) then
local sx, sy = getScreenFromWorldPosition( px, py, pz + 0.7 )
if sx and sy then
local w = dxGetTextWidth( tostring( text ) )
local h = ( text and 2 or 1 ) * dxGetFontHeight( )
dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 5, w + 10, h + 10, tocolor( 0, 0, 0, 200 ) )
dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
end
end
end
end
end
for key, marker in ipairs ( getElementsByType( "marker" ) ) do
if getElementDimension( marker ) == dimension then
local px, py, pz = getElementPosition( marker )
local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
if distance <= 20 then
local text = getElementData( marker, "message" )
if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.7, true, true, true, true, false, false, true, localPlayer ) ) then
local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.7 )
if sx and sy then
local w = dxGetTextWidth( tostring( text ) )
local h = ( text and 2 or 1 ) * dxGetFontHeight( )
dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 5, w + 10, h + 10, tocolor( 0, 0, 0, 200 ) )
dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
end
end
end
end
end
for key, player in ipairs ( getElementsByType( "player" ) ) do
if getElementDimension( player ) == dimension then
local px, py, pz = getElementPosition( player )
local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
if distance <= 20 then
local text = getElementData( player, "message" )
if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
local sx, sy = getScreenFromWorldPosition( px, py, pz + 0.2)
if sx and sy then
local w = dxGetTextWidth( tostring( text ) )
local h = ( text and 2 or 1 ) * dxGetFontHeight( )
-- dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 5, w + 10, h + 10, tocolor( 0, 0, 0, 200 ) )
dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1.2, "default", "center", "center" )
end
end
end
end
end
for key, ped in ipairs ( getElementsByType( "ped" ) ) do
if getElementDimension( ped ) == dimension then
local px, py, pz = getElementPosition( ped )
local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
if distance <= 20 then
local text = getElementData( ped, "message" )
if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 0, true, true, true, true, false, false, true, localPlayer ) ) then
local sx, sy = getScreenFromWorldPosition( px, py, pz + 0.1)
if sx and sy then
local w = dxGetTextWidth( tostring( text ) )
local h = ( text and 2 or 1 ) * dxGetFontHeight( )
dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 1, w + 10, h, tocolor( 0, 0, 0, 200 ) )
dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
end
end
end
end
end
for key, vehicle in ipairs ( getElementsByType( "vehicle" ) ) do
if getElementDimension( vehicle ) == dimension then
local px, py, pz = getElementPosition( vehicle )
local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
if distance <= 20 then
local text = getElementData( vehicle, "message" )
if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.8 )
if sx and sy then
local w = dxGetTextWidth( tostring( text ) )
local h = ( text and 2 or 1 ) * dxGetFontHeight( )
dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 1, w + 10, h, tocolor( 0, 0, 0, 200 ) )
dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
end
end
end
end
end
for key, object in ipairs ( getElementsByType( "object" ) ) do
if getElementDimension( object ) == dimension then
local px, py, pz = getElementPosition( object )
local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
if distance <= 20 then
local text = getElementData( object, "message" )
if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.1 )
if sx and sy then
local w = dxGetTextWidth( tostring( text ) )
local h = ( text and 2 or 1 ) * dxGetFontHeight( )
dxDrawRectangle( sx - w / 2 - 5, sy - h / 2 - 1, w + 10, h, tocolor( 0, 0, 0, 200 ) )
dxDrawText( tostring( text ), sx, sy, sx, sy, tocolor( 255, 255, 255, 255 ), 1, "default", "center", "center" )
end
end
end
end
end
end
addEventHandler( "onClientRender", getRootElement( ),renderIng)
kubak14, nie chodzi mi o funkcje ona nie jest do tego potrzebna xD
PanMaszyna, ja dawno mia?em twoje 3dtext , ale i tak nie dawa?o napisu na samochodzie
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