SA-MP Forums Archive
[Solved] IsPlayerInVehicle(playerid,vehicleid).... - 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: [Solved] IsPlayerInVehicle(playerid,vehicleid).... (/showthread.php?tid=82637)



[Solved] IsPlayerInVehicle(playerid,vehicleid).... - SiJ - 19.06.2009

Hey,
I have these lines in my command:
pawn Код:
if (IsPlayerInVehicle(playerid,597))
        {
            TogglePlayerControllable(id,0);
            new vehid = GetPlayerVehicleID(playerid);
            PutPlayerInVehicle(id,vehid,seatid);
        }
else ErrorMsg(playerid,"You are not in SF Police Car!");
But when I'm in vehicle id-597 it shows "You are not in SF Police Car!".. Why? What's wrong with the code?
Or do I need to use
pawn Код:
new vehid = GetPlayerVehicleId(playerid);
if(vehid == 597)
 {...



Re: IsPlayerInVehicle(playerid,vehicleid).... - Mr_C30 - 19.06.2009

lol look my post


Re: IsPlayerInVehicle(playerid,vehicleid).... - Correlli - 19.06.2009

vehicleid is not modelid.


Re: IsPlayerInVehicle(playerid,vehicleid).... - CracK - 19.06.2009

pawn Код:
if (IsPlayerInAnyVehicle(playerid))
{
  if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 597)
  {
   TogglePlayerControllable(id,0);
   new vehid = GetPlayerVehicleID(playerid);
   PutPlayerInVehicle(id,vehid,seatid);
  }
  else ErrorMsg(playerid,"You are not in SF Police Car!");
}



Re: IsPlayerInVehicle(playerid,vehicleid).... - SiJ - 19.06.2009

Quote:
Originally Posted by Mr_C30
lol look my post
What?

Quote:
Originally Posted by Don Correlli
vehicleid is not modelid.
So this won't work:

[quote=CrαcK ]
pawn Код:
if (IsPlayerInAnyVehicle(playerid))
{
  if(GetPlayerVehicleID(playerid) == 597)
  {
   TogglePlayerControllable(id,0);
   new vehid = GetPlayerVehicleID(playerid);
   PutPlayerInVehicle(id,vehid,seatid);
  }
  else ErrorMsg(playerid,"You are not in SF Police Car!");
}
?



Re: IsPlayerInVehicle(playerid,vehicleid).... - Correlli - 19.06.2009

No, it won't. It will work only if you'll enter the vehicle with id 597, vehicleids are counted with every AddStaticVehicle/CreateVehicle.
Use the code that CrαcK gave you.


Re: IsPlayerInVehicle(playerid,vehicleid).... - SiJ - 19.06.2009

Ok, thanks for help