Jump to content

error destroyElement


OrbTanT

Recommended Posts

Posted

I created a skin shop, he is functioning normally, all functions, only I would like to know because it is experiencing these errors and as concert.

error:

WARNING: skin-shop/client.lua:64: Bad Argument @ 'destroyElement' 
WARNING: skin-shop/client.lua:65: Bad Argument @ 'destroyElement' 
WARNING: skin-shop/client.lua:69: Bad Argument @ 'destroyElement' 
WARNING: skin-shop/client.lua:70: Bad Argument @ 'destroyElement' 
WARNING: skin-shop/client.lua:74: Bad Argument @ 'destroyElement' 
WARNING: skin-shop/client.lua:75: Bad Argument @ 'destroyElement' 
  
WARNING: skin-shop/client.lua:54: Bad 'element' pointer @ 'destroyElement'(1) 
WARNING: skin-shop/client.lua:55: Bad 'element' pointer @ 'destroyElement'(1) 
WARNING: skin-shop/client.lua:59: Bad 'element' pointer @ 'destroyElement'(1) 
WARNING: skin-shop/client.lua:60: Bad 'element' pointer @ 'destroyElement'(1) 

client:

  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
  
    function skinshop() 
        GUIEditor.window[1] = guiCreateWindow(368, 105, 641, 549, "Skin", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 0.85) 
  
        cesar = guiCreateButton(20, 35, 160, 46, "292", false, GUIEditor.window[1])  
        ogloc = guiCreateButton(20, 90, 160, 46, "293", false, GUIEditor.window[1]) 
        boxhead = guiCreateButton(20, 145, 160, 46, "137", false, GUIEditor.window[1]) 
        hooded = guiCreateButton(20, 200, 160, 46, "230", false, GUIEditor.window[1])        
        inbred = guiCreateButton(20, 255, 160, 46, "162", false, GUIEditor.window[1])    
  
        sair = guiCreateButton(20, 485, 160, 46, "Sair", false, GUIEditor.window[1]) 
  
    function showimagem() 
        if isCursorShowing() and (source == cesar or source == ogloc or source == boxhead or source == hooded or source == inbred ) then 
        end 
    end 
    addEventHandler("onClientMouseEnter", getRootElement(), showimagem) 
    function showCesar() 
        a = guiCreateStaticImage(660, 150, 200, 450, "skin/1.png", false) 
        valora = guiCreateLabel(750, 600, 100, 100, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", cesar, showCesar, false) 
    function showogloc() 
        b = guiCreateStaticImage(660, 150, 200, 450, "skin/2.png", false) 
        valorb = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", ogloc, showogloc, false) 
    function showboxhead() 
        c = guiCreateStaticImage(660, 150, 200, 450, "skin/3.png", false) 
        valorc = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", boxhead, showboxhead, false) 
    function showhooded() 
        d = guiCreateStaticImage(660, 150, 200, 450, "skin/4.png", false) 
        valord = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", hooded, showhooded, false) 
    function showinbred() 
        e = guiCreateStaticImage(660, 150, 200, 450, "skin/5.png", false) 
        valorc = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", inbred, showinbred, false) 
  
     
     
    function showcesar1() 
        destroyElement(a) 
        destroyElement(valora) 
    end 
    addEventHandler("onClientMouseLeave", cesar, showcesar1) 
    function showogloc1() 
        destroyElement(b) 
        destroyElement(valorb) 
    end 
    addEventHandler("onClientMouseLeave", ogloc, showogloc1) 
    function showboxhead1() 
        destroyElement(c) 
        destroyElement(valorc) 
    end 
    addEventHandler("onClientMouseLeave", boxhead, showboxhead1) 
    function showhooded1() 
        destroyElement(d) 
        destroyElement(valord) 
    end 
    addEventHandler("onClientMouseLeave", hooded, showhooded1) 
    function showinbred1() 
        destroyElement(e) 
        destroyElement(valore) 
    end 
    addEventHandler("onClientMouseLeave", inbred, showinbred1) 
end 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  cesar ) then 
  
triggerServerEvent("cesar",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  ogloc ) then 
  
triggerServerEvent("ogloc",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  boxhead ) then 
  
triggerServerEvent("boxhead",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  hooded ) then 
  
triggerServerEvent("hooded",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  inbred ) then 
  
triggerServerEvent("inbred",getLocalPlayer()) 
  
end 
 end 
  
) 
  
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
    if ( source == sair ) then 
  
        guiSetVisible(GUIEditor.window[1], false) 
        showCursor(false) 
        armsPlayer = nil 
    end 
end 
) 
  
addEventHandler( 'onClientResourceStart', resourceRoot, 
    function( ) 
        createskin( 217.44, -98.51, 1004.28, 15, 0 ) 
    end 
) 
  
function createskin( 
skinY, skinX, skinZ, 
skinInter, skinDim 
) 
    local skinMarker = createMarker( skinY, skinX, skinZ, 'cylinder', 1.3, 255, 0, 0, 180 ) 
    setElementInterior( skinMarker, (skinInter or 0),  skinY, skinX, skinZ ) 
    setElementDimension( skinMarker, skinDim ) 
    addEventHandler( 'onClientMarkerHit', skinMarker, 
        function( hitPlayer, matchingDimension ) 
            if( hitPlayer == localPlayer )and( matchingDimension )then 
                if ( not isElement ( GUIEditor.window[1] ) ) then 
                    skinshop ( ) 
                end 
                guiSetVisible (GUIEditor.window[1], true) 
                showCursor (true) 
            end 
        end  
    ) 
end 

Posted

Well, there is a simple fix, which is checking if the element exists using isElement.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Do I have to use isElement when I call the event "onClientMouseEnter" where are the elements or "onClientMouseLeave" which is where destroy the elements

Posted

Use it when you use destroyElement.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Did not solve the problem is still showing the errors.

  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
  
    function skinshop() 
        GUIEditor.window[1] = guiCreateWindow(368, 105, 641, 549, "Skin", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 0.85) 
  
        cesar = guiCreateButton(20, 35, 160, 46, "292", false, GUIEditor.window[1])  
        ogloc = guiCreateButton(20, 90, 160, 46, "293", false, GUIEditor.window[1]) 
        boxhead = guiCreateButton(20, 145, 160, 46, "137", false, GUIEditor.window[1]) 
        hooded = guiCreateButton(20, 200, 160, 46, "230", false, GUIEditor.window[1])        
        inbred = guiCreateButton(20, 255, 160, 46, "162", false, GUIEditor.window[1])    
  
        sair = guiCreateButton(20, 485, 160, 46, "Sair", false, GUIEditor.window[1]) 
  
    function showimagem() 
        if isCursorShowing() and (source == cesar or source == ogloc or source == boxhead or source == hooded or source == inbred ) then 
        end 
    end 
    addEventHandler("onClientMouseEnter", getRootElement(), showimagem) 
    function showCesar() 
        a = guiCreateStaticImage(660, 150, 200, 450, "skin/1.png", false) 
        valora = guiCreateLabel(750, 600, 100, 100, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", cesar, showCesar, false) 
    function showogloc() 
        b = guiCreateStaticImage(660, 150, 200, 450, "skin/2.png", false) 
        valorb = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", ogloc, showogloc, false) 
    function showboxhead() 
        c = guiCreateStaticImage(660, 150, 200, 450, "skin/3.png", false) 
        valorc = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", boxhead, showboxhead, false) 
    function showhooded() 
        d = guiCreateStaticImage(660, 150, 200, 450, "skin/4.png", false) 
        valord = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", hooded, showhooded, false) 
    function showinbred() 
        e = guiCreateStaticImage(660, 150, 200, 450, "skin/5.png", false) 
        valorc = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", inbred, showinbred, false) 
  
     
     
    function showcesar1() 
    if isElement( a ) and isElement( valora ) then 
        destroyElement(a) 
        destroyElement(valora) 
    end 
    end 
    addEventHandler("onClientMouseLeave", cesar, showcesar1) 
    function showogloc1() 
        destroyElement(b) 
        destroyElement(valorb) 
    end 
    addEventHandler("onClientMouseLeave", ogloc, showogloc1) 
    function showboxhead1() 
        destroyElement(c) 
        destroyElement(valorc) 
    end 
    addEventHandler("onClientMouseLeave", boxhead, showboxhead1) 
    function showhooded1() 
        destroyElement(d) 
        destroyElement(valord) 
    end 
    addEventHandler("onClientMouseLeave", hooded, showhooded1) 
    function showinbred1() 
        destroyElement(e) 
        destroyElement(valore) 
    end 
    addEventHandler("onClientMouseLeave", inbred, showinbred1) 
end 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  cesar ) then 
  
triggerServerEvent("cesar",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  ogloc ) then 
  
triggerServerEvent("ogloc",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  boxhead ) then 
  
triggerServerEvent("boxhead",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  hooded ) then 
  
triggerServerEvent("hooded",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  inbred ) then 
  
triggerServerEvent("inbred",getLocalPlayer()) 
  
end 
 end 
  
) 
  
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
    if ( source == sair ) then 
  
        guiSetVisible(GUIEditor.window[1], false) 
        showCursor(false) 
        armsPlayer = nil 
    end 
end 
) 
  
addEventHandler( 'onClientResourceStart', resourceRoot, 
    function( ) 
        createskin( 217.44, -98.51, 1004.28, 15, 0 ) 
    end 
) 
  
function createskin( 
skinY, skinX, skinZ, 
skinInter, skinDim 
) 
    local skinMarker = createMarker( skinY, skinX, skinZ, 'cylinder', 1.3, 255, 0, 0, 180 ) 
    setElementInterior( skinMarker, (skinInter or 0),  skinY, skinX, skinZ ) 
    setElementDimension( skinMarker, skinDim ) 
    addEventHandler( 'onClientMarkerHit', skinMarker, 
        function( hitPlayer, matchingDimension ) 
            if( hitPlayer == localPlayer )and( matchingDimension )then 
                if ( not isElement ( GUIEditor.window[1] ) ) then 
                    skinshop ( ) 
                end 
                guiSetVisible (GUIEditor.window[1], true) 
                showCursor (true) 
            end 
        end  
    ) 
end 

Posted

How can I set this script to not move panel GUI using cursor?

  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
  
    function skinshop() 
        GUIEditor.window[1] = guiCreateWindow(368, 105, 641, 549, "Skin", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 0.85) 
  
        cesar = guiCreateButton(20, 35, 160, 46, "292", false, GUIEditor.window[1])  
        ogloc = guiCreateButton(20, 90, 160, 46, "293", false, GUIEditor.window[1]) 
        boxhead = guiCreateButton(20, 145, 160, 46, "137", false, GUIEditor.window[1]) 
        hooded = guiCreateButton(20, 200, 160, 46, "230", false, GUIEditor.window[1])        
        inbred = guiCreateButton(20, 255, 160, 46, "162", false, GUIEditor.window[1])    
  
        sair = guiCreateButton(20, 485, 160, 46, "Sair", false, GUIEditor.window[1]) 
  
    function showimagem() 
        if isCursorShowing() and (source == cesar or source == ogloc or source == boxhead or source == hooded or source == inbred ) then 
        end 
    end 
    addEventHandler("onClientMouseEnter", getRootElement(), showimagem) 
    function showCesar() 
        a = guiCreateStaticImage(660, 150, 200, 450, "skin/1.png", false) 
        valora = guiCreateLabel(750, 600, 100, 100, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", cesar, showCesar, false) 
    function showogloc() 
        b = guiCreateStaticImage(660, 150, 200, 450, "skin/2.png", false) 
        valorb = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", ogloc, showogloc, false) 
    function showboxhead() 
        c = guiCreateStaticImage(660, 150, 200, 450, "skin/3.png", false) 
        valorc = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", boxhead, showboxhead, false) 
    function showhooded() 
        d = guiCreateStaticImage(660, 150, 200, 450, "skin/4.png", false) 
        valord = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", hooded, showhooded, false) 
    function showinbred() 
        e = guiCreateStaticImage(660, 150, 200, 450, "skin/5.png", false) 
        valorc = guiCreateLabel(750, 600, 63, 17, "$100.000", false) 
    end 
    addEventHandler("onClientMouseEnter", inbred, showinbred, false) 
  
     
     
    function showcesar1() 
        if isElement( a ) and isElement( valora ) then 
            destroyElement( a ) 
            destroyElement( valora ) 
        end 
    end 
    addEventHandler("onClientMouseLeave", cesar, showcesar1) 
    function showogloc1() 
        if isElement( b ) and isElement( valorb ) then 
            destroyElement(b) 
            destroyElement(valorb) 
        end 
    end 
    addEventHandler("onClientMouseLeave", ogloc, showogloc1) 
    function showboxhead1() 
        if isElement( c ) and isElement( valorc ) then 
            destroyElement(c) 
            destroyElement(valorc) 
        end 
    end 
    addEventHandler("onClientMouseLeave", boxhead, showboxhead1) 
    function showhooded1() 
        if isElement( d ) and isElement( valord ) then 
            destroyElement(d) 
            destroyElement(valord) 
        end 
    end 
    addEventHandler("onClientMouseLeave", hooded, showhooded1) 
    function showinbred1() 
        if isElement( e ) and isElement( valore ) then 
            destroyElement(e) 
            destroyElement(valore) 
        end 
    end 
    addEventHandler("onClientMouseLeave", inbred, showinbred1) 
end 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  cesar ) then 
  
triggerServerEvent("cesar",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  ogloc ) then 
  
triggerServerEvent("ogloc",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  boxhead ) then 
  
triggerServerEvent("boxhead",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  hooded ) then 
  
triggerServerEvent("hooded",getLocalPlayer()) 
  
end 
 end 
  
) 
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
if ( source ==  inbred ) then 
  
triggerServerEvent("inbred",getLocalPlayer()) 
  
end 
 end 
  
) 
  
  
addEventHandler ("onClientGUIClick", getRootElement(), 
  
function(button, state, absoluteX, absoluteY) 
  
    if ( source == sair ) then 
  
        guiSetVisible(GUIEditor.window[1], false) 
        showCursor(false) 
        armsPlayer = nil 
    end 
end 
) 
  
addEventHandler( 'onClientResourceStart', resourceRoot, 
    function( ) 
        createskin( 217.44, -98.51, 1004.28, 15, 0 ) 
    end 
) 
  
function createskin( 
skinY, skinX, skinZ, 
skinInter, skinDim 
) 
    local skinMarker = createMarker( skinY, skinX, skinZ, 'cylinder', 1.3, 255, 0, 0, 180 ) 
    setElementInterior( skinMarker, (skinInter or 0),  skinY, skinX, skinZ ) 
    setElementDimension( skinMarker, skinDim ) 
    addEventHandler( 'onClientMarkerHit', skinMarker, 
        function( hitPlayer, matchingDimension ) 
            if( hitPlayer == localPlayer )and( matchingDimension )then 
                if ( not isElement ( GUIEditor.window[1] ) ) then 
                    skinshop ( ) 
                end 
                guiSetVisible (GUIEditor.window[1], true) 
                showCursor (true) 
            end 
        end  
    ) 
end 

Posted

guiWindowSetMovable ( GUIEditor.window[1], false ) 

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted
thanks =)

You'r welcome ,

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted
Is now working, without errors, thank you for help.

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...