Wysłany: 2016-01-15, 19:09
Toffiaaak.
Wiek: 23 Na forum: 4410 dni Posty: 128
Nick w MP: Toffy.
Piwa : 1836
Siemano, posiadam skrypt na lakiernika w ls jednak?e mam ma?y problem, wszystko dzia?a lecz denerwuje mnie jeden warning.
Kod: (GER)-MechanikDoherty/lakiernia.lua:30: Bad argument @ 'getElementData' [Expected element at argument 1, got boolean]
Tak wygl?da kod:
local strefyLakiernicze = {
LakierniaDoherty = {
cuboid = { 1909.25574 ,- 1861.56250 , 13.60732 - 1 , 12.00 , 8.00 , 7.00 },-- cuboid w ktorym musi znalezc sie pojazd
marker = { 1922.22437 ,- 1853.95325 , 13.56194 - 0.9 }, -- pozycja markera w ktorym gracz bedzie stal aby w ?? czy ? lakierni ?
dostep_frakcja = 1 , -- id frakcji ktora ma do tego dostep
},
}
for i , v in pairs ( strefyLakiernicze ) do
setGarageOpen ( 21 , true )
l_cuboid = createColCuboid ( unpack ( v . cuboid ))
l_wybor = createMarker ( v . marker [ 1 ], v . marker [ 2 ], v . marker [ 3 ], "cylinder" , 1 , 0 , 0 , 0 , 100 )
setElementData ( l_wybor , "dostep_frakcja" , v . dostep_frakcja )
setElementData ( l_wybor , "lakiernia_cs" , l_cuboid )
end
addEventHandler ( "onMarkerHit" , root , function( el , md )
if getElementData ( source , "lakiernia_cs" ) then
local accName = getAccountName ( getPlayerAccount ( el ))
if isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Mechanik" )) then
if getElementType ( el ) == "player" then
local pojazd = getElementsWithinColShape ( l_cuboid , "vehicle" )
if #pojazd<1 then
outputChatBox ( "Na stanowisku lakierniczym nie ma ?adnego pojazdu!" , el )
return
end
if #pojazd>1 then
outputChatBox ( "Na stanowisku lakierniczym jest zbyt du?o pojazd?w!" , el )
return
end
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
if getVehicleOccupant ( v ) then
triggerClientEvent ( el , "onWyborLakieru" , root )
else
outputChatBox ( "Nikogo nie ma w poje?dzie wi?c lakierowanie jest niedost?pne!" , el )
end
end
end
end
else
outputChatBox ( "Nie jeste? zatrudniony jako Mechanik Doherty San Fierro, mo?esz z?o?y? podanie na forum!" , el , 255 , 0 , 0 )
end
end
end )
addEvent ( "onLakierujPojazd" , true )
addEventHandler ( "onLakierujPojazd" , root , function( kolor )
if kolor == 0 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
playSoundFrontEnd ( v , 46 )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 0 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 1 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 255 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 2 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 0 , 95 , 255 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 3 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 0 , 0 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 4 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 255 , 255 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 5 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 128 , 128 , 128 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 6 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 89 , 0 , 255 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 7 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 96 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 8 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 28 , 143 , 5 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 9 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 0 , 186 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 10 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 0 , 255 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
end )
Wysłany: 2016-01-16, 06:47
limitowanyy
Wiek: 43 Na forum: 4556 dni Posty: 41
Piwa : 281
Zmien nazwe badz usun ( i )
Wysłany: 2016-01-16, 07:19
Gerano
Mleko,Kakao,LUA
Wiek: 38 Na forum: 4266 dni Posty: 187
Nick w MP: Gerano
Piwa : 1460
Nazwa nic do b??du nie ma. A tak na szybkie oko masz co? nie tak z getelementdat? ale nie pomog? za bardzo bo nie mam jak
Podpis
BUDOWA SERWERA: XXX
Prace: XXX%
Wysłany: 2016-01-16, 10:48
THEGizmo
Modeler/Uczeń Lua
Wiek: 27 Na forum: 4141 dni Posty: 255
Nick w MP: THEGizmo
Piwa : 3072
Zobacz tera strona (server)
local strefyLakiernicze = {
LakierniaDoherty = {
cuboid = { 1909.25574 ,- 1861.56250 , 13.60732 - 1 , 12.00 , 8.00 , 7.00 },-- cuboid w ktorym musi znalezc sie pojazd
marker = { 1922.22437 ,- 1853.95325 , 13.56194 - 0.9 }, -- pozycja markera w ktorym gracz bedzie stal aby w ?? czy ? lakierni ?
dostep_frakcja = 1 , -- id frakcji ktora ma do tego dostep
},
}
for i , v in pairs ( strefyLakiernicze ) do
setGarageOpen ( 21 , true )
l_cuboid = createColCuboid ( unpack ( v . cuboid ))
l_wybor = createMarker ( v . marker [ 1 ], v . marker [ 2 ], v . marker [ 3 ], "cylinder" , 1 , 0 , 0 , 0 , 100 )
setElementData ( l_wybor , "dostep_frakcja" , v . dostep_frakcja )
setElementData ( l_wybor , "lakiernia_cs" , l_cuboid )
end
addEventHandler ( "onMarkerHit" , root , function( el , md )
if getElementData ( source , "lakiernia_cs" ) then
local accName = getAccountName ( getPlayerAccount ( el ))
if isObjectInACLGroup ( "user." .. accName , aclGetGroup ( "Mechanik" )) then
if getElementType ( el ) == "player" then
local pojazd = getElementsWithinColShape ( l_cuboid , "vehicle" )
if #pojazd<1 then
outputChatBox ( "Na stanowisku lakierniczym nie ma ?adnego pojazdu!" , el )
return
end
if #pojazd>1 then
outputChatBox ( "Na stanowisku lakierniczym jest zbyt du?o pojazd?w!" , el )
return
end
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
if getVehicleOccupant ( v ) then
triggerClientEvent ( el , "onWyborLakieru" , root )
else
outputChatBox ( "Nikogo nie ma w poje?dzie wi?c lakierowanie jest niedost?pne!" , el )
end
end
end
end
else
outputChatBox ( "Nie jeste? zatrudniony jako Mechanik Doherty San Fierro, mo?esz z?o?y? podanie na forum!" , el , 255 , 0 , 0 )
end
end
end )
addEvent ( "onLakierujPojazd" , true )
addEventHandler ( "onLakierujPojazd" , root , function( kolor )
if kolor == 0 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
playSoundFrontEnd ( v , 46 )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 0 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 1 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 255 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 2 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 0 , 39 , 194 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 3 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 0 , 0 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 4 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 255 , 255 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 5 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 128 , 128 , 128 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 6 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 150 , 75 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 7 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 225 , 165 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 8 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 65 , 105 , 225 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 9 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 255 , 204 , 221 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
if kolor == 10 then
for _ , v in ipairs ( getElementsByType ( "vehicle" )) do
if isElementWithinColShape ( v , l_cuboid ) then
setGarageOpen ( 21 , false )
setTimer ( setVehicleColor , 3000 , 1 , v , 0 , 255 , 0 )
setTimer ( setGarageOpen , 4000 , 1 , 21 , true )
end
end
end
end )
Podpis
Modeler Corporation Sp. Z.O.O
Wysłany: 2016-01-16, 10:49
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
if getElementType ( el ) == "player" then
daj to na poczatek
i wtedy
if getElementData ( el , "lakiernia_cs" ) then
Tagi: lakiernik
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: