objekt = {}
function niejadek ()
if isElementWithinMarker(getLocalPlayer(), praca3) then
if getElementData (getLocalPlayer(), "praca3") == true then
if isPedInVehicle (getLocalPlayer()) then
local v=getPedOccupiedVehicle(getLocalPlayer())
local m=getElementModel(v)
if (m==578) then
outputChatBox ( "Zaladowales Towar", getLocalPlayer(), 0, 0, 205 )
setElementData(getLocalPlayer(), "dostawa", true )
local x, y, z = getElementPosition ( v )
local theObject = createObject ( 3374, x + 2, y + 2, z + 2.5, 0, 0, 0, true )
local theObject1 = createObject ( 3374, x + 2, y + 2, z + 2.5, 0, 0, 0, true )
attachElementToElement( theObject, v, 0, -3, 1.3 )
attachElementToElement( theObject1, v, 0, 0.2, 1.3 )
table.insert ( objekt, theObject )
table.insert ( objekt, theObject1 )
else
outputChatBox ( " ", getLocalPlayer(), 0, 0, 205 )
end
end
end
end
end
addCommandHandler("zaladuj", niejadek)
addEventHandler("onClientMarkerHit", dostawa,
function(player)
if ( player == localPlayer ) then
if getElementData (getLocalPlayer(), "dostawa") == true then
if isPedInVehicle (getLocalPlayer()) then
local v=getPedOccupiedVehicle(getLocalPlayer())
local m=getElementModel(v)
if (m==578) then
for k,v in ipairs ( objekt ) do
destroyElement ( v )
end
outputChatBox ( "Skonczyles prace", getLocalPlayer(), 0, 0, 205 )
end
end
end
end
end
)