Page 1 of 1

"safe" player IDs [SOLVED]

Posted: 28 September 2021, 05:46
by JonChambers
I'm storing player IDs as global variables, but sometimes I want to use the same global to say something like "no player has yet..." or "there is no longer a player such that..."

So, let's suppose I record that as "7". That's going to be all well and good until the 7th person to get an account with BGA tries to play and everything crashes.

Or does it work like that? Is there a player_id 7 out there somewhere? What player_id can I be 100% confident doesn't exist?

(Yes, I know, there are workarounds that don't assume any player numbers don't exist, but if there are any that don't yet and will never exist, that will be very useful.)

Re: "safe" player IDs

Posted: 28 September 2021, 05:50
by JonChambers
Just pulled open the database and released it was a signed int, so I'm fairly confident there are no negative player ids on the server.

I'll mark this as solved, but keep it up just in case another developer finds this trick useful.

Re: "safe" player IDs [SOLVED]

Posted: 28 September 2021, 06:09
by Tisaac
Just use 0 if you want to mark it as "null".