Detecting race start slots
#2

At the top of your script:
Код:
//Otherwise, you will get warnings that "RaceSlot1, RaceSlot2, etc..." aren't defined!
new RaceSlot1[MAX_PLAYERS];
new RaceSlot2[MAX_PLAYERS];
new RaceSlot3[MAX_PLAYERS];
new RaceSlot4[MAX_PLAYERS];
new RaceSlot5[MAX_PLAYERS];
new RaceSlot6[MAX_PLAYERS];
Код:
forward RacingSlotsFilled(playerid);
public RacingSlotsFilled(playerid)
{
   if(RaceSlot1[playerid] == 1 && RaceSlot2[playerid] == 1 && RaceSlot3[playerid] == 1 && RaceSlot4[playerid] == 1 && RaceSlot5[playerid] == 1 && RaceSlot6[playerid] == 1)
   {//If all the slots are filled, it will tell them all the slots are filled, and they won't be able to join!
      return 0;
   }
}
Under "OnGameModeInit"
Код:
//When you start the server up, the racing slots will be empty, until you start the event!
RaceSlot1[playerid] = 0;
RaceSlot2[playerid] = 0;
RaceSlot3[playerid] = 0;
RaceSlot4[playerid] = 0;
RaceSlot5[playerid] = 0;
RaceSlot6[playerid] = 0;
Under your race event... you could do this:
Код:
if(RacingSlotsFilled)
{ //Asking if all the racing slots are filled.
   SendClientMessage(playerid, 0xFF0000, "All Slots in the race event are filled! Please try another time!");
   return 1;
}
else if(RaceSlot1[playerid] == 0)
{
   //Your details, probably a SetPlayerPos, and maybe a PutPlayerInVehicle command.
   SendClientMessage(playerid, 0x00FF00, "Welcome to the race! You've been placed in Slot 1!");
   RaceSlot1 = 1;
}
else if(RaceSlot2[playerid] == 0)
{
   //Your details, probably a SetPlayerPos, and maybe a PutPlayerInVehicle command.
   SendClientMessage(playerid, 0x00FF00, "Welcome to the race! You've been placed in Slot 2!");
   RaceSlot2 = 1;
}
else if(RaceSlot3[playerid] == 0)
{
   //Your details, probably a SetPlayerPos, and maybe a PutPlayerInVehicle command.
   SendClientMessage(playerid, 0x00FF00, "Welcome to the race! You've been placed in Slot 3!");
   RaceSlot3 = 1;
}
else if(RaceSlot4[playerid] == 0)
{
   //Your details, probably a SetPlayerPos, and maybe a PutPlayerInVehicle command.
   SendClientMessage(playerid, 0x00FF00, "Welcome to the race! You've been placed in Slot 4!");
   RaceSlot4 = 1;
}
else if(RaceSlot5[playerid] == 0)
{
   //Your details, probably a SetPlayerPos, and maybe a PutPlayerInVehicle command.
   SendClientMessage(playerid, 0x00FF00, "Welcome to the race! You've been placed in Slot 5!");
   RaceSlot5 = 1;
}
else if(RaceSlot6[playerid] == 0)
{
   //Your details, probably a SetPlayerPos, and maybe a PutPlayerInVehicle command.
   SendClientMessage(playerid, 0x00FF00, "Welcome to the race! You've been placed in Slot 6!");
   RaceSlot6 = 1;
}
Not sure if this is what you were looking for, and it may need some editting, but that's the basis of what I'd do personally for a racing system! Hope you can make sense of it!
Reply


Messages In This Thread
Detecting race start slots - by jibileu - 08.02.2013, 01:00
Re: Detecting race start slots - by Vexus - 08.02.2013, 08:17
Re: Detecting race start slots - by RajatPawar - 08.02.2013, 08:25

Forum Jump:


Users browsing this thread: 1 Guest(s)