damp-appointment-93881
02/26/2023, 4:07 PMinline 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:
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");
}
}damp-appointment-93881
02/26/2023, 4:17 PMIndirect_Claim before the mysql inline, but could I encounter other issues by doing this?
stock bool:Vehicle_LoadInline(databaseid, Func:callback<>)
{
Indirect_Claim(callback);
inline const OnVehicleFound()
{
if(!cache_num_rows())
{
Indirect_Release(callback);
return false;
}damp-appointment-93881
02/26/2023, 4:19 PM