Werid problem with OnPlayerDisconnect and DestroyVehicle
#1

Hi all, I have werid problem when I try to destroy player's vehicles when he disconnects. After I use DestroyVehicle(vehicleid) the code execution stops.
Anyone know why?
I'm attaching code with debug.

There is my code:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  // cut
  printf("Before vehicles unspawn of %s", PlayerName(playerid));
  for(new a = 0; a < sizeof(CarInfo); a++)
  {
    if(CarInfo[a][cOwned] == 1 && CarInfo[a][cOwner] == PlayerInfo[playerid][pSQLID])
    {
      printf("Vehicle of %s - Getting ID", PlayerName(playerid));
      new pointer = GetVehicleIDByUID(a);
      printf("Vehicle %s - Now destroying", PlayerName(playerid));
      DestroyVehicle(pointer);
      printf("Vehicle %s (UID %d) gracza %s został odspawnowany z ID %d", GetVehicleName(pointer), Cars[pointer][carUID], PlayerName(playerid), pointer);
      Cars[pointer][carUID] = 0;
    }
  }
  // cut
}
Logs:
Код:
[20:39:26] Before vehicles unspawn of Raven_Fogg
[20:39:26] Vehicle of Raven_Fogg - Getting ID
[20:39:26] Vehicle Raven_Fogg - Now destroying
[20:39:26] [part] Raven_Fogg has left the server (0:1)
Thanks in advance,
kacperoo
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)