SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/12/2012, 12:41 PM   #1
Zex Tan
Huge Clucker
 
Join Date: Mar 2012
Location: South Australia
Posts: 305
Reputation: 48
Default Random Numbers

Anyone know how to script random numbers, like Tag 2323242 Tag 482783 and maybe of something out of the registered accounts, something like that. (Hope you understand)
Zex Tan is offline   Reply With Quote
Old 21/12/2012, 01:05 PM   #2
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Random Numbers

Random numbers? http://wiki.sa-mp.com/wiki/Random
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline   Reply With Quote
Old 21/12/2012, 01:12 PM   #3
Zex Tan
Huge Clucker
 
Join Date: Mar 2012
Location: South Australia
Posts: 305
Reputation: 48
Default Re: Random Numbers

Quote:
Originally Posted by LarzI View Post
No, I mean that the registration number out of all the registered accounts

Example: You registered first then your registration number is #00001 then the second player registered then their registration account will be #00002
Zex Tan is offline   Reply With Quote
Old 21/12/2012, 01:19 PM   #4
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Random Numbers

You would have to store the number of players registered in a file, read it when registering a player, and set his number to the number of players register + 1.

I bet you know how to save that to a file, so here's how you would save it
In this example, "pRegs" is the function
you would use to store the information from the file
pawn Code:
//put this globally
new regNum[ MAX_PLAYERS ][ 7 ]; //7 cells for #XXXXX

//registration
format( regNum[ playerid ], 7, "#%05i", ( pRegs + 1 ));

The string regNum would now contain - if there were 5 players registered - "#00006"

Remember to save the new number of registered players after a player registeres.
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline   Reply With Quote
Old 21/12/2012, 01:32 PM   #5
Zex Tan
Huge Clucker
 
Join Date: Mar 2012
Location: South Australia
Posts: 305
Reputation: 48
Default Re: Random Numbers

Thank you
Zex Tan is offline   Reply With Quote
Old 21/12/2012, 01:37 PM   #6
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Random Numbers

- ignore -
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline   Reply With Quote
Old 19/01/2013, 12:54 AM   #7
Zex Tan
Huge Clucker
 
Join Date: Mar 2012
Location: South Australia
Posts: 305
Reputation: 48
Default Re: Random Numbers

Quote:
Originally Posted by LarzI View Post
You would have to store the number of players registered in a file, read it when registering a player, and set his number to the number of players register + 1.

I bet you know how to save that to a file, so here's how you would save it
In this example, "pRegs" is the function
you would use to store the information from the file
pawn Code:
//put this globally
new regNum[ MAX_PLAYERS ][ 7 ]; //7 cells for #XXXXX

//registration
format( regNum[ playerid ], 7, "#%05i", ( pRegs + 1 ));

The string regNum would now contain - if there were 5 players registered - "#00006"

Remember to save the new number of registered players after a player registeres.
Wait, I still don't get it of how to code it ? Show me an example at OnPlayerConnect
Zex Tan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Numbers TuTh Scripting Help 1 04/11/2012 08:31 AM
Random numbers Jimbo01 Help Archive 2 01/02/2011 07:45 PM
[HELP] Random Numbers psoftware Help Archive 7 31/12/2010 06:14 PM
[Help] Random numbers Rainbow_Six Help Archive 4 21/10/2010 06:08 PM
Need help with random numbers... *BueNoOo* Help Archive 11 18/06/2009 04:13 PM


All times are GMT. The time now is 02:22 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.