Wysłany: 2018-03-30, 15:47
IgorPL222
LUA
Wiek: 26 Na forum: 3112 dni Posty: 133
Nick w MP: mxgvr
Piwa : 746
Witam. Mam tutaj kod, na tworzenie i branie noszy, tworz? si? normalnie, lecz nie da si? ich wzia??.
Tzn. bierze si? je, ale nie znikaj? z karetki.
Prosz? o pomoc.
Z g?ry dzi?kuj?
Kod server:
local ambulance = 416
local noszemarkers = {}
local objectnosze = {}
local nosze = {}
local mrk = {}
function dnosze ( plr )
if getElementData ( plr , "user:duty" ) == 3 then
x , y , z = getElementPosition ( plr )
x2 , y2 , z2 = getElementRotation ( plr )
local veh = getPedOccupiedVehicle ( plr )
if not veh then return end
mrk [ veh ] = createMarker ( 0 , 0 , 0 , "cylinder" , 2 , 255 , 0 , 0 , 50 )
attachElements ( mrk [ veh ], veh , 0 , - 4 , - 1 )
objectnosze [ veh ] = createObject ( 1997 , 0 , 0 , 0 , 0 , 0 , 0 )
setElementCollisionsEnabled ( objectnosze [ veh ], false )
attachElements ( objectnosze [ veh ], veh , 0 , - 1 , - 0.5 )
outputChatBox ( "Dodano nosze do karetki!" , plr , 255 , 255 , 255 )
end
end
addCommandHandler ( "dnosze" , dnosze )
function weznosze ( plr )
local xd , yd , zd = getElementPosition ( plr )
col = createColSphere ( xd , yd , zd , 2 )
local veh = getElementsWithinColShape ( col , "marker" )
elements = getElementAttachedTo ( veh )
if not getElementData ( plr , "player:nosze" ) and getElementData ( plr , "user:faction" ) == "SAMC" then
setElementData ( plr , "player:nosze" , true )
setElementData ( plr , "nosze:plr" , 1 )
outputChatBox ( "Wzi??e? nosze." , plr )
outputChatBox ( "Aby je postawi?/wzi??? wpisz /pusc-nosze." , plr )
outputChatBox ( "Aby kogo? na nie po?o?y? wpisz /na-nosze <ID/NICK>." , plr )
outputChatBox ( "Aby kogo? z nich zdj?? wpisz /z-noszy <ID/NICK>." , plr )
destroyElement ( objectnosze [ elements ])
nosze [ plr ] = createObject ( 1997 , 0 , 0 , 0 , 0 , 0 , 0 )
attachElements ( nosze [ plr ], plr , 0 , 1.5 , - 1 )
toggleControl ( plr , "jump" , false )
toggleControl ( plr , "sprint" , false )
toggleControl ( plr , "enter_exit" , false )
setElementCollisionsEnabled ( nosze [ plr ], false )
elseif getElementData ( plr , "player:nosze" ) and getElementData ( plr , "user:faction" ) == "SAMC" then
setElementData ( plr , "player:nosze" , false )
setElementData ( plr , "nosze:plr" , 0 )
destroyElement ( nosze [ plr ])
objectnosze [ elements ] = createObject ( 1997 , 0 , 0 , 0 , 0 , 0 , 0 )
attachElements ( objectnosze [ elements ], elements , 0 , - 1 , - 0.5 )
setElementData ( plr , "player:puscilnosze" , false )
toggleControl ( plr , "jump" , true )
toggleControl ( plr , "sprint" , true )
toggleControl ( plr , "enter_exit" , true )
end
end
addCommandHandler ( "wez-nosze" , weznosze )
DB3:
Kod:
[frakcje]\nosze-samd\s.lua:36: Bad argument @ 'getElementAttachedTo' [Expected element at argument 1, got table]
[frakcje]\nosze-samd\s.lua:36: Bad argument @ 'destroyElement' [Expected element at argument 1, got nil]
[ Dodano : 2018-03-30, 16:31 ]
Dobrze, poradzi?em sobie, lecz teraz jest nowy problem.
Ot??, gdy u?ywam:
if not isElementWithinMarker ( plr , resourceRoot ) then return end
To wyskakuje w DB3:
Kod:
Bad argument @ 'isElementWithinMarker' [Expected marker at argument 2, got resource]
Wysłany: 2018-03-30, 19:09
TeeNekk
Cienzaruwka :v
Wiek: 23 Na forum: 3210 dni Posty: 264
Nick w MP: TeeNekk.
Piwa : 919
pr?bowa?e? tak?:
if not isElementWithinMarker ( plr , mrk ) then return end
Podpis
Pomogłem Ci
[you]
? Może zostawiłbyś za to piwko, lub respekt? Dzięki!
Mój projekt:
?
Więcej szczegółów
Wystawiono 1 piw(a):IgorPL222
Wysłany: 2018-03-30, 20:08
IgorPL222
LUA
Wiek: 26 Na forum: 3112 dni Posty: 133
Nick w MP: mxgvr
Piwa : 746
TeeNekk , niestety to te? nie dzia?a.
[ Dodano : 2018-03-30, 20:09 ]
Dobrze, poradzi?em ju? sobie. Dzi?kuj? za ch?? pomocy, daj? wzamian piwko.
Do zamkni?cia
Tagi: nosze :: dla :: pogotowia
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: