How can I make it so only pilots can get in planes?
#1

How can I make it so only pilots can get in planes. I have the teams and stuff setup.
Reply
#2

pawn Код:
if(PlayerTeam[playerid] != pilot) TogglePlayerControllable(playerid, 1), SendClientMessage(playerid, col, "Only pilots can drive a plane...");
Reply
#3

Won't that apply to cars too?
Reply
#4

Quote:
Originally Posted by Kurence
pawn Код:
if(PlayerTeam[playerid] != pilot) TogglePlayerControllable(playerid, 1), SendClientMessage(playerid, col, "Only pilots can drive a plane...");
So, when do you untoggle them?
Reply
#5

I guess it's meant to toggle player under OnPlayerEnterVehicle...
Reply
#6

bump
Reply
#7

How do you define pilots in script? I mean something like "Team[playerid] pilot"? When you find it, go to OnPlayerEnterVehicle and do something like that

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(ispassenger == 0)
  {
    if(GetVehicleModel(vehicleid) == 593/*dodo vehicle modelid*/ && Team[playerid] != pilot)
    {
      SendClientMessage(playerid, 0xFFFFFFFF, "You cant drive this dodo because you are not a pilot");
      TogglePlayerControlable(playerid, 0);//freeze
      TogglePlayerControlable(playerid, 1);//unfreeze to prevent him from entering in the plane
    }
  }
  return 1;
}
Reply
#8

OMFG it is enough to unfreeze player you lol
Reply
#9

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(ispassenger == 0) //Check to see if the player is a passenger
  {
     if(IsVehPlane(vehicleid))
     {
        SendClientMessage(playerid, 0xFFFFFFFF, "You are not a pilot, you cannot fly planes!");
        RemovePlayerFromVehicle(playerid);
     }
  }
  return 1;
}
Above it add this

pawn Код:
forward IsVehPlane(vehicleid);
public IsVehPlane(vehicleid)
{
if(GetVehicleModel(vehicleid) == 593 || GetVehicleModel(vehicleid) == 592 || GetVehicleModel(vehicleid) == 577 || GetVehicleModel(vehicleid) == 511 || GetVehicleModel(vehicleid) == 512 || GetVehicleModel(vehicleid) == 520 || GetVehicleModel(vehicleid) == 553 || GetVehicleModel(vehicleid) == 476 || GetVehicleModel(vehicleid) == 519 || GetVehicleModel(vehicleid) == 460 || GetVehicleModel(vehicleid) == 513)
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)