08.11.2010, 15:17
Working, tested:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
new vehicleid = INVALID_VEHICLE_ID;
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(!IsVehicleOccupied(i) && IsVehicleConnected(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;
}
stock IsVehicleConnected(vehicleid)
{
new Float:x1,Float:y1,Float:z1;
GetVehiclePos(vehicleid,x1,y1,z1);
if(x1==0.0 && y1==0.0 && z1==0.0)
{
return 0;
}
return 1;
}