[Solved] IsPlayerInVehicle(playerid,vehicleid)....
#1

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)
 {...
Reply
#2

lol look my post
Reply
#3

vehicleid is not modelid.
Reply
#4

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!");
}
Reply
#5

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!");
}
?
Reply
#6

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.
Reply
#7

Ok, thanks for help
Reply


Forum Jump:


Users browsing this thread: