OnVehicleDeath not getting called for unoccupied vehicles?
#1

I am trying to delete the vehicle if the player has no insurance bought for their vehicles. The strange bug i found here is; if the vehicle is loaded from the database and no one drove it and it somehow gets destroyed by flipping, sinking in water or however, OnVehicleDeath callback is not getting called for it. But if there's a driver driving that vehicle and they destroys it by ramming or however, callback is called and the vehicle is getting deleted.

Is it a default bug from samp? Is there any other ways to fix it?

PHP код:
public OnVehicleDeath(vehicleid)
{
    if (
vInfo[vehicleid][v_Owned] == 1)
    {
        if (
vInfo[vehicleid][v_HouseID] != && hInfo[vInfo[vehicleid][v_HouseID]][h_Insur] == 0)
            
DeleteOwnedVehicle(vehicleid);
    }
    return 
1;
}
DeleteOwnedVehicle(vid)
{
    new
        
query[100];
        
    
mysql_format(mysqlquerysizeof(query), "DELETE FROM `vehicles` WHERE `id`='%d'"vInfo[vid][v_ID]);
    
mysql_tquery(mysqlquery"""");
    new
        
houseid,
        
idx;
        
    
houseid vInfo[vid][v_HouseID];
    if (
houseid != 0)
    {
        for (new 
iMAX_PVEH; ++i)
        {
            if (
hInfo[houseid][h_pVehs][i] == vid)
            {
                
idx i;
                break;
            }
        }
        
hInfo[houseid][h_pVehs][idx] = 0;
    }
    
DestroyVehicle(vid);
    if (
IsValidDynamic3DTextLabel(vInfo[vid][v_OwnerText]))
        
DestroyDynamic3DTextLabel(vInfo[vid][v_OwnerText]);
    for (new 
i_E_VehicleData; ++i)
        
vInfo[vid][E_VehicleDatai] = 0;

Reply
#2

/Bump
Reply
#3

If the vehicle hasn't been occupied at all since the server started then no it won't be called though it should be called even if there's no driver currently but has been occupied at least once.
Reply
#4

Oh ok, thanks for replying.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)