The Problem PutPlayerInVehicle.
#9

Quote:
Originally Posted by Nikid
Посмотреть сообщение
And if 1 of the players killed, then go how you can add the player?
How can I find out which car and what is the place?
Use this function to check if there is any free seat in the vehicle
Quote:
Originally Posted by wouter0100
Посмотреть сообщение
pawn Код:
stock GetEmptyVehicleSeat(vehicleid)
{
    new bool:Seat[4];
    for(new i;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i,vehicleid))
            {
                if(GetPlayerVehicleSeat(i) == 0) Seat[0] = true;
                if(GetPlayerVehicleSeat(i) == 1) Seat[1] = true;
                if(GetPlayerVehicleSeat(i) == 2) Seat[2] = true;
                if(GetPlayerVehicleSeat(i) == 3) Seat[3] = true;
            }
        }
    }
    for(new a;a<sizeof(Seat);a++)
    {
        if(Seat[a] == false) return a;
    }
    return -1;
}
Returns -1 if there isnt a free seat.
I think this will do it..
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetEmptyVehicleSeat(Veh) != -1) PutPlayerInVehicle(playerid, Veh, GetEmptyVehicleSeat(Veh)); // Check if there is any free seat in vehicle 1
    else if(GetEmptyVehicleSeat(Veh1) != -1) PutPlayerInVehicle(playerid, Veh1, GetEmptyVehicleSeat(Veh)); // Same as above, But for vehicle 2
    else SendClientMessage(playerid, -1, "Sorry but there is no free seat for you");
    return 1;
}
Reply


Messages In This Thread
The Problem PutPlayerInVehicle. - by Nikid - 28.11.2013, 11:24
Re: The Problem PutPlayerInVehicle. - by xVIP3Rx - 28.11.2013, 11:30
Re: The Problem PutPlayerInVehicle. - by Nikid - 28.11.2013, 11:38
Re: The Problem PutPlayerInVehicle. - by xVIP3Rx - 28.11.2013, 11:39
Re: The Problem PutPlayerInVehicle. - by Nikid - 28.11.2013, 11:46
Re: The Problem PutPlayerInVehicle. - by xVIP3Rx - 28.11.2013, 12:03
Re: The Problem PutPlayerInVehicle. - by Nikid - 28.11.2013, 12:20
Re: The Problem PutPlayerInVehicle. - by Nikid - 28.11.2013, 12:25
Re: The Problem PutPlayerInVehicle. - by xVIP3Rx - 28.11.2013, 13:40
Re: The Problem PutPlayerInVehicle. - by Nikid - 28.11.2013, 17:13

Forum Jump:


Users browsing this thread: 1 Guest(s)