Array of position
#6

Okay well then basically that's what the two snippets of code I posted do, for example:

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);
I hope that helps!
Reply


Messages In This Thread
Array of position - by xir - 26.04.2011, 17:53
Re: Array of position - by JaTochNietDan - 26.04.2011, 17:56
Re: Array of position - by xir - 26.04.2011, 18:06
Re: Array of position - by JaTochNietDan - 26.04.2011, 18:10
Re: Array of position - by xir - 26.04.2011, 18:14
Re: Array of position - by JaTochNietDan - 26.04.2011, 18:22
[No subject] - by xir - 26.04.2011, 18:31
Re: Array of position - by Jefff - 27.04.2011, 17:56
Re: Array of position - by JaTochNietDan - 27.04.2011, 18:26
[No subject] - by xir - 27.04.2011, 19:04

Forum Jump:


Users browsing this thread: 1 Guest(s)