The Problem PutPlayerInVehicle. -
Nikid - 28.11.2013
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: ******.
Re: The Problem PutPlayerInVehicle. -
xVIP3Rx - 28.11.2013
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
Re: The Problem PutPlayerInVehicle. -
Nikid - 28.11.2013
The whole day I sit and I do not understand how. Can tell who?
Re: The Problem PutPlayerInVehicle. -
xVIP3Rx - 28.11.2013
Can you tell what are you trying to do exactly ?
Re: The Problem PutPlayerInVehicle. -
Nikid - 28.11.2013
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.
Re: The Problem PutPlayerInVehicle. -
xVIP3Rx - 28.11.2013
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
}
}
Re: The Problem PutPlayerInVehicle. -
Nikid - 28.11.2013
Thank xVIP3Rx
Re: The Problem PutPlayerInVehicle. -
Nikid - 28.11.2013
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?
Re: The Problem PutPlayerInVehicle. -
xVIP3Rx - 28.11.2013
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;
}
Re: The Problem PutPlayerInVehicle. -
Nikid - 28.11.2013
When I use GetEmptyVehicleSeat. The player goes into a spес in the random camera and transport invisible.