Mixed random numbers with letters [REPP ++] -
ThatFag - 19.08.2016
hey guys
i was searching for mixed letters and numbers but i couldnt find a tutorial or anything
if someone would show me would be very usefuly thanks in advanced
Re: Mixed random numbers with letters [REPP ++] -
Gammix - 19.08.2016
pawn Код:
randomstr(string[], maxlength = sizeof (string))
{
string[0] = EOS;
for (new i; i < maxlength; i++)
format(string, maxlength, "%s%c", string, (random(((126 - 33) + 1)) + 33));
return 1;
}
Testing:
pawn Код:
main()
{
new test[15];
randomstr(test);
print(test); // Result: "aO;@}_)02BDoGn"
}
Re: Mixed random numbers with letters [REPP ++] - iLearner - 19.08.2016
More details about what you want...
Re: Mixed random numbers with letters [REPP ++] -
ThatFag - 19.08.2016
Thanks that what i need
also how to get if player has writte the random numbers
for example
ShowPlayerDialog(playerid, 300,DIALOG_STYLE_INPUT,"Testing","Write [Random nr]" etc etc
then at response how to know if the player has used those numbers ?
Re: Mixed random numbers with letters [REPP ++] -
Gammix - 19.08.2016
Use
strcmp.
pawn Код:
if (!strcmp(inputtext, "the random string"))
{
// match
}
Re: Mixed random numbers with letters [REPP ++] -
ThatFag - 19.08.2016
Thank you.
Repped +
Re: Mixed random numbers with letters [REPP ++] -
ThatFag - 19.08.2016
Humm how can i remove the !Ј} etc ??
Re: Mixed random numbers with letters [REPP ++] -
SickAttack - 19.08.2016
Quote:
Originally Posted by Gammix
format(string, maxlength, "%s%c", string, (random(((126 - 33) + 1)) + 33));
|
That's considerably slow, format + strcat is a better option.
Re: Mixed random numbers with letters [REPP ++] -
ThatFag - 19.08.2016
can you gimme something else @SickAttack
just simple numbers and letters
example A2T31SA
not needed for Ј!Ј%
Re: Mixed random numbers with letters [REPP ++] -
SickAttack - 19.08.2016
Create an array with the characters you want to appear in the string and do the same thing Gammix did (using random values from the array), but using strcat instead of format.