Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2022-02-09, 13:53


D4RK_

Programista LUA/Mapper






Wiek: 19
Na forum: 1578 dni
Posty: 17
Nick w MP: Awakenxxx

Piwa: 151

Respekt: 40

Witam, chcia?bym prosi? o pomoc mianowicie jestem do?? zielony, je?eli chodzi o lua. Chcia?bym, aby nad markerem, kt?ry stworzy?em pojawi? si? napis, a nie wiem jak sprawi?, aby tak si? sta?o. M?g?by kto? pom?c prosz??

To kod ca?ego skryptu (XD):

Kod:

local sapdDutyMarker = createMarker(1539.84387, -1684.00598, 9837.55469, "cylinder", 1.1, 0, 105, 255, 100)


I co mam za magie natworzy? ?eby doda? do tego tekst. Prosz? pomocy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-02-09, 15:39


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 3988 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

Respekt: 60


addEventHandler("onClientRender",getRootElement(),function ()

local x,y,getElementPosition(element) - x,y,z to masz pozycje tego markeru


local xs,ys,ds getScreenFromWorldPosition(x,y,z+2)


dxDrawText("tutaj piszesz co ma si? wy?wietla?",xs,ys+15,xs,ys,tocolor(255,255,255),1.2,"default","center")


end)



Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-02-09, 16:01


D4RK_

Programista LUA/Mapper






Wiek: 19
Na forum: 1578 dni
Posty: 17
Nick w MP: Awakenxxx

Piwa: 151

Respekt: 40

"Norbert1234" napisał/a:


addEventHandler("onClientRender",getRootElement(),function ()

local x,y,getElementPosition(element) - x,y,z to masz pozycje tego markeru


local xs,ys,ds getScreenFromWorldPosition(x,y,z+2)


dxDrawText("tutaj piszesz co ma si? wy?wietla?",xs,ys+15,xs,ys,tocolor(255,255,255),1.2,"default","center")


end)



Wszystko by?oby w porz?dku, ale to nie dzia?a

Da?em taki kod:

Kod:

addEventHandler("onClientRender",getRootElement(),function ()

local x,y,z = getElementPosition(sapdDutyMarker)

local xs,ys,ds = getScreenFromWorldPosition(x,y,z+2)

dxDrawText("Frakcja Policji",xs,ys+15,xs,ys,tocolor(255,255,255),1.2,"default","center")
end)


Zamiast x,y,z dawa?em te? kordy to nie dzia?a?o w sumie logiczne, ale nie dzia?a dalej nawet jak jest tak. Element te? zostawia?em wcze?niej tam zamiast sapdDutyMarker tak jak by?o i te? nie dzia?a?o.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-02-09, 18:28


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-02-09, 19:00


D4RK_

Programista LUA/Mapper






Wiek: 19
Na forum: 1578 dni
Posty: 17
Nick w MP: Awakenxxx

Piwa: 151

Respekt: 40

"kamison" napisał/a:

https://wiki.multitheftauto.com/wiki/DxDrawTextOnElement


Problem polega na tym, ?e ju? na to spogl?da?em i nawet kopiowa?em bezpo?rednio kod ze strony i tak czy siak mi nie dzia?a. Nie wiem o co chodzi.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-02-09, 19:33


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

"D4RK_" napisał/a:

"kamison" napisał/a:

https://wiki.multitheftauto.com/wiki/DxDrawTextOnElement


Problem polega na tym, ?e ju? na to spogl?da?em i nawet kopiowa?em bezpo?rednio kod ze strony i tak czy siak mi nie dzia?a. Nie wiem o co chodzi.

Kod:


function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...)
local x, y, z = getElementPosition(TheElement)
local x2, y2, z2 = getCameraMatrix()
local distance = distance or 20
local height = height or 1

if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) 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

local x, y, z = getElementPosition(localPlayer)
local randomPed = createPed(285, x + math.random(5), y + math.random(3), z)

addEventHandler("onClientRender", getRootElement(),
function()
dxDrawTextOnElement(randomPed, "SWATTEAM Officer", 1, 20, 0, 0, 255, 255, 1, "pricedown")
end)



[ Dodano: 2022-02-09, 19:34 ]
Na pewno robisz to po c-side i dobrze uzupe?niasz argumenty?

Podpis
Coś tam kiedyś robiłem.

DC: kamison_.
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
D4RK_
Wysłany: 2022-02-09, 21:51


D4RK_

Programista LUA/Mapper






Wiek: 19
Na forum: 1578 dni
Posty: 17
Nick w MP: Awakenxxx

Piwa: 151

Respekt: 40

"kamison" napisał/a:

"D4RK_" napisał/a:

"kamison" napisał/a:

https://wiki.multitheftauto.com/wiki/DxDrawTextOnElement


Problem polega na tym, ?e ju? na to spogl?da?em i nawet kopiowa?em bezpo?rednio kod ze strony i tak czy siak mi nie dzia?a. Nie wiem o co chodzi.

Kod:


function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...)
local x, y, z = getElementPosition(TheElement)
local x2, y2, z2 = getCameraMatrix()
local distance = distance or 20
local height = height or 1

if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) 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

local x, y, z = getElementPosition(localPlayer)
local randomPed = createPed(285, x + math.random(5), y + math.random(3), z)

addEventHandler("onClientRender", getRootElement(),
function()
dxDrawTextOnElement(randomPed, "SWATTEAM Officer", 1, 20, 0, 0, 255, 255, 1, "pricedown")
end)

Obrazek

[ Dodano: 2022-02-09, 19:34 ]
Na pewno robisz to po c-side i dobrze uzupe?niasz argumenty?


Dobra posiedzia?em nad tym troch? i zadzia?a?o, dzi?ki ziomu?. Piwko postawione :)

[ Dodano: 2022-02-09, 22:07 ]
[quote="kamison"][quote="D4RK_"]
"kamison" napisał/a:

https://wiki.multitheftauto.com/wiki/DxDrawTextOnElement


Problem polega na tym, ?e ju? na to spogl?da?em i nawet kopiowa?em bezpo?rednio kod ze strony i tak czy siak mi nie dzia?a. Nie wiem o co chodzi.[/quote]
Kod:


function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...)
local x, y, z = getElementPosition(TheElement)
local x2, y2, z2 = getCameraMatrix()
local distance = distance or 20
local height = height or 1

if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) 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

local x, y, z = getElementPosition(localPlayer)
local randomPed = createPed(285, x + math.random(5), y + math.random(3), z)

addEventHandler("onClientRender", getRootElement(),
function()
dxDrawTextOnElement(randomPed, "SWATTEAM Officer", 1, 20, 0, 0, 255, 255, 1, "pricedown")
end)

Obrazek

[ Dodano: 2022-02-09, 19:34 ]
Na pewno robisz to po c-side i dobrze uzupe?niasz argumenty?[/quote]

Naprawd? Ci dzi?kuje. Dzia?a jak nale?y.


Postaw piwo autorowi tego posta
 

 
Tagi: jak :: zrobić :: tekst :: nad :: markerem?
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Jak zrobić tekst nad markerem? Odpowiedz do tematu

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
Dodaj temat do Ulubionych
Wersja do druku