inline function not called
# support-forum
d
any idea why
inline OnVehicleLoad
is not called here?
Copy code
Player_SpawnVehicle(playerid, databaseid)
{
    inline OnVehicleLoad(vehicleid)
    {
        SendClientMessage(playerid, -1, "inline OnVehicleLoad(vehicleid = %d) called", vehicleid); // not called
    }
    Vehicle_LoadInline(databaseid, using inline OnVehicleLoad);
    return 1;
}
Back-end:
Copy code
stock bool:Vehicle_LoadInline(databaseid, Func:callback<>)
{
    inline const OnVehicleFound()
    {
        new vehicleid = CreateVehicle(modelid, x, y, z, a, colOne, colTwo, -1);

        if(GetVehicleModel(vehicleid))
        {
            Indirect_Claim(callback);
            StatsLoadedCallback[vehicleid] = callback;
        }
    }
    MySQL_TQueryInline(MySQL_GetHandle(), using inline OnVehicleFound, "SELECT ... FROM vehicles WHERE id = %d", databaseid);
    return true;
}

hook OnServerVehicleSpawn(vehicleid)
{
    ProxDetector("%s (%d) spawned (OnServerVehicleSpawn)");

    if(StatsLoadedCallback[vehicleid])
    {
        new Func:cb<> = StatsLoadedCallback[vehicleid];
        StatsLoadedCallback[vehicleid] = Func:0<>;

        @.cb(vehicleid);
        Indirect_Release(cb);

        ProxDetector("%s (%d) supposedly called the callback");
    }
}
I fixed it by putting
Indirect_Claim
before the mysql inline, but could I encounter other issues by doing this?
Copy code
stock bool:Vehicle_LoadInline(databaseid, Func:callback<>)
{
    Indirect_Claim(callback);

    inline const OnVehicleFound()
    {
        if(!cache_num_rows())
        {
            Indirect_Release(callback);
            return false;
        }
@sparse-sugar-43205 I don't know if it's a bug or if this is how it's supposed to be
2 Views