random problem
#1

i try to do this:
PHP код:
new sl;
new 
rd[26][] = {
"A""B""C""D""E""F""G""H""I","J","K","L","M","N""O","P","Q","R","S","T","U","V","W","X","Y","Z"
}; 
PHP код:
new rand random(sizeof(rd));
sl rd[rand]; 
but this give me error
PHP код:
error 006must be assigned to an array 
on line
sl = rd[rand];
Reply
#2

somone? sory if i broke the ruls i'm new
Reply
#3

pawn Код:
forward RandomEx(min, max);
pawn Код:
new charset[26]= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
pawn Код:
array = charset[RandomEx(0,26)]
pawn Код:
public RandomEx(min, max) // by ****** (Similar to PHP Random)
{
    return random(max - min) + min;
}
Reply
#4

this is not work 1 error:
PHP код:
error 018initialization data exceeds declared size 
in line
PHP код:
new charset[26]= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Reply
#5

change new rand = random(26);
Reply
#6

man i do letters random not numbers!
Reply
#7

Try:
pawn Код:
new
    sl,
    rd[]= { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };

new
    rand = random(sizeof(rd));
sl = rd[rand];
printf("%c Pos: %d", sl, rand);
pawn Код:
new
    sl[2],
    rd[26][] =
{
    "A", "B", "C", "D", "E", "F", "G", "H", "I","J","K","L","M","N", "O","P","Q","R","S","T","U","V","W","X","Y","Z"
};

new
    rand = random(sizeof(rd));
sl = rd[rand]; // 'B' '\0' 2 cells
printf("%s Pos: %d", sl, rand);
Reply
#8

ohhh this work!!!!!!!!!!!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)