xXMADEXx Posted December 23, 2013 Share Posted December 23, 2013 Hello everbody. So, i've got this problem. When I use isElement, it returns true but when I use destroyElement it does absolutly nothing. local playerTag = { } addEventHandler ( "onPlayerMute", root, function ( ) if ( isElement ( playerTag[source] ) ) then destroyElement ( playerTag[source] ) end playerTag[source] = exports['NGJobs']:create3DText ( "[MUTED]", { 0, 0, 0 }, { 255, 0, 0 }, source, { 5 } ) end ) addEventHandler ( 'onPlayerUnmute', root, function ( ) if ( isElement ( playerTag[source] ) ) then destroyElement ( playerTag[source] ) end end ) addEventHandler ( "onPlayerQuit", root, function ( ) if ( isElement ( playerTag[source] ) ) then destroyElement ( playerTag[source] ) end end ) addEventHandler ( "onResourceStop", resourceRoot, function ( ) for i, v in pairs ( playerTag ) do if ( isElement ( v ) ) then destroyElement ( v ) end end end ) addEventHandler ( "onResourceStart", resourceRoot, function ( ) for i, v in ipairs ( getElementsByType ( 'player' ) ) do if ( isPlayerMuted ( v ) ) then playerTag[v] = exports['NGJobs']:create3DText ( "[MUTED]", { 0, 0, 0 }, { 255, 0, 0 }, source, { 5 } ) end end end ) It is only doing it for the "onPlayerUnmuted" event, the rest work fine, this has be absolutely confused... (Note: "exports['NGJobs']:create3DText " returns an element) Link to comment
myonlake Posted December 23, 2013 Share Posted December 23, 2013 Make sure you define the table element as nil after the actual element is deleted, then you'll avoid getting in situations like these. Link to comment
xXMADEXx Posted December 24, 2013 Author Share Posted December 24, 2013 Make sure you define the table element as nil after the actual element is deleted, then you'll avoid getting in situations like these. K, i changed it to this, but it still does the same thing: addEventHandler ( 'onPlayerUnmute', root, function ( ) if ( isElement ( playerTag[source] ) ) then destroyElement ( playerTag[source] ) playerTag[source] = nil end end ) Link to comment
Cadu12 Posted December 24, 2013 Share Posted December 24, 2013 create3DText returns which is not element. Link to comment
xXMADEXx Posted December 24, 2013 Author Share Posted December 24, 2013 create3DText returns which is not element. It is returning an element.. function create3DText ( str, pos, color, parent, settings ) if str and pos and color then local text = createElement ( '3DText' ) local settings = settings or { } setElementData ( text, "text", str ) setElementData ( text, "position", pos ) setElementData ( text, "color", color ) if ( not parent ) then parent = nil else if ( isElement ( parent ) ) then parent = parent else parent = nil end end setElementData ( text, "Settings", settings ) setElementData ( text, "parentElement", parent ) return text end return false end For some reason, it's only not deleting in the onPlayerUnmute event, but the rest work fine.. Link to comment
Moderators IIYAMA Posted December 25, 2013 Moderators Share Posted December 25, 2013 What kind of element does it returns? (some elements can't be destroyed, like serverside colshapes destroying at clientside) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now