How to detect..
#1

Hello,

How can i detect if a certain vehicle is occupied or not?
Reply
#2

pawn Код:
stock IsVehicleInUse(vehicleid)
{
new IsTrue=0;
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i) == vehicleid) IsTrue=1;
}
}
}
return IsTrue;
}
Not tested
Reply
#3

Quote:
Originally Posted by Joe Torran C
Hello,

How can i detect if a certain vehicle is occupied or not?
My suggestion:
pawn Код:
stock IsVehicleInUse(vehicleid)
{
  for(new i=0; i<GetMaxPlayers(); i++)
  {
    if(IsPlayerConnected(i))
    {
      if(GetPlayerVehicleID(i) == vehicleid)
      return true;
    }
  }
  return false;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)