Clear all Vehicles with chosen ID
#1

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.
Reply
#2

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
Reply
#3

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?
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)