DestroyVehicle bug
#1

Basically, after using DestroyVehicle, the vehicle has disappeared, yet if I were to run in to its position before it were destroyed, I'd be blocked by an invisible object. The car's being destroyed, but it's leaving an invisible object for some reason. This isn't a constant occurrence either. Any idea how to fix this issue? I've never seen such an issue on servers such as LS-RP, etc.
Reply
#2

Means its not being destroyed appropiately.

Код:
#define MAX_SERVER_VEHICLES 100
The Stock for Isvehicleconnected
To see which vehicles are really spawned.
Код:
stock IsVehicleConnected(vehicleid)
{
  new Float:x1,Float:y1,Float:z1;
  GetVehiclePos(vehicleid,x1,y1,z1);
  if(x1==0.0 && y1==0.0 && z1==0.0)
  {
    return 0;
  }
  return 1;
}
And ofcourse a command to destroy them all.
Код:
CMD:destroyallv(playerid,params[])
{
	for(new i; i < MAX_SERVER_VEHICLES; i++)
	{
		if(IsVehicleConnected(i)) DestroyVehicle(i);
	}
SendClientMessage(playerid,COLOR_LIGHTBLUE, "<Admin>: {ffffff}All the Vehicles have been Destroyed.");
Return 1;
}
And what could maybe help?
Is reloading all the vehicles after they have been destroyed.
Reply
#3

Gonna get back to you if I don't notice a difference. Thanks for the function.

EDIT: Seems to have worked. Thanks.
Reply
#4

No problem
Reply
#5

Quote:
Originally Posted by yvoms
Посмотреть сообщение
To see which vehicles are really spawned.
Код:
stock IsVehicleConnected(vehicleid)
{
  new Float:x1,Float:y1,Float:z1;
  GetVehiclePos(vehicleid,x1,y1,z1);
  if(x1==0.0 && y1==0.0 && z1==0.0)
  {
    return 0;
  }
  return 1;
}
That is seriously redundant because any GetVehicle* function will return 0 if the vehicle does not exist. Besides that, there is actually a native IsValidVehicle that can be used. For some reason this one isn't declared in the server files but you can add the native definition yourself and it'll work just fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)