SA-MP Forums Archive
Werid problem with OnPlayerDisconnect and DestroyVehicle - 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: Werid problem with OnPlayerDisconnect and DestroyVehicle (/showthread.php?tid=90994)



Werid problem with OnPlayerDisconnect and DestroyVehicle - kacperoo - 11.08.2009

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


Re: Werid problem with OnPlayerDisconnect and DestroyVehicle - kaisersouse - 11.08.2009

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


Re: Werid problem with OnPlayerDisconnect and DestroyVehicle - kacperoo - 11.08.2009

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.


Re: Werid problem with OnPlayerDisconnect and DestroyVehicle - kacperoo - 11.08.2009

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


Re: Werid problem with OnPlayerDisconnect and DestroyVehicle - kacperoo - 11.08.2009

Just refreshin


Re: Werid problem with OnPlayerDisconnect and DestroyVehicle - kacperoo - 12.08.2009

anyone?