Vehicle Seats!
#3

Here's a short example that I just created:
pawn Код:
new veh = GetPlayerVehicleID(playerid), cnt = 0, Seat[10][2], i;
        for(i = 0; i < MAX_PLAYERS; i++) //Start a loop through all players. (Foreach is the recommended approach)
        {
            if(!IsPlayerConnected(i)) continue; //This skips ids that aren't connected. Remove if using Foreach
            if(!IsPlayerInVehicle(i, veh)) continue; //This skips ids that are not inside your vehicle.
            new vseat = GetPlayerVehicleSeat(i); //Get the player's vehicle seat ID
            Seat[cnt][0] = i; //Save the playerid to the first element.
            Seat[cnt][1] = (-1 < vseat < sizeof(Seat)) ? (vseat) : (cnt + 1); //Save the player's seat to the second element
            ++cnt; //Add '1' to the seat count.
        }
        for(i = 0; i < cnt; i++) printf("ID %d is in Seat ID %d", Seat[i][0], Seat[i][1]);
This will print the seats that each player inside your vehicle is in. I must give credit to Jeff somewhat for a few parts of this code as he taught me a few things quite a while back.

cnt - The number of players inside your vehicle.
Seat[#][0] - The id of the #'th player inside your vehicle.
Seat[#][1] - The seat id of the #'th player inside your vehicle.
Reply


Messages In This Thread
Vehicle Seats! - by Juvanii - 03.08.2014, 13:42
Re: Vehicle Seats! - by McBan - 03.08.2014, 13:54
Re: Vehicle Seats! - by Threshold - 03.08.2014, 14:05
Re: Vehicle Seats! - by [XST]O_x - 03.08.2014, 14:06
Re: Vehicle Seats! - by Juvanii - 03.08.2014, 14:34
Re: Vehicle Seats! - by [XST]O_x - 03.08.2014, 14:56
Re: Vehicle Seats! - by Juvanii - 07.08.2014, 15:26
Re: Vehicle Seats! - by [XST]O_x - 07.08.2014, 17:43
AW: Re: Vehicle Seats! - by Nero_3D - 08.08.2014, 02:44
Re: AW: Re: Vehicle Seats! - by [XST]O_x - 08.08.2014, 06:39

Forum Jump:


Users browsing this thread: 1 Guest(s)