SA-MP Forums Archive
Clear all Vehicles with chosen 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: Clear all Vehicles with chosen ID (/showthread.php?tid=94271)



Clear all Vehicles with chosen ID - Black_Sun - 28.08.2009

Hi. Can somebody help me? I wanna have a command, like /clearveh . If i use the command, evry car with the ID 591 shall Dissapear. I tryed
Код:
    	if (strcmp(cmd, "/clearveh  ", true)==0) {
DestroyVehicleEx(591);
		return 1;
. I don't get any Errors or Warnings, but if i use the CMD, nothing happens.


Re: Clear all Vehicles with chosen ID - JaTochNietDan - 28.08.2009

pawn Код:
if(strcmp(cmdtext,"/clearveh",true) == 0)
{
  for(new i; i < MAX_VEHICLES; i++)
  {
    if(GetVehicleModel(i) == 591)
    {
      DestroyVehicle(i);
    }
  }
  return 1;
}
Now this will have a long and un-optimised execution time but generally this is just an example. DestroyVehicle uses vehicleid's and not modelid's


Re: Clear all Vehicles with chosen ID - Black_Sun - 28.08.2009

Quote:
Originally Posted by JaTochNietDan
pawn Код:
if(strcmp(cmdtext,"/clearveh",true) == 0)
{
  for(new i; i < MAX_VEHICLES; i++)
  {
    if(GetVehicleModel(i) == 591)
    {
      DestroyVehicle(i);
    }
  }
  return 1;
}
Now this will have a long and un-optimised execution time but generally this is just an example. DestroyVehicle uses vehicleid's and not modelid's
Thanks, it works

Can you also tell me how i can put it on OnGameModeInit?


Re: Clear all Vehicles with chosen ID - ilikepie2221 - 28.08.2009

Quote:
Originally Posted by Black_Sun
Quote:
Originally Posted by JaTochNietDan
pawn Код:
if(strcmp(cmdtext,"/clearveh",true) == 0)
{
  for(new i; i < MAX_VEHICLES; i++)
  {
    if(GetVehicleModel(i) == 591)
    {
      DestroyVehicle(i);
    }
  }
  return 1;
}
Now this will have a long and un-optimised execution time but generally this is just an example. DestroyVehicle uses vehicleid's and not modelid's
Thanks, it works

Can you also tell me how i can put it on OnGameModeInit?
Dont make the vehicles in the first place? lol.