Skip to content

Commit

Permalink
Added GetLoadedVehicleModels
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Oct 8, 2023
1 parent 9f1a28f commit d9c50e7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
12 changes: 12 additions & 0 deletions c-api/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,16 @@ ClrVehicleModelInfo* Core_GetVehicleModelInfo(alt::ICore* core, uint32_t hash) {
return new ClrVehicleModelInfo(core->GetVehicleModelByHash(hash));
}

void Core_GetLoadedVehicleModels(alt::ICore* core, uint32_t*& loadedVehicleModelsOut, uint64_t& size) {
auto loadedVehicleModels = core->GetLoadedVehicleModels();
size = loadedVehicleModels.size();
auto valuesArr = new uint32_t[size];
for (auto i = 0; i < size; i++) {
valuesArr[i] = loadedVehicleModels[i];
}
loadedVehicleModelsOut = valuesArr;
}

ClrPedModelInfo* Core_GetPedModelInfo(alt::ICore* core, uint32_t hash) {
return new ClrPedModelInfo(core->GetPedModelByHash(hash));
}
Expand Down Expand Up @@ -1020,6 +1030,8 @@ uint16_t Core_TriggerClientRPCEvent(alt::ICore* core, alt::IPlayer* target, cons
}
return core->TriggerClientRPCEvent(target, ev, mValues);
}


#endif

#ifdef ALT_CLIENT_API
Expand Down
1 change: 1 addition & 0 deletions c-api/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ EXPORT_SERVER alt::IBlip* Core_CreateBlip(alt::ICore* core, uint8_t global, uint
EXPORT_SERVER alt::IBlip* Core_CreateBlipAttached(alt::ICore* core, uint8_t global, uint8_t type, alt::IEntity* attachTo, alt::IPlayer* targets[], int targetsSize, uint32_t &id);

EXPORT_SERVER ClrVehicleModelInfo* Core_GetVehicleModelInfo(alt::ICore* core, uint32_t hash);
EXPORT_SERVER void Core_GetLoadedVehicleModels(alt::ICore* core, uint32_t*& loadedVehicleModelsOut, uint64_t& size);
EXPORT_SERVER ClrPedModelInfo* Core_GetPedModelInfo(alt::ICore* core, uint32_t hash);
EXPORT_SERVER ClrWeaponModelInfo* Core_GetWeaponModelByHash(alt::ICore* core, uint32_t hash);
EXPORT_SERVER void Core_DeallocVehicleModelInfo(ClrVehicleModelInfo* modelInfo);
Expand Down
4 changes: 3 additions & 1 deletion c-api/func_table.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "func_table.h"

inline uint64_t capiHash = 557522308693843528UL;
inline uint64_t capiHash = 17234525495073991761UL;
inline uint64_t capiHashes[] = {
0,
#ifdef ALT_CLIENT_API
Expand Down Expand Up @@ -1336,6 +1336,7 @@ inline uint64_t capiHashes[] = {
12784287737200780200UL,
12414549446254212526UL,
6795936790869684439UL,
5931751806478777368UL,
3581368898059030296UL,
6049887365767315904UL,
17973186281360658901UL,
Expand Down Expand Up @@ -3072,6 +3073,7 @@ inline void* capiPointers[] = {
(void*) Core_GetEntitiesInDimensionCount,
(void*) Core_GetEntitiesInRange,
(void*) Core_GetEntitiesInRangeCount,
(void*) Core_GetLoadedVehicleModels,
(void*) Core_GetMaxStreamingObjects,
(void*) Core_GetMaxStreamingPeds,
(void*) Core_GetMaxStreamingVehicles,
Expand Down
2 changes: 1 addition & 1 deletion cpp-sdk
Submodule cpp-sdk updated 1 files
+1 −0 ICore.h

0 comments on commit d9c50e7

Please sign in to comment.