Wysłany: 2016-07-09, 23:50
noose
JESTĘ SKRYPTERĘ
Wiek: 35 Na forum: 3756 dni Posty: 222
Piwa : 2294
Siemson;) Nie wiem co robi? ?le, dlatego udaj? si? po pomoc do Was. Mam pojazdy w server.lua, i chc? po stronie klienckiej doda? dla nich tekst(bo ta funkcja dzia?a tylko po stronie klienta(chyba). No i stworzy?em taki kod, tylko nie dzia?a Jakie? rady kto?? ;>
function mytext ()
for k , v in ipairs ( getElementsByType ( "vehicle" )) do
if ( getElementModel ( v )== 407 ) then
dt = dxDrawTextOnElement ( v , "test" , 1 , 20 , 30 , 30 , 30 , 255 , 1 , "default" )
end
end
addEventHandler ( "onClientResourceStart" , root , mytext )
function dxDrawTextOnElement ( TheElement , text , height , distance , R , G , B , alpha , size , font , checkBuildings , checkVehicles , checkPeds , checkDummies , seeThroughStuff , ignoreSomeObjectsForCamera , ignoredElement )
local x , y , z = getElementPosition ( TheElement )
local x2 , y2 , z2 = getElementPosition ( localPlayer )
local distance = distance or 20
local height = height or 1
local checkBuildings = checkBuildings or true
local checkVehicles = checkVehicles or false
local checkPeds = checkPeds or false
local checkObjects = checkObjects or true
local checkDummies = checkDummies or true
local seeThroughStuff = seeThroughStuff or false
local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
local ignoredElement = ignoredElement or nil
if ( isLineOfSightClear ( x , y , z , x2 , y2 , z2 , checkBuildings , checkVehicles , checkPeds , checkObjects , checkDummies , seeThroughStuff , ignoreSomeObjectsForCamera , ignoredElement )) then
local sx , sy = getScreenFromWorldPosition ( x , y , z + height )
if( sx ) and ( sy ) then
local distanceBetweenPoints = getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )
if( distanceBetweenPoints < distance ) then
dxDrawText ( text , sx + 2 , sy + 2 , sx , sy , tocolor ( R or 255 , G or 255 , B or 255 , alpha or 255 ), ( size or 1 )-( distanceBetweenPoints / distance ), font or "arial" , "center" , "center" )
end
end
end
end
Wysłany: 2016-07-10, 00:18
GabWas
Wiek: 24 Na forum: 3881 dni Posty: 289
Nick w MP: GabWas
Piwa : 65
Zamie? kolejno?? funkcji.
Wysłany: 2016-07-10, 00:25
noose
JESTĘ SKRYPTERĘ
Wiek: 35 Na forum: 3756 dni Posty: 222
Piwa : 2294
function dxDrawTextOnElement ( TheElement , text , height , distance , R , G , B , alpha , size , font , checkBuildings , checkVehicles , checkPeds , checkDummies , seeThroughStuff , ignoreSomeObjectsForCamera , ignoredElement )
local x , y , z = getElementPosition ( TheElement )
local x2 , y2 , z2 = getElementPosition ( localPlayer )
local distance = distance or 20
local height = height or 1
local checkBuildings = checkBuildings or true
local checkVehicles = checkVehicles or false
local checkPeds = checkPeds or false
local checkObjects = checkObjects or true
local checkDummies = checkDummies or true
local seeThroughStuff = seeThroughStuff or false
local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
local ignoredElement = ignoredElement or nil
if ( isLineOfSightClear ( x , y , z , x2 , y2 , z2 , checkBuildings , checkVehicles , checkPeds , checkObjects , checkDummies , seeThroughStuff , ignoreSomeObjectsForCamera , ignoredElement )) then
local sx , sy = getScreenFromWorldPosition ( x , y , z + height )
if( sx ) and ( sy ) then
local distanceBetweenPoints = getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )
if( distanceBetweenPoints < distance ) then
dxDrawText ( text , sx + 2 , sy + 2 , sx , sy , tocolor ( R or 255 , G or 255 , B or 255 , alpha or 255 ), ( size or 1 )-( distanceBetweenPoints / distance ), font or "arial" , "center" , "center" )
end
end
end
end
function mytext ()
for k , v in ipairs ( getElementsByType ( "vehicle" )) do
if ( getElementModel ( v )== 407 ) then
dt = dxDrawTextOnElement ( v , "test" , 1 , 20 , 30 , 30 , 30 , 255 , 1 , "default" )
end
end
addEventHandler ( "onClientResourceStart" , root , mytext )
Zrobi?em,przyjacielu, tak jak pisa?e?, i nie dzia?a niestety.
Wysłany: 2016-07-10, 00:33
GabWas
Wiek: 24 Na forum: 3881 dni Posty: 289
Nick w MP: GabWas
Piwa : 65
B??d?w w DB nie widz? (przynajmniej od tych funkcji), spr?buj takiej zmiennej:
dt = dxDrawTextOnElement ( v , "test" , 1 , 20 , 30 , 30 , 30 , 255 , 1 , "default" , false , false , false , false , false , false , false , false )
Wysłany: 2016-07-10, 01:03
noose
JESTĘ SKRYPTERĘ
Wiek: 35 Na forum: 3756 dni Posty: 222
Piwa : 2294
Ok, ?eby by?o wyra?niej, powi?kszy?em tekst i da?em niebieski kolor, i wiesz co? Tekst pojawia si? na u?amek sekundy, po czym znika.
[ Dodano : 2016-07-10, 00:58 ]
Jednak jest co? ?le, wyci?g z db3
http://imgur.com/fdVnNq5
kod
function dxDrawTextOnElement ( TheElement , text , height , distance , R , G , B , alpha , size , font , checkBuildings , checkVehicles , checkPeds , checkDummies , seeThroughStuff , ignoreSomeObjectsForCamera , ignoredElement )
local x , y , z = getElementPosition ( TheElement )
local x2 , y2 , z2 = getElementPosition ( localPlayer )
local distance = distance or 20
local height = height or 1
local checkBuildings = checkBuildings or true
local checkVehicles = checkVehicles or false
local checkPeds = checkPeds or false
local checkObjects = checkObjects or true
local checkDummies = checkDummies or true
local seeThroughStuff = seeThroughStuff or false
local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
local ignoredElement = ignoredElement or nil
if ( isLineOfSightClear ( x , y , z , x2 , y2 , z2 , checkBuildings , checkVehicles , checkPeds , checkObjects , checkDummies , seeThroughStuff , ignoreSomeObjectsForCamera , ignoredElement )) then
local sx , sy = getScreenFromWorldPosition ( x , y , z + height )
if( sx ) and ( sy ) then
local distanceBetweenPoints = getDistanceBetweenPoints3D ( x , y , z , x2 , y2 , z2 )
if( distanceBetweenPoints < distance ) then
dxDrawText ( text , sx + 2 , sy + 2 , sx , sy , tocolor ( R or 255 , G or 255 , B or 255 , alpha or 255 ), ( size or 1 )-( distanceBetweenPoints / distance ), font or "arial" , "center" , "center" )
end
end
end
end
function mytext ()
for k , v in ipairs ( getElementsByType ( "vehicle" )) do
if ( getElementModel ( v )== 407 ) then
dt = dxDrawTextOnElement ( v , "test" , 1 , 20 , 0 , 0 , 255 , 255 , 5 , "default" , false , false , false , false , false , false , false , false )
end
end
end
addEventHandler ( "onClientResourceStart" , root , mytext )
Wysłany: 2016-07-10, 01:06
_Wicek_
Majstersztyk
Wiek: 25 Na forum: 4261 dni Posty: 747
Nick w MP: Wicek
Piwa : 1841
Wszystkie dxDraw`y musz? by? podpi?te pod Event
Podpis
Support-Team: 25.01.2016
Moderator: 10.07.2016
GG: 51274621
Skype : kuba_wicinski
Wysłany: 2016-07-10, 01:13
noose
JESTĘ SKRYPTERĘ
Wiek: 35 Na forum: 3756 dni Posty: 222
Piwa : 2294
_Wicek_ , Tw?j tytu? pod nickiem m?wi wszystko. Dzi?kuje Ci
Do zamkni?cia
Tagi: drawtextonelement
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: