SA-MP Forums Archive
is player on vehicle - 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: is player on vehicle (/showthread.php?tid=80897)



is player on vehicle - StrickenKid - 07.06.2009

my anticheat will ban anyone who is wing surfing or riding on top of a car because it thinks there speed hacking / air breaking... is there a way to detect if their on top or just near a moving vehicle so people wont get anticheated by wing surfing / riding on cars?

Thanks,
Ethan


Re: is player on vehicle - 1337pr0 - 07.06.2009

pawn Код:
IsPlayerOnAnyVehicle(playerid)
{
  new Float:vehx, Float:vehy, Float:vehz, Float:plyx, Float:plyy, Float:plyz;
  GetVehiclePos(v, plyx, plyy, plyz);
  for (new v; v < MAX_VEHICLES; v++)
  {
    if (GetVehicleModel(v) >= 400) // not sure about this line
    {
      GetVehiclePos(v, vehx, vehy, vehz);
      if (PlayerToPoint(10, playerid, vehx, vehy, vehz) && vehz + 2 < plz)
      {
        return 1; // could also return the vehicle ID (v)
      }
    }
  }
  return 0;
}
Maybe something like this.