12.02.2009, 00:37
This is pretty easy. When you create a vehicle, it returns the vehicle's id. You need to fetch the id and store it in a variable. Then, when a player enters the plane and is not a pilot or w/e, it needs to remove them. Or you can lock the plane's doors ( players can still get in the plane if someone leaves the doors open ).
Try that.
pawn Код:
//Create a variable for the planes ( adjust the size of the variable for however many needed )
new Planes[4];
//Find when the vehicle is created
Planes[0] = AddStaticVehicle/CreateVehicle//...
Planes[1] = //The same
//Etc...
//Create this callback if not already there
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetPlayerVehicleID(playerid) == Planes[1])
{
if(//Use some variable to check if they are able to use these ( admin, etc.. ))
{
RemovePlayerFromVehicle(playerid);
return 1;
}
}
//Do the same for the other planes.
}
return 1;
}