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

Wysłany: 2021-02-17, 19:20


WillHeQ







Wiek: 45
Na forum: 3569 dni
Posty: 16
Nick w MP: WillHeQ

Piwa: 5

Respekt: 50

Siemka, mam ma?y problem z dodaniem funkcji attachElements zeby pokazywal sie marker przy pojezdzie, czy moglby mi ktos pomoc ?

Kod:

for i,v in pairs(pojazd) do
local vehicle=createVehicle(v[1], v[2], v[3], v[4])
setVehicleColor(vehicle,255,255,255,255)
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setElementFrozen(vehicle,true)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-17, 19:22


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

nie wykorzystujesz tej funkcji nigdzie, to chyba nic dziwnego, ?e nie dzia?a ;)


Więcej informacji znajdziesz w Wikipedii MTA:

createMarker


Więcej informacji znajdziesz w Wikipedii MTA:

attachElements


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
WillHeQ
Wysłany: 2021-02-17, 19:27


WillHeQ







Wiek: 45
Na forum: 3569 dni
Posty: 16
Nick w MP: WillHeQ

Piwa: 5

Respekt: 50

Dzi?ki za bardzo szybk? odpowied?, chodzi mi g??wnie o to, ?e jak doda?em t? funkcje to pokazuje mi, ?e poda?em z?y argument i nie mog? doj?? do tego jaki mam wpisa?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-17, 20:06


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

To podrzu? kod i b??dy db3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-17, 20:22


WillHeQ







Wiek: 45
Na forum: 3569 dni
Posty: 16
Nick w MP: WillHeQ

Piwa: 5

Respekt: 50

Kod:

policeVehicles = { [598]=true }

local policesf = {
{1602.254, -1683.999, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1687.999, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1692.086, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1696.177, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1700.295, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1704.301, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local policels = {
{1595.385, -1710.298, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1591.354, -1710.298, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1587.393, -1710.298, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1583.351, -1710.253, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1578.561, -1710.253, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local ponypolice = {
{1574.445, -1710.253, 6.000, 359.695, 0, 0,413,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local fbirancher = {
{1570.317, -1710.253, 6.017, 359.695, 0, 0,490,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}


local swat = {
{1565.97, -1710.253, 5.649, 359.695, 0, 0,601,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local enforcer = {
{1562.462, -1710.253, 5.844, 359.695, 0, 0,427,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local motocykl = {
{1562.703, -1693.809, 5.459, 359.224, 0.001, 179.898,523,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1558.001, -1693.702, 5.459, 359.244, 0.001, 179.898,523,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

for i,v in pairs(policesf) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setVehicleEngineState(vehicle, false)
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(policels) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(ponypolice) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end
for i,v in pairs(fbirancher) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(swat) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(enforcer) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(motocykl) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end



b??d db3
Kod:

s_pojazdy.lua:52: Bad argument @ 'attachElements'[Expected at argument 2,got nil]



Dodam, ?e g??wnie chodzi mi o to zeby to by?o w p?tli zeby nie trzeba by?o osobnie do kazdego pojazdu dodawac attachelements

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-17, 21:14


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Jeszcze raz: w kodzie, kt?ry wklei?e? nie ma nigdzie funkcji attachElements. Dobry kod skopiowa?e??

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
WillHeQ
Wysłany: 2021-02-17, 21:28


WillHeQ







Wiek: 45
Na forum: 3569 dni
Posty: 16
Nick w MP: WillHeQ

Piwa: 5

Respekt: 50

Oj faktycznie przepraszam juz podaje:

Kod:

policeVehicles = { [598]=true }

local policesf = {
{1602.254, -1683.999, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1687.999, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1692.086, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1696.177, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1700.295, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1602.254, -1704.301, 5.716, 359.65, 0, 89.059,597,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local policels = {
{1595.385, -1710.298, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1591.354, -1710.298, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1587.393, -1710.298, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1583.351, -1710.253, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1578.561, -1710.253, 5.612, 359.695, 0, 0,596,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local ponypolice = {
{1574.445, -1710.253, 6.000, 359.695, 0, 0,413,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local fbirancher = {
{1570.317, -1710.253, 6.017, 359.695, 0, 0,490,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}


local swat = {
{1565.97, -1710.253, 5.649, 359.695, 0, 0,601,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local enforcer = {
{1562.462, -1710.253, 5.844, 359.695, 0, 0,427,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

local motocykl = {
{1562.703, -1693.809, 5.459, 359.224, 0.001, 179.898,523,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},
{1558.001, -1693.702, 5.459, 359.244, 0.001, 179.898,523,0, 10, 26 , 255, 255, 255, 0, 0, 0, 0, 0, 0},

}

for i,v in pairs(policesf) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
local arrowMarker = createMarker ( 0, -1, 0, "cylinder", .75, 255, 0, 0, 170 )
attachElements ( arrowMarker, source, 0, 0, 2 )
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setVehicleEngineState(vehicle, false)
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(policels) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(ponypolice) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end
for i,v in pairs(fbirancher) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(swat) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(enforcer) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end

for i,v in pairs(motocykl) do
local vehicle=createVehicle(v[7], v[1], v[2], v[3])
setVehicleColor(vehicle,255,255,255,255)
setElementRotation(vehicle, v[4], v[5], v[6])
setElementFrozen(vehicle, true)
setElementData(vehicle,"vehicle:policja", true)
setVehicleColor( vehicle, v[8], v[9], v[10], 255,255,255, 0, 0, 0, 255, 255, 255)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-17, 21:36


Qwertick

Coming soon...






Wiek: 23
Na forum: 3577 dni
Posty: 472
Nick w MP: Qwertick

Piwa: 2726

Respekt: 215,8
Respekt: 215,8Respekt: 215,8

Zamiast source daj vehicle
attachElements arrowMarkervehicle00)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
WillHeQ
Wysłany: 2021-02-17, 21:42


WillHeQ







Wiek: 45
Na forum: 3569 dni
Posty: 16
Nick w MP: WillHeQ

Piwa: 5

Respekt: 50

Dzi?ki wielkie wszystko dzia?a.

[ Dodano: 2021-02-17, 22:28 ]
A jeszcze pytanko czy da?o by si? zrobic zeby po wejsciu w ten marker uruchamia?o sie gui ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-18, 09:41


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8


Więcej informacji znajdziesz w Wikipedii MTA:

onMarkerHit

i musisz wykona? event do clienta, w kt?rym otworzysz GUI - wi?c musisz mie? gui stworzone za pomoc? np. CeGUI.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-18, 11:47


WillHeQ







Wiek: 45
Na forum: 3569 dni
Posty: 16
Nick w MP: WillHeQ

Piwa: 5

Respekt: 50

onMarkerHit mam doda? po p?tli czy jak ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-02-18, 11:55


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Przy ka?dym tworzeniu markera musisz doda? obs?ug? po wej?ciu - czyli zaraz pod createMarker.

Albo u?yj opcji "resourceRoot" w 2 argumencie od addEventHandler - wtedy b?dzie event dla marker?w wszystkich stworzonych w tym skrypcie.

Postaw piwo autorowi tego posta
 

 
Tagi: attachelements
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Attachelements Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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