Skip to content

Commit

Permalink
add all weapon data getter
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Jul 12, 2023
1 parent f0a7996 commit 7d36f59
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
16 changes: 16 additions & 0 deletions c-api/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1800,5 +1800,21 @@ alt::IWorldObject* Core_GetWorldObjectByScriptID(alt::ICore* core, uint32_t scri
{
return core->GetWorldObjectByScriptID(scriptId);
}

uint64_t Core_GetAllWeaponDataCount(alt::ICore* core)
{
return core->GetAllWeaponData().size();
}

void Core_GetAllWeaponData(alt::ICore* core, uint32_t weaponHashes[], uint64_t size)
{
auto weaponData = core->GetAllWeaponData();
if (weaponData.size() < size) {
size = weaponData.size();
}
for (uint64_t i = 0; i < size; i++) {
weaponHashes[i] = weaponData[i]->GetNameHash();
}
}
#endif

5 changes: 4 additions & 1 deletion c-api/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,7 @@ EXPORT_CLIENT alt::IBlip* Core_GetBlipByGameID(alt::ICore* core, uint32_t gameId
EXPORT_CLIENT alt::ICheckpoint* Core_GetCheckpointByGameID(alt::ICore* core, uint32_t gameId);
EXPORT_CLIENT uint8_t Core_IsWebViewGpuAccelerationActive(alt::ICore* core);

EXPORT_CLIENT alt::IWorldObject* Core_GetWorldObjectByScriptID(alt::ICore* core, uint32_t scriptId);
EXPORT_CLIENT alt::IWorldObject* Core_GetWorldObjectByScriptID(alt::ICore* core, uint32_t scriptId);

EXPORT_CLIENT uint64_t Core_GetAllWeaponDataCount(alt::ICore* core);
EXPORT_CLIENT void Core_GetAllWeaponData(alt::ICore* core, uint32_t weaponHashes[], uint64_t size);
6 changes: 5 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 = 3791551142871488314UL;
inline uint64_t capiHash = 11130246753470560260UL;
inline uint64_t capiHashes[] = {
0,
#ifdef ALT_CLIENT_API
Expand Down Expand Up @@ -125,6 +125,8 @@ inline uint64_t capiHashes[] = {
1212339219242517554UL,
11971296438427190394UL,
2905154853369701790UL,
17040861123821249134UL,
10675436726413059015UL,
18419578908798121866UL,
17324382311220306947UL,
16659676766335434349UL,
Expand Down Expand Up @@ -1752,6 +1754,8 @@ inline void* capiPointers[] = {
(void*) Core_DeallocDiscordUser,
(void*) Core_Discord_GetOAuth2Token,
(void*) Core_DoesConfigFlagExist,
(void*) Core_GetAllWeaponData,
(void*) Core_GetAllWeaponDataCount,
(void*) Core_GetAudioCount,
(void*) Core_GetAudioOutputs,
(void*) Core_GetAudios,
Expand Down
2 changes: 1 addition & 1 deletion cpp-sdk
Submodule cpp-sdk updated 1 files
+1 −0 ICore.h

0 comments on commit 7d36f59

Please sign in to comment.