Cellphone file
#1

Sup guys!

I'm wondering a way to check if the player's cellphone number (which would be randomly generated) is already taken. So, when the player register the server randomly generate a number with 5 digits to him. All this part I've said to you, I know how to do. My problem is: I've seen in other scripts that it only check the numbers of the connected players, if the player is offline, and for example, his number is 12345 and the server generates 12345 for a new player, the number, yet could be registred, and then we would have double numbers.

So, a better way would be registering all new numbers in a file, and when the server would generate a new number, check if it is already registered. But, I don't know how would be the structure of this file, I think it would be a .ini file, using Dini (please, no complains about Dini) As I though, it would be like this:
Код:
12345
67890
.......
How should I write the number in the file? How to make then "stacked" like that? Which function should I use to search the number in the file?

Can someone help me, please?
Reply
#2

Well you save number in user file so why just dont make a loop that will check every file for that number and if there is match than just generate number again if no than you got new unique number...
Reply
#3

Are you kidding me? Let's suppose that there are a thousand of users registered, it would take a lot of time to do it. I just need a function to search 5-digits-number in file.
Reply
#4

I have a better idea.
================

Use a .ini file, starting from: 10000

Every time a cellphone is bought, it loads the number inside the .ini file, adding +1 to it, creating:

10001
10002
10003
etc...

Every time a new one gets bought - the digit gets saved and repeat!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)