PHP код:
GetVehicleFreeSeat(carro)
{
new MaxSeats[212] = {
4, 2, 2, 2, 4, 4, 1, 2, 2, 4, 2, 2, 2, 4, 2, 2, 4, 2, 4, 2, 4, 4, 2, 2, 2, 1, 4, 4, 4, 2, 1, 9, 1, 2, 2, 1, 2, 9, 4, 2,
4, 1, 2, 2, 2, 4, 1, 2, 1, 6, 1, 2, 1, 1, 1, 2, 2, 2, 4, 4, 2, 2, 2, 2, 2, 2, 4, 4, 2, 2, 4, 2, 1, 1, 2, 2, 1, 2, 2, 4,
2, 1, 4, 3, 1, 1, 1, 4, 2, 2, 4, 2, 4, 1, 2, 2, 2, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 1, 1, 2, 1, 1, 2, 2, 4, 2, 2, 1,
1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 1, 1, 1, 2, 2, 2, 2, 0, 0, 1, 4, 2, 2, 2, 2, 2, 4, 4, 2, 2, 4, 4, 2, 1, 2, 2, 2, 2, 2, 2,
4, 4, 2, 2, 1, 2, 4, 4, 1, 0, 0, 1, 1, 2, 1, 2, 2, 2, 2, 4, 4, 2, 4, 1, 1, 4, 2, 2, 2, 2, 6, 1, 2, 2, 2, 1, 4, 4, 4, 2,
2, 2, 2, 2, 4, 2, 1, 1, 1, 4, 1, 1
};
new bool:Seat[9];
foreach(Player, i)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, carro))
{
Loop:s(0, MaxSeats[carro - 400])
{
if(GetPlayerVehicleSeat(i) == s) Seat[s] = true;
}
}
}
}
Loop:s(0, MaxSeats[carro - 400])
{
if(Seat[s] == false) return s;
}
return -1;
}
Funзгo se auto explica..