SA-MP Forums Archive
How can I make it so only pilots can get in planes? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How can I make it so only pilots can get in planes? (/showthread.php?tid=108734)



How can I make it so only pilots can get in planes? - alex902602 - 15.11.2009

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


Re: How can I make it so only pilots can get in planes? - Kurence - 15.11.2009

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



Re: How can I make it so only pilots can get in planes? - alex902602 - 15.11.2009

Won't that apply to cars too?


Re: How can I make it so only pilots can get in planes? - FUNExtreme - 15.11.2009

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?


Re: How can I make it so only pilots can get in planes? - niCe - 15.11.2009

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


Re: How can I make it so only pilots can get in planes? - alex902602 - 18.11.2009

bump


Re: How can I make it so only pilots can get in planes? - Dark_Kostas - 18.11.2009

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;
}



Re: How can I make it so only pilots can get in planes? - Kurence - 18.11.2009

OMFG it is enough to unfreeze player you lol


Re: How can I make it so only pilots can get in planes? - PowerSurge - 18.11.2009

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)
}