26.04.2011, 18:22
Okay well then basically that's what the two snippets of code I posted do, for example:
I hope that helps!
pawn Код:
new Float:Positions[4][4] = {
{0.0,0.0,0.0,0.0}, // X,Y,Z,A of Position 1
{0.0,0.0,0.0,0.0}, // X,Y,Z,A of Position 2
{0.0,0.0,0.0,0.0}, // X,Y,Z,A of Position 3
{0.0,0.0,0.0,0.0} // X,Y,Z,A of Position 4
};
new Seats[4] = -1; // 4 Seats, all empty
// Find empty seat function and put player in it
stock PutPlayerInEmptySeat(playerid)
{
for(new i; i < sizeof(Seats); i++)
{
if(!Seat[i]) // This seat is empty, do your thang
{
SetPlayerPos(playerid, Position[i][0], Position[i][1], Position[i][2]); // Put him in the x,y,z co-ords for that seat
SetPlayerFacingAngle(playerid, Position[i][3]); // Set his angle for that seat
TogglePlayerControllable(playerid, false);
return i; // Return the seat ID
}
}
return -1;
}
// Usage:
new seatid = PutPlayerInEmptySeat(playerid);
printf("Player was put in seat %d", seatid);