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

Wysłany: 2020-03-24, 16:46


mathiiu90







Wiek: 28
Na forum: 2320 dni
Posty: 9
Nick w MP: AriX90



Respekt: 50

Ostrzeżeń: 100%
Witam mam taki problem i? gdy wgrywam markery na serwer to wszystko dziala tylko ze w kazdym skrypcie bym musial ustawiac ten sam kolor markera jaki chce.Jak zrobi? zeby kolor strzalki kt?ra jest zrobiona graficznie si? nie zmienia?

Cytat:

local strzalka = dxCreateTexture("strzalka.png")
local marker = dxCreateTexture("marker.png")
local tick = getTickCount()

function getDistance(element)
local x1,y1,z1 = getElementPosition(element)
local x2,y2,z2 = getElementPosition(localPlayer)
local distance = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2)
if tonumber(distance) then
return tonumber(distance)
end
return false
end

function dxDrawTextElement(element, text)
if not getElementData(localPlayer, "user:logged") then return end
if isPlayerMapVisible() then return end
if not getElementData(localPlayer, "hud:enabled") then return end
local x, y, z = getElementPosition(element)
z = (z+1.3)-math.sin(getTickCount()/500)*0.33
local distance = getDistance(element)
local sx,sy = getScreenFromWorldPosition(x, y, z)
local rootx,rooty,rootz = getCameraMatrix()
if x ~= 0 and y ~= 0 and z ~= 0 and sx and sy and distance < 10 and isLineOfSightClear(rootx,rooty,rootz,x,y,z,false,false,false) then
exports["buttons"]:createCustomText(text, sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1, font3, "center", "center")
end
end

function dxDrawImageElement(element)
local x, y, z = getElementPosition(element)
local size = getMarkerSize(element)
local r,g,b = getMarkerColor(element)
local distance = 1.1
if size >= 3 then
distance = 1.2
end
z = z+distance-math.sin(getTickCount()/500)*0.33
dxDrawMaterialLine3D(x, y, z+1, x, y, z, strzalka, 1, tocolor(r, g, b))
end

addEventHandler("onClientRender", root, function()
for i,v in ipairs(getElementsByType("marker")) do
if getMarkerType(v) == "cylinder" and getElementDimension(v) == getElementDimension(localPlayer) and getElementInterior(v) == getElementInterior(localPlayer) then
if getElementAlpha(v) ~= 0 then
setElementAlpha(v, 0)
end
local x,y,z = getElementPosition(v)
if x ~= 0 and y ~= 0 and z ~= 0 then
z = z+0.05
local size = getMarkerSize(v)
local text = getElementData(v, "text") or ""
dxDrawTextElement(v, text)
dxSetRenderTarget()
dxDrawImageElement(v)
local r,g,b,a = getMarkerColor(v)
a = interpolateBetween(100, 0, 0, 150, 0, 0, (getTickCount()-tick)/2400, "SineCurve")
if not getElementData(v, "selling") then
dxDrawMaterialLine3D(x, y-1*size, z, x, y+1*size, z, marker, 2*size, tocolor(r, g, b, a), x, y, z+500000000)
end
end
end
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-24, 16:48


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

W tej linijcie
dxDrawMaterialLine3D(xyz+1xyzstrzalka1tocolor(rgb)) 


zmieniaj warto?ci w funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

tocolor

na takie, jaki kolor ma by?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-24, 16:55


mathiiu90







Wiek: 28
Na forum: 2320 dni
Posty: 9
Nick w MP: AriX90



Respekt: 50

Ostrzeżeń: 100%
"Wilq" napisał/a:

W tej linijcie
dxDrawMaterialLine3D(xyz+1xyzstrzalka1tocolor(rgb)) 


zmieniaj warto?ci w funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

tocolor

na takie, jaki kolor ma by?.


a czy jest mozliwosc zeby byly takie kolory jak sa graficznie ? czy musze ustawic to w skrypcie?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-24, 17:10


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

"mathiiu90" napisał/a:

"Wilq" napisał/a:

W tej linijcie
dxDrawMaterialLine3D(xyz+1xyzstrzalka1tocolor(rgb)) 


zmieniaj warto?ci w funkcji

Więcej informacji znajdziesz w Wikipedii MTA:

tocolor

na takie, jaki kolor ma by?.


a czy jest mozliwosc zeby byly takie kolory jak sa graficznie ? czy musze ustawic to w skrypcie?


Mam ma?e do?wiadczenie z grafikami ale na 90% sam musisz ustawia?

Podpis
Coś tam kiedyś robiłem.

DC: kamison_.
Postaw piwo autorowi tego posta
 

 
Tagi: markery
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Markery 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