random textdraws
#1

Hello, how can i do random textdraws?
pawn Код:
LogIn = TextDrawCreate( 0.000000, -5.226698, "loadsc1:loadsc1" );
    TextDrawTextSize( LogIn, 657.600036, 459.200103 );
    TextDrawAlignment( LogIn, 1 );
    TextDrawColor( LogIn, -1 );
    TextDrawFont( LogIn, 4 );
i have this code, and i whant to make loadsc1:loadsc1 random like loadsc1:loadsc1; loadsc2:loadsc2 and etc.
Reply
#2

pawn Код:
new mrand = random(4);//I don't know how many are here so lets take 5, note that 0 is also counted.
switch(mrand)
{
    case 0:
    {
        LogIn = TextDrawCreate( 0.000000, -5.226698, "loadsc1:loadsc1" );
        TextDrawTextSize( LogIn, 657.600036, 459.200103 );
        TextDrawAlignment( LogIn, 1 );
        TextDrawColor( LogIn, -1 );
        TextDrawFont( LogIn, 4 );
        return 1;
    }
    case 1:
    {
        //create 2nd textdraw
    }
    // and go on
}
Reply
#3

More reasonable would be like this.
pawn Код:
new str[64];
format(str,sizeof(str), "loadsc%d:loadsc%d" ,random(10)+1 ,random(10)+1); //Not sure if there was 10 load screens
LogIn = TextDrawCreate( 0.000000, -5.226698,str);
TextDrawTextSize( LogIn, 657.600036, 459.200103 );
TextDrawAlignment( LogIn, 1 );
TextDrawColor( LogIn, -1 );
TextDrawFont( LogIn, 4 );
and +1 is because there is no loadsc0
Reply
#4

Quote:
Originally Posted by ikey07
Посмотреть сообщение
More reasonable would be like this.
pawn Код:
new str[64];
format(str,sizeof(str), "loadsc%d:loadsc%d" ,random(10)+1 ,random(10)+1); //Not sure if there was 10 load screens
LogIn = TextDrawCreate( 0.000000, -5.226698,str);
TextDrawTextSize( LogIn, 657.600036, 459.200103 );
TextDrawAlignment( LogIn, 1 );
TextDrawColor( LogIn, -1 );
TextDrawFont( LogIn, 4 );
and +1 is because there is no loadsc0
not working
Reply
#5

Quote:
Originally Posted by ancezas
Посмотреть сообщение
not working
try 4 to 5 times because he said he was not sure if there are 10 of it if there aren't then change it to the number that there are
Reply
#6

there is 14
Reply
#7

hmm strange should work that way did
pawn Код:
LogIn = TextDrawCreate( 0.000000, -5.226698, "loadsc1:loadsc1" );
    TextDrawTextSize( LogIn, 657.600036, 459.200103 );
    TextDrawAlignment( LogIn, 1 );
    TextDrawColor( LogIn, -1 );
    TextDrawFont( LogIn, 4 );
this worked ?
now i remember
pawn Код:
new str[64];
format(str,sizeof(str), "loadsc%d:loadsc1" ,random(10)+1); //Not sure if there was 10 load screens
LogIn = TextDrawCreate( 0.000000, -5.226698,str);
TextDrawTextSize( LogIn, 657.600036, 459.200103 );
TextDrawAlignment( LogIn, 1 );
TextDrawColor( LogIn, -1 );
TextDrawFont( LogIn, 4 );
i think the first is file name and second the the textdraw and i think there are 1 in each file not sure
and i think u should add
pawn Код:
new str[64];
format(str,sizeof(str), "loadsc%d:loadsc1" ,random(10)+1); //Not sure if there was 10 load screens
TextDrawSetString(LogIn,str);
onplayerconnect for random for each player
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)