Race random places
#1

Hello, I want to do a betting system with random places but I need some help at choising them random. How can I make the places to be random and not to repeat ? (6 places)
Reply
#2

Top of your script
pawn Код:
new Float:RandomSpawns[][] =
{
     {    x   ,     y     ,   z    ,  angle  },
     {    x   ,     y     ,   z    ,  angle  },
     {    x   ,     y     ,   z    ,  angle  },
     {    x   ,     y     ,   z    ,  angle  },
     {    x   ,     y     ,   z    ,  angle  },
     {    x   ,     y     ,   z    ,  angle  }
};
then in the code where the player spawns
pawn Код:
new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
Reply
#3

Nah, I'm not talking about this ...
Like horse races: place 1 is horse number 3, place 2 is horse number 1, place 3 is horse number 2, etc...
Reply
#4

Then i guess you can use cases..but it will be like EVERYTIME horse 1 will be place 3 or something.
Reply
#5

Yeah, that would be the problem..
Reply
#6

otherwise create variables..random it everytime..once a place is selected set its value to 1
when you are doing the next random check if any variable's value is 1 and do not use that :P
Reply
#7

Tried that and it didn't worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)