IgorPL222
LUA
Wiek: 26 Na forum: 3112 dni Posty: 133
Nick w MP: mxgvr
Piwa : 746
Witam, mam na serwerze prosty skrypt na nosze i wszystko super dzia?a. Lecz problem zaczyna si? gdy doda si? drugi marker, wtedy nie da si? ich w og?le wzi???.
Kod server:
function dodajnoszedokaretki ( plr )
if getElementData ( plr , "player:admin" ) then
x , y , z = getElementPosition ( plr )
x2 , y2 , z2 = getElementRotation ( plr )
veh = getPedOccupiedVehicle ( plr )
if not veh then return end
mrk = createMarker ( 0 , 0 , 0 , "cylinder" , 2 , 255 , 0 , 0 , 50 )
attachElements ( mrk , veh , 0 , - 4 , - 1 )
objectnosze = createObject ( 1997 , 0 , 0 , 0 , 0 , 0 , 0 )
setElementCollisionsEnabled ( objectnosze , false )
attachElements ( objectnosze , veh , 0 , - 1 , - 0.5 )
outputChatBox ( "Dodano nosze do karetki!" , plr )
end
end
addCommandHandler ( "dodaj-nosze-do-karetki" , dodajnoszedokaretki )
function weznosze ( plr )
if isElementWithinMarker ( plr , mrk ) then
if not getElementData ( plr , "player:nosze" ) and getElementData ( plr , "player:duty" ) == "SAMD" then
setElementData ( plr , "player:nosze" , true )
outputChatBox ( "Wzi??e? nosze." , plr )
outputChatBox ( "Aby je postawi?/wzi??? kliknij 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 )
detachElements ( objectnosze , veh )
attachElements ( objectnosze , plr , 0 , 1.5 , - 1 )
toggleControl ( plr , "jump" , false )
toggleControl ( plr , "sprint" , false )
toggleControl ( plr , "enter_exit" , false )
setElementCollisionsEnabled ( objectnosze , false )
elseif getElementData ( plr , "player:nosze" ) and getElementData ( plr , "player:duty" ) == "SAMD" then
setElementData ( plr , "player:nosze" , false )
detachElements ( objectnosze , plr )
attachElements ( objectnosze , veh , 0 , - 1 , - 0.5 )
setElementData ( plr , "player:puscilnosze" , false )
toggleControl ( plr , "jump" , true )
toggleControl ( plr , "sprint" , true )
toggleControl ( plr , "enter_exit" , true )
end
end
end
addCommandHandler ( "wez-nosze" , weznosze )