SA-MP Forums Archive
Hmm ? - 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: Hmm ? (/showthread.php?tid=113172)



Hmm ? - MJ! - 12.12.2009

Ok , this work
pawn Код:
// In a command
new CaRs = MAX_VEHICLES - AmountOfVehicles();
for(new i = 1; i < CaRs; i++)
{
     DestroyVehicle(i + 10); // Let's say AmountOfVehicles = 10
  Dc++;
}
But what about this ? This didn't delete my vehicle(s). Why ?
pawn Код:
// In a command
new CaRs = MAX_VEHICLES - AmountOfVehicles();
for(new i = 1; i < CaRs; i++)
{
     DestroyVehicle(i + AmountOfVehicles());
  Dc++;
}
-----------------------------------------------------------------------------
pawn Код:
stock AmountOfVehicles()
{
      new vc;
      for(new i=1; i < 2000; i++) if(GetVehicleModel(i) != 0) vc++;
      return vc;
}




Re: Hmm ? - Joe Staff - 12.12.2009

Because You're asking it to delete cars that don't exist...

Let's say there are 2 players online, of 16, IDs 0 and 1.

p = 16 - 2 (14)

i < p
kick (i+p) which are IDs 14-27 There is no one on those IDs


Re: Hmm ? - MJ! - 12.12.2009

No , that's not true. I'm just trying to do a command which deletes the NEWS CARS CREATED.

Eg:
pawn Код:
I have 400 statics cars , and i create 5 < INGAME > , Total = 405 Vehicles

new CaRs = 2000 - 400 ( 1600 );
for(new i = 1; i < CaRs; i++)
{
  DestroyVehicle(i + 400); // Delete 401, 402, 403, 404, 405
}
~~~ Problem Resolved