OnPlayerEnterVehicle [Question] -
Prokill911 - 08.04.2015
Hello, So I'm wondering if It's possible...
Here's an example.
If I had a Pvar, lets call it *Test*
When ever a person tries to enter the vehicle *BMX*, IF the Pvar *Test* == 0;
It kicks them out of the vehicle..
~Is this possible?
I've tried a few lines of code but it always lets me in the vehicle, Just wondering if this is actually not possible.
EXAMPLE CODE:
Код:
new CanEnterCar = GetPVarInt(playerid, "Test");
if(CanEnterCar == 1) {
return 1;
} else {
SendClientMessage(playerid, X11_Red, "You cannot enter this vehicle!");
return 1;
}
HOW do I make it so they cannot enter the vehicle?
Re: OnPlayerEnterVehicle [Question] -
Konstantinos - 08.04.2015
OnPlayerEnterVehicle is called when a player starts to enter a vehicle, they're not in the vehicle yet. You can use that callback and clear the animations or use OnPlayerStateChange, check if the newstate is driver and RemovePlayerFromVehicle.
Re: OnPlayerEnterVehicle [Question] -
R0 - 08.04.2015
Yes it is possible,what are you using to remove the player from vehicle?are you using RemovePlayerFromVehicle?if yes then use:
pawn Код:
ClearAnimations(playerid);
because OnPlayerEnterVehicle gets called when he presses on F or Enter
Or you can use:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == put here bike model id)
{
RemovePlayerFromVehicle(playerid);
}
return 1;
}
AW: OnPlayerEnterVehicle [Question] -
Mencent - 08.04.2015
Hello!
You can also use TogglePlayerControllable.
PHP код:
TogglePlayerControllable(playerid,0);
TogglePlayerControllable(playerid,1);
So, he can't enter the vehicle.
PHP код:
new CanEnterCar = GetPVarInt(playerid, "Test");
if(CanEnterCar == 1) {
return 1;
} else {
SendClientMessage(playerid, X11_Red, "You cannot enter this vehicle!");
TogglePlayerControllable(playerid,false);
TogglePlayerControllable(playerid,true);
// or
//ClearAnimations(playerid);
return 1;
}
Mencent