Wysłany: 2015-05-15, 10:31
TruskawkaPL
Początkujący LUA
Wiek: 26 Na forum: 4266 dni Posty: 30
Nick w MP: BOLEQ
Dzie? dobry.
Chcia?bym si? zapyta? - w jaki spos?b mog? zespawni? peda i doda? opis nad jego g?ow?, np. Urz?dnik .
Oraz w jaki spos?b mog? doda? opis do pojazdu, np. do roweru Rower puliczny ?
Z g?ry dzi?kuj?.
Wysłany: 2015-05-15, 12:45
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Wgraj ten kod po stronie c-side :
addEventHandler ( "onClientRender" , root ,function()
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 , "font" , "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 , false , false , true , false , true , true ) ) 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 ( )
dxDrawText ( tostring ( text ), sx + 3 , sy + 30 + 3 , sx , sy , tocolor ( 0 , 0 , 0 , 70 ), 1.1 * width / 2.5 , "default" , "center" , "center" )
dxDrawText ( tostring ( text ), sx , sy + 30 , sx , sy , tocolor ( 255 , 255 , 255 , 70 ), 1.1 * width / 2.5 , "default" , "center" , "center" , _ , _ , _ , true )
end
end
end
end
end
end )
Nast?puj?cemu elelementowi : ped, pojazd; nadaj setElementData(element,"message","Tekst")
Wysłany: 2015-05-15, 12:49
TruskawkaPL
Początkujący LUA
Wiek: 26 Na forum: 4266 dni Posty: 30
Nick w MP: BOLEQ
Shuffle , m?g?by? da? przyk?ad z ped'em?
Bo nie za bardzo rozumiem.. a dopiero si? ucz?.
Wysłany: 2015-05-15, 13:08
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
local ped = createPed ( bla bla )
setElementData ( ped , "message" , "Jest to ped testowy" )
Wysłany: 2015-05-15, 13:14
TruskawkaPL
Początkujący LUA
Wiek: 26 Na forum: 4266 dni Posty: 30
Nick w MP: BOLEQ
"Shuffle" napisał/a : local ped = createPed ( bla bla )
setElementData ( ped , "message" , "Jest to ped testowy" )
I ju? po tym kodzie nie musz? dawa? jakich? 'end' czy co??
Po prostu w osobnym pliku to da??
Wysłany: 2015-05-15, 13:28
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
To by? przyk?ad, a nie ca?y kod. Pozagl?daj do poradnik?w, ja jestem tylko od pomocy a nie od nauki LUA.
Wysłany: 2015-05-15, 13:35
TruskawkaPL
Początkujący LUA
Wiek: 26 Na forum: 4266 dni Posty: 30
Nick w MP: BOLEQ
Tagi: napis :: nad :: głową :: peda :: opisy
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: