Cellphone 4 Digit Generator - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cellphone 4 Digit Generator (
/showthread.php?tid=505950)
Cellphone 4 Digit Generator -
sagoza - 11.04.2014
Hi, its me again! I have some doubt about how to generate a 4 digit number without repeating, is there any way you guys can help me on that... ?
I dont need something very elaborate, but hey, Any feedback is good feed back!
Best Regards Sagoza
Re: Cellphone 4 Digit Generator -
arakuta - 11.04.2014
Use MySQL, create a table just for the phones number and their respective owners.
Use the phone number as a primary key and use auto increment starting from 1000.
And create the player phone by just inserting a new how with his name or ID on the table.
You can now get the created phone number using the owner name or id (depending on how you stored it on table)
Good luck
Re: Cellphone 4 Digit Generator -
Flake. - 11.04.2014
Quote:
Originally Posted by arakuta
Use MySQL, create a table just for the phones number and their respective owners.
Use the phone number as a primary key and use auto increment starting from 1000.
And create the player phone by just inserting a new how with his name or ID on the table.
You can now get the created phone number using the owner name or id (depending on how you stored it on table)
Good luck
|
Never thought of doing it this way, it's a really good idea. I was just going to say make an array with a bunch of numbers then use random to combine x amount of them.
Re: Cellphone 4 Digit Generator -
arakuta - 11.04.2014
Quote:
Originally Posted by (*|Flake|*)
Never thought of doing it this way, it's a really good idea. I was just going to say make an array with a bunch of numbers then use random to combine x amount of them.
|
MySQL is a powerful database system
Or you can just use a global variable for the last number created, and store it in some file.
Just read it properly when the server loads, then just create number based on var + 1, of course not forgeting to add 1 on every number creation.
Re: Cellphone 4 Digit Generator -
Aerotactics - 11.04.2014
Quote:
I dont need something very elaborate
|
https://sampwiki.blast.hk/wiki/Random