Advertisement
IceNight

Untitled

Aug 8th, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.74 KB | None | 0 0
  1. stock randtext(letters,option = OPTION_CAPSMALL,bool:withnum)
  2. {
  3.     assert(letters < 128 && option <= OPTION_CAP && option >= OPTION_CAPSMALL);
  4.     new text[128], rand, rand2;
  5.     text[0] = EOS;
  6.     for(new i=0; i < letters; i++)
  7.     {
  8.      rand = withnum? random(2) : 1;
  9.      if(rand && option == OPTION_CAPSMALL) rand2 = random(2);
  10.      if(option == OPTION_CAPSMALL) format(text,sizeof(text),"%s%s",text,!rand? randomex('9','0') : (!rand2? randomex('z','a') : randomex('Z','A')));
  11.      else if(option == OPTION_SMALL) format(text,sizeof(text),"%s%s",text,!rand? randomex('9','0') : randomex('z','a'));
  12.      else if(option == OPTION_CAP) format(text,sizeof(text),"%s%s",text,!rand? randomex('9','0') : randomex('Z','A'));
  13.     }
  14.     return text;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement