Random Numbers
#1

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)
Reply
#2

Random numbers? https://sampwiki.blast.hk/wiki/Random
Reply
#3

Quote:
Originally Posted by LarzI
Посмотреть сообщение
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
Reply
#4

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 Код:
//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.
Reply
#5

Thank you
Reply
#6

- ignore -
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
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 Код:
//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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)