How need make stock selection random
#1

Cam someone make it random, because now every time elected the same person
Код:
stock Half()
{
	new Humans;
	foreach(new i : Player)
	{
	    if(Humans < 2)
	    {
	        HumanSetup(i);
	        printf("Selected humans");
	        Humans ++;
	    }
	    else
	    {
	        ZombieSetup2(i);
	        printf("Selected zombies");
	        Humans = 0;
	    }
	}
	printf("Finished Selecting teams");
	return 1;
}
Reply
#2

Could do it by using Random

Код:
stock Half() {
	new Humans;
	foreach(new i : Player) {

	    if(Humans < 2 && random(100) < 50 )
	    {
	        HumanSetup(i);
	        printf("Selected humans");
	        Humans ++;
	       }
               else 
               {
	        ZombieSetup2(i);
	        printf("Selected zombies");
	        Humans = 0;
	    }
	}
	printf("Finished Selecting teams");
	return 1;
}
Reply
#3

Thanks i will test it later
Reply
#4

Quote:
Originally Posted by henkas
Посмотреть сообщение
Thanks i will test it later
I Tested it myself, it works.

Don't use this, i Just did this for testing.
Код:
stock Half() {
    new Humans;
    foreach(new i : Player) {

        if(Humans < 2 && random(100) < 50 )
        {
            printf("Selected humans");
            Humans ++;
               }
               else 
               {
            printf("Selected zombies");
            Humans = 0;
        }
    }
    printf("Finished Selecting teams");
    return 1;
}

CMD:test(playerid) {
    Half();
    return true;
}

Printed:
[13:42:29] Selected zombies
[13:42:29] Finished Selecting teams
[13:42:29] Selected humans
[13:42:29] Finished Selecting teams
[13:42:30] Selected zombies
[13:42:30] Finished Selecting teams
[13:42:30] Selected humans
[13:42:30] Finished Selecting teams
[13:42:31] Selected humans
[13:42:31] Finished Selecting teams
[13:42:31] Selected zombies
[13:42:31] Finished Selecting teams
[13:42:32] Selected humans
[13:42:32] Finished Selecting teams
[13:42:49] Selected humans
[13:42:49] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:51] Selected humans
[13:42:51] Finished Selecting teams
[13:42:52] Selected humans
[13:42:52] Finished Selecting teams
Reply
#5

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Could do it by using Random

Код:
stock Half() {
	new Humans;
	foreach(new i : Player) {

	    if(Humans < 2 && random(100) < 50 )
	    {
	        HumanSetup(i);
	        printf("Selected humans");
	        Humans ++;
	       }
               else 
               {
	        ZombieSetup2(i);
	        printf("Selected zombies");
	        Humans = 0;
	    }
	}
	printf("Finished Selecting teams");
	return 1;
}
Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
I Tested it myself, it works.

Don't use this, i Just did this for testing.
Код:
stock Half() {
    new Humans;
    foreach(new i : Player) {

        if(Humans < 2 && random(100) < 50 )
        {
            printf("Selected humans");
            Humans ++;
               }
               else 
               {
            printf("Selected zombies");
            Humans = 0;
        }
    }
    printf("Finished Selecting teams");
    return 1;
}

CMD:test(playerid) {
    Half();
    return true;
}

Printed:
[13:42:29] Selected zombies
[13:42:29] Finished Selecting teams
[13:42:29] Selected humans
[13:42:29] Finished Selecting teams
[13:42:30] Selected zombies
[13:42:30] Finished Selecting teams
[13:42:30] Selected humans
[13:42:30] Finished Selecting teams
[13:42:31] Selected humans
[13:42:31] Finished Selecting teams
[13:42:31] Selected zombies
[13:42:31] Finished Selecting teams
[13:42:32] Selected humans
[13:42:32] Finished Selecting teams
[13:42:49] Selected humans
[13:42:49] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:50] Selected humans
[13:42:50] Finished Selecting teams
[13:42:51] Selected humans
[13:42:51] Finished Selecting teams
[13:42:52] Selected humans
[13:42:52] Finished Selecting teams
Lol so does it work or not? Because you say its work and then dont use it :d
Reply
#6

Yes it works, Just use the first code i gave you. The Second code use just my testing Code
Reply
#7

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Yes it works, Just use the first code i gave you. The Second code use just my testing Code
Ok thanks i will report you how this script work later.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)