Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: destroyelement(1)
1. Bad 'element' pointer @ 'destroyElement'(1)
Witajcie, mam problem z usuwaniem button?w:

B??d
Bad 'element' pointer @ 'destroyElement'(1)

Kod:
local prawkoPed = createPed(17, -2035.14, -118.14, 1035.171875)
setElementInterior(prawkoPed, 3)
setElementRotation(prawkoPed, 0, 0, 270)
buttons = {}

addEventHandler("onClientClick", getRootElement(),
function(
button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement)
    if (
clickedElement==prawkoPed) then
        local x
, y = getScreenFromWorldPosition(-2035.14, -118.14, 1035.171875)
        
buttons[1] = guiCreateButton(x, y, 100, 20, "Rozmowa", false)
        
addEventHandler("onClientGUIClick", buttons[1], startRozmowa)
    else
        for 
k, buttons in ipairs(buttons) do
            
destroyElement(buttons)
        
end
    end
end
)

function 
startRozmowa()
    for 
k, buttonss in ipairs(buttons) do
        
destroyElement(buttonss)
    
end
end