#inline function not called

2 messages · Page 1 of 1 (latest)

dark scaffold
#

any idea why inline OnVehicleLoad is not called here?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:

{
    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?

{
    Indirect_Claim(callback);

    inline const OnVehicleFound()
    {
        if(!cache_num_rows())
        {
            Indirect_Release(callback);
            return false;
        }```