SA-MP Forums Archive
MAX_VEHICLES to find ID? - 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: MAX_VEHICLES to find ID? (/showthread.php?tid=150800)



MAX_VEHICLES to find ID? - Antonio [G-RP] - 27.05.2010

How can you find the vehicle ID of for(new i=0;i<MAX_VEHICLES;i++)
because I want to make a command, but I need the vehicleID.

Thanks, all help appreciated.


Re: MAX_VEHICLES to find ID? - Grim_ - 27.05.2010

Like, for checking a players vehicle id?

And just like:
pawn Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
  if(i == vehicle_id)
  {
   // do something
  }
}



Re: MAX_VEHICLES to find ID? - coole210 - 28.05.2010

just do GetPlayerVehicleID(playerid);

Or change MAX_VEHICLES to MAX_PLAYERS and change playerid to i


Re: MAX_VEHICLES to find ID? - Antonio [G-RP] - 28.05.2010

Well what I'm trying to do is create an admin command that shuts off all car engines, but I think I need the vehicle ID to do that...

FactionCar[x][fcEngine] is my engine where x = vehicleid.

What I want to do is have the command shut all engines off.


Re: MAX_VEHICLES to find ID? - Sergei - 28.05.2010

Just put vehicle id inside?
Like VehicleInfo[vehicleid][fcEngine].


Re: MAX_VEHICLES to find ID? - Hiddos - 28.05.2010

Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
Well what I'm trying to do is create an admin command that shuts off all car engines, but I think I need the vehicle ID to do that...

FactionCar[x][fcEngine] is my engine where x = vehicleid.

What I want to do is have the command shut all engines off.
pawn Код:
for(new v; v < MAX_VEHICLES; v++) //v can be everything that is under MAX_VEHICLES(2000), so v is appointed 0, but also 324, etc. Missed out on mathematics? :P
{
VehicleInfo[v][fcEngine] = 0; //Stops engine of 'v'.
}



Re: MAX_VEHICLES to find ID? - Antonio [G-RP] - 28.05.2010

Thanks, I'll test it.