Not getting the other case?
#1

For some reason, I'm only getting case 0 (the first one) and never the second one.
Any ideas as to what's wrong?

pawn Код:
new route = random(2);
                    switch(route)
                    {
                        case 0:
                        {
                            GarbageRouteCount[playerid][0] = 1;
                            SetPlayerCheckpoint(playerid, GarbageRouteOne[0][0], GarbageRouteOne[0][1], GarbageRouteOne[0][2], 5.0);
                            SendClientMessage(playerid, COLOR_GREEN, "You have started your garbage route. Follow the checkpoints to recieve your pay.");
                        }
                        case 1:
                        {
                            GarbageRouteCount[playerid][1] = 1;
                            SetPlayerCheckpoint(playerid, GarbageRouteTwo[0][0], GarbageRouteTwo[0][1], GarbageRouteTwo[0][2], 5.0);
                            SendClientMessage(playerid, COLOR_GREEN, "You have started your garbage route. Follow the checkpoints to recieve your pay.");
                        }
                    }
Reply
#2

it's random so maybe it's just your luck
Reply
#3

So there's no problem with the code? I just have horrible luck?
Reply
#4

Yes. There is a 50/50 chance of getting 0 or 1 but your probability of getting 0 is probably 90%.
Reply
#5

try
pawn Код:
random(200)/100;
Reply
#6

Ehm.. you think you always get No. 1 only... cause both are the same <.<
Reply
#7

Quote:
Originally Posted by Mokerr
Посмотреть сообщение
Ehm.. you think you always get No. 1 only... cause both are the same <.<
How are they the same?
Reply
#8

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
try
pawn Код:
random(200)/100;
that's a terrible idea, that could return from 0 - 2 including 0.01, 0.02, 1.99 ect.
Reply
#9

Quote:
Originally Posted by Antonio [G-RP]
Посмотреть сообщение
How are they the same?
Same message and checkpoints ;p
Reply
#10

Quote:
Originally Posted by Mokerr
Посмотреть сообщение
Same message and checkpoints ;p
Indeed, the message is the same, but the checkpoints are not.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)