The Problem PutPlayerInVehicle.
#1

Hello! Please tell me how to do correctly.
pawn Код:
public OnGameModeInit(){
    Veh = CreateVehicle
    Vehl = CreateVehicle
    return true;
}

for(new i = 0; i < MAX_PLAYERS; i++){
    PutPlayerInVehicle(i, Veh, 0);
    PutPlayerInVehicle(i, Veh, 1);
    PutPlayerInVehicle(i, Veh, 2);

    PutPlayerInVehicle(i, Vehl, 0);
    PutPlayerInVehicle(i, Vehl, 1);
    PutPlayerInVehicle(i, Vehl, 2);
}
as spawned players in transport?

Translate: ******.
Reply
#2

What are you trying to do exactly ?
Quote:
Originally Posted by Nikid
Посмотреть сообщение
pawn Код:
public OnGameModeInit(){
    Veh = CreateVehicle
    Vehl = CreateVehicle
    return true;
}
At the "OnGameModeInit()" you created 2 vehicles,
Quote:
Originally Posted by Nikid
Посмотреть сообщение
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++){
    PutPlayerInVehicle(i, Veh, 0);
    PutPlayerInVehicle(i, Veh, 1);
    PutPlayerInVehicle(i, Veh, 2);

    PutPlayerInVehicle(i, Vehl, 0);
    PutPlayerInVehicle(i, Vehl, 1);
    PutPlayerInVehicle(i, Vehl, 2);
}
Then with that loop you put the player at
The first vehicle as: Driver, then..
The first vehicle as: Front Passenger, then..
The first vehicle as: Back left passenger,
then you put the same player on the second car same as the first car, I think you need to learn more about PutPlayerInVehicle and Loops
Reply
#3

The whole day I sit and I do not understand how. Can tell who?
Reply
#4

Can you tell what are you trying to do exactly ?
Reply
#5

Run arena.
8 players must sit in transport 2 cars. But everyone should get your seat.
Not that 1 player whipped another.
One pushes the other.
Reply
#6

Try this loop instead,
pawn Код:
for(new i = 0; i < 7; i++) // Players Loop - Just for 8 players(starting with 0)
    {
        if(i > 3) // 5th+ player..
        {
            PutPlayerInVehicle(i, Vehl, i-4); //put players in the second vehicle
        }
        else // 4th- player..
        {
            PutPlayerInVehicle(i, Veh, i); //put players in the first vehicle
        }
    }
Reply
#7

Thank xVIP3Rx
Reply
#8

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?
Reply
#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
#10

When I use GetEmptyVehicleSeat. The player goes into a spес in the random camera and transport invisible.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)