Random aircraft tail numbers? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random aircraft tail numbers? (
/showthread.php?tid=186719)
Random aircraft tail numbers? -
samsicles - 30.10.2010
Hey there,
I'm seaking a script that'll assign a random 5 character tail number (AA111 - ZZ999) to each aircraft in my gamemode. I've already created a means to detect when a player enters an aircraft (through OnPlayerStateChange), as I've made a flight instruments textdraw that shows in this case - all I need is the random string.
Bear in mind that I'll need to ensure each tail number is given to the vehicleid, not playerid, and that each is unique (ie no two aircraft could share the same one). It should generate the string, I assume, when a player enters the aircraft, as I'd like it to work for any aircraft I create mid-game.
Any help to get the ball rolling would be greatly appreciated.
Re: Random aircraft tail numbers? -
iJumbo - 30.10.2010
i dont get u
Re: Random aircraft tail numbers? -
MadeMan - 30.10.2010
pawn Код:
new TailNumber[8];
TailNumber[0] = 65 + random(25);
TailNumber[1] = 65 + random(25);
TailNumber[2] = 48 + random(10);
TailNumber[3] = 48 + random(10);
TailNumber[4] = 48 + random(10);
Re: Random aircraft tail numbers? -
samsicles - 30.10.2010
Quote:
Originally Posted by [ISS]jumbo
i dont get u
|
I'd like a 5 character string (2 random letters + 3 random numbers) to be created for every aircraft. No 2 aircraft can have the same 5 character string, and each aircraft's string will remain the same, no matter who's flying it (at least until a server restart). Essentially a license plate system.
Cheers
Re: Random aircraft tail numbers? -
randomkid88 - 30.10.2010
As far as I know, there isn't a way to generate random letters. Unless you made an array with the alphabet and then used "random" to get 2 random letters from that. Otherwise, MadeMan's solution is the best.
Re: Random aircraft tail numbers? -
samsicles - 30.10.2010
MadeMan's solution does infact generate the letter/number combination I was after. Working well now, thanks alot MadeMan!