06.06.2014, 15:30
(
Последний раз редактировалось Lordzy; 06.06.2014 в 17:44.
)
This function stores random characters from a string to the one mentioned. The storing length is the size of that array by default however it can be lowered.
Example:
It can be used for various types of reactions or any sort of random stuffs.
pawn Код:
stock GetRandomizedChars(const rchar_array[], trchars[], size = sizeof(trchars),
rsize = sizeof(rchar_array))
{
new
temp_rchar;
for(new i; i< size; i++)
{
temp_rchar = rchar_array[random(rsize)];
trchars[i] = temp_rchar;
}
return 1;
}
pawn Код:
new
r_Chars[] = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789"
;
public OnRconCommand(cmd[])
{
if(!strcmp(cmd, "rcharprint", true)) {
new
tenchar[10];
GetRandomizedChars(r_Chars, tenchar, sizeof(tenchar));
printf("%s", tenchar);
return 1;
}
return 1;
}