Random Number and Text
#1

Hello folks!
I want to do it like when he example do:
pawn Код:
CMD:random(playerid, params[])
{

return 1;
}
Then a random generated number and text within 16 chars(8 numbers & 8 textchars if possbile) will be shown up in a ClientMessage for player only.

I mean like it will maybe show a code like this: 12E1011Q1P9WSURM

or something similar to that.

Thanks
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=276913

Look at Ryder's post
Reply
#3

You mean this:
Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
pawn Код:
stock randomString(strDest[], strLen = 10)
{
    while(strLen--)
        strDest[strLen] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0');
}
Example:
pawn Код:
new
    string[10]
;
randomString(string, 10);
I tried to read the code, but clearly don't understand it. If anyone is willing to just explain what it does ill be very happy to listen!
Reply
#4

Well, I'm not such a maths fanatic either but, I suppose the parameters aren't so hard, randomString(string,length);
string is the variable in which u want to store the characters in, new string[17];
then length is the amount of characters u want, so 16.

Код:
new string[17];
randomString(string,16);
I suppose this should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)