Szerző Téma: AttachElement  (Megtekintve 894 alkalommal)

AttachElement
« Dátum: 2015. Május 24. - 10:26:38 »
0 Show voters
Sziasztok! Olyan gondom támadt, hogy az attacholt objectet nem akkarja detacholni. Ezt írja:
[2015-05-24 10:43:59] WARNING: work\\work_s.lua:15: Bad argument @ \'detachElements\' [Expected element at argument 1, got nil]
mi lehet a baj? A segítségeteket előre is köszönöm! :) 
SCRIPT [ Szerver oldali ]
 
function attachTest(player)
    x,y,z = getElementPosition(player)
    local asdobj = createObject(2935, x, y, z)
    local veh = getPedOccupiedVehicle(player)
    attachElements(asdobj, veh, 0, -1.5, 1.2, 0, 0, 0)
end
addCommandHandler(\"attachobject\", attachTest)
 
function detach()
        if ( isElementAttached( asdobj ) ) then -- egnézi, hogy a konténer csatolva van-e.
                detachElements ( asdobj ) -- Konténer lecsatolása
        destroyElement ( asdobj )
else
       outputChatBox(\"Nincs attacholt object \")
end
end
addCommandHandler(\"detachobject\", detach)
« Utoljára szerkesztve: 2015. Május 24. - 10:49:36 írta asdpudingasd »

AttachElement
« Válasz #1 Dátum: 2015. Május 24. - 13:56:11 »
0 Show voters
Ez működik:
 
function attachTest(player)
        x,y,z = getElementPosition(player)
         asdobj = createObject(2935, x, y, z) -- it nem szabad localnak lennie!
        local veh = getPedOccupiedVehicle(player)
        attachElements(asdobj, veh, 0, -1.5, 1.2, 0, 0, 0)
    end
    addCommandHandler(\"attachobject\", attachTest)
     
     
    function detach()
            if ( isElementAttached( asdobj ) ) then -- megnézi, hogy a konténer csatolva van-e.
                    detachElements ( asdobj ) -- Konténer lecsatolása
                    destroyElement ( asdobj )
            else
                   outputChatBox(\"Nincs attacholt object \")
            end
    end
    addCommandHandler(\"detachobject\", detach)
« Utoljára szerkesztve: 2015. Május 24. - 14:00:31 írta SAW911 »

AttachElement
« Válasz #2 Dátum: 2015. Május 24. - 18:55:08 »
0 Show voters
Köszönöm!

AttachElement
« Válasz #3 Dátum: 2015. Május 24. - 20:37:09 »
0 Show voters
[mod]Zárom, helyezem.[/mod]

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal