How can i make it stop searching when it finds 1 unoccupied vehicle
#2

Try this:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
     new vehicleid = INVALID_VEHICLE_ID;
     for(new i = 0; i < MAX_VEHICLES; i++)
     {
          if(!IsVehicleOccupied(i))
          {
               vehicleid = i;
               break;
          }
     }
     if(vehicleid != INVALID_VEHICLE_ID)
     {
          PutPlayerInVehicle(playerid, vehicleid, 0);
     }
     else
     {
          GameTextForPlayer(playerid, "There are no more cars left.", 2500, 3);
     }
     return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)