08.02.2013, 08:17
At the top of your script:
Under "OnGameModeInit"
Under your race event... you could do this:
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!
Код:
//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; } }
Код:
//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;
Код:
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; }