Justn Posted January 19, 2012 Author Share Posted January 19, 2012 Ok I'm not sure if im saying this right but how do I search an entire UDT to see if a value is already in use?example:Player1: "player(index).status = 124" Player2: "player(index).status = 8"what I need to know is how do I search the entire '.status' to see if a number is already being used by another player? Link to comment Share on other sites More sharing options...
Ruins of Hell Posted January 20, 2012 Share Posted January 20, 2012 Loop through the array from i to MAX_PLAYERS and seeing if the number is in use would be the easiest way. It might not be the fastest though. Link to comment Share on other sites More sharing options...
Robin Posted January 20, 2012 Share Posted January 20, 2012 Cache it. Link to comment Share on other sites More sharing options...
Justn Posted January 20, 2012 Author Share Posted January 20, 2012 Ok so I will do what soul said then cache it after its done? Link to comment Share on other sites More sharing options...
Robin Posted January 20, 2012 Share Posted January 20, 2012 Yes. Cache it in the function which sets a player's status. That way you're not doing intensive loops every… well, loop. If you can cache something then cache it. Cache everything. Caching is your friend. Link to comment Share on other sites More sharing options...
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