Jump to content

Question regarding getElementByID


Hale

Recommended Posts

Posted

I've been using setElementID for many different element types, such as vehicles, objects, players, items, cameras and so on. Now when I use getElementByID on an element with low ID, how to get the exact element I want? I've tried using the second optional argument 'index' but that is sort of useless when I have 10+ different elements with the same ID. Any ideas for how to get the exact element I want, that will have the fastest performance?

Posted (edited)

If they all have the same index, there's no way you will find the exact one you are looking for. That's the whole purpose of giving the objects a unique identifier.

Edited by pa3ck
Posted

Never mind, I found the best (I think so at least) way to get the exact element type that has that exact ID.

By combining these two functions:

getElementsByType()
getElementID()

 

  • 2 weeks later...

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...