Drakath Posted June 11, 2014 Share Posted June 11, 2014 I'm using a default resource called "playerblips". It worked fine but today, logs are spamming this: WARNING: playerblips\playerblips.lua:66: Bad argument @ 'getElementType' [Expected element at argument 1] function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end What causes this? Link to comment
..:D&G:.. Posted June 11, 2014 Share Posted June 11, 2014 function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end function destroyBlipsAttachedTo( ) local attached = getAttachedElements ( source ) if getElementType ( attached ) == "player" then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end You did not specify to who does the script has to attach the blip, dunno if it works, I haven't tested it... If the error is still going, specify the elemnt, maybe something like: element = getElementType ( ) == "blip" Link to comment
Den. Posted June 11, 2014 Share Posted June 11, 2014 Just add if isElement(element): for k,element in ipairs(attached) do if isElement(element) and getElementType ( element ) == "blip" then destroyElement ( element ) end end That ensures that the element in the loop is a valid element, not an already destroyed one. D&G: You're trying to get the element type of a table or possibly a boolean value. 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