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

I'd check your GetVehicleIDByUID function, or at least change that printf to this:

Код:
printf("Vehicle %s - Now destroying. ID: %i", PlayerName(playerid),pointer);
So you know if its destroying a real vehicle ID or not
Reply
#3

Quote:
Originally Posted by kaisersouse
I'd check your GetVehicleIDByUID function, or at least change that printf to this:

Код:
printf("Vehicle %s - Now destroying. ID: %i", PlayerName(playerid),pointer);
So you know if its destroying a real vehicle ID or not
Код:
[21:49:10] Sadler (UID 43, ID 43) - Owner ID: 1

[21:49:12] Before vehicles unspawn of Raven_Fogg
[21:49:12] Vehicle of Raven_Fogg - Getting ID
[21:49:12] Vehicle Raven_Fogg - ID 43.
Seems to be good.
Reply
#4

When I added this code to command i have "SERVER: Unknown command" message.
Reply
#5

Just refreshin
Reply
#6

anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)