diff --git a/c-api/core.cpp b/c-api/core.cpp index 537a695..2921020 100644 --- a/c-api/core.cpp +++ b/c-api/core.cpp @@ -770,19 +770,21 @@ uint64_t Core_GetClosestEntitiesCount(alt::ICore* core, vector3_t position, int3 return core->GetClosestEntities(pos, range, dimension, limit, allowedTypes).size(); } -void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size) { +void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size) { auto entitiesArray = core->GetEntitiesInDimension(dimension, allowedTypes); if (entitiesArray.size() < size) { size = entitiesArray.size(); } + auto entityArr = new void*[size]; for (uint64_t i = 0; i < size; i++) { - entities[i] = entitiesArray[i]; + entityArr[i] = Util_GetBaseObjectPointer(entitiesArray[i]); types[i] = (uint8_t) entitiesArray[i]->GetType(); } + entities = entityArr; } -void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size) { +void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size) { alt::Position pos; pos.x = position.x; pos.y = position.y; @@ -792,13 +794,16 @@ void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range if (entitiesArray.size() < size) { size = entitiesArray.size(); } + + auto entityArr = new void*[size]; for (uint64_t i = 0; i < size; i++) { - entities[i] = entitiesArray[i]; + entityArr[i] = Util_GetBaseObjectPointer(entitiesArray[i]); types[i] = (uint8_t) entitiesArray[i]->GetType(); } + entities = entityArr; } -void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size) { +void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size) { alt::Position pos; pos.x = position.x; pos.y = position.y; @@ -808,10 +813,13 @@ void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range if (entitiesArray.size() < size) { size = entitiesArray.size(); } + + auto entityArr = new void*[size]; for (uint64_t i = 0; i < size; i++) { - entities[i] = entitiesArray[i]; + entityArr[i] = Util_GetBaseObjectPointer(entitiesArray[i]); types[i] = (uint8_t) entitiesArray[i]->GetType(); } + entities = entityArr; } alt::IMarker* Core_CreateMarker(alt::ICore* core, alt::IPlayer* target, uint8_t type, position_t position, rgba_t color, diff --git a/c-api/core.h b/c-api/core.h index bd52af0..5d8c462 100644 --- a/c-api/core.h +++ b/c-api/core.h @@ -133,9 +133,9 @@ EXPORT_SERVER void Core_SetWorldProfiler(alt::ICore* core, uint8_t state); EXPORT_SERVER uint64_t Core_GetEntitiesInDimensionCount(alt::ICore* core, int32_t dimension, uint64_t allowedTypes); EXPORT_SERVER uint64_t Core_GetEntitiesInRangeCount(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes); EXPORT_SERVER uint64_t Core_GetClosestEntitiesCount(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes); -EXPORT_SERVER void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size); -EXPORT_SERVER void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size); -EXPORT_SERVER void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, alt::IBaseObject* entities[], uint8_t types[], uint64_t size); +EXPORT_SERVER void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size); +EXPORT_SERVER void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size); +EXPORT_SERVER void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size); #ifdef ALT_CLIENT_API EXPORT_CLIENT uint8_t Core_Client_FileExists(alt::ICore* core, alt::IResource* resource, const char* path); diff --git a/c-api/entities/entity.cpp b/c-api/entities/entity.cpp index 19cc908..d55aab4 100644 --- a/c-api/entities/entity.cpp +++ b/c-api/entities/entity.cpp @@ -5,7 +5,7 @@ CAPI_START() -uint16_t Entity_GetID(alt::IEntity* entity) { +uint32_t Entity_GetID(alt::IEntity* entity) { return entity->GetID(); } diff --git a/c-api/entities/entity.h b/c-api/entities/entity.h index fb5f8c4..254e162 100644 --- a/c-api/entities/entity.h +++ b/c-api/entities/entity.h @@ -14,7 +14,7 @@ #pragma clang diagnostic pop #endif -EXPORT_SHARED uint16_t Entity_GetID(alt::IEntity* entity); +EXPORT_SHARED uint32_t Entity_GetID(alt::IEntity* entity); EXPORT_SHARED alt::IWorldObject* Entity_GetWorldObject(alt::IEntity* entity); EXPORT_SHARED uint32_t Entity_GetModel(alt::IEntity* entity); diff --git a/c-api/entities/local_object.cpp b/c-api/entities/local_object.cpp index 5a10968..875f609 100644 --- a/c-api/entities/local_object.cpp +++ b/c-api/entities/local_object.cpp @@ -10,7 +10,7 @@ CAPI_START() #ifdef ALT_CLIENT_API -uint16_t LocalObject_GetID(alt::ILocalObject* localObject) { +uint32_t LocalObject_GetID(alt::ILocalObject* localObject) { return localObject->GetID(); } diff --git a/c-api/entities/local_object.h b/c-api/entities/local_object.h index e7808e4..daabe33 100644 --- a/c-api/entities/local_object.h +++ b/c-api/entities/local_object.h @@ -21,7 +21,7 @@ #pragma clang diagnostic pop #endif -EXPORT_CLIENT uint16_t LocalObject_GetID(alt::ILocalObject* localObject); +EXPORT_CLIENT uint32_t LocalObject_GetID(alt::ILocalObject* localObject); EXPORT_CLIENT alt::IObject* LocalObject_GetObject(alt::ILocalObject* localObject); EXPORT_CLIENT void LocalObject_ResetAlpha(alt::ILocalObject* localObject); diff --git a/c-api/entities/object.cpp b/c-api/entities/object.cpp index 9d4aa20..adf811b 100644 --- a/c-api/entities/object.cpp +++ b/c-api/entities/object.cpp @@ -4,7 +4,7 @@ CAPI_START() -uint16_t Object_GetID(alt::IObject* object) +uint32_t Object_GetID(alt::IObject* object) { return object->GetID(); } diff --git a/c-api/entities/object.h b/c-api/entities/object.h index 79c2b0f..21999a5 100644 --- a/c-api/entities/object.h +++ b/c-api/entities/object.h @@ -14,7 +14,7 @@ #pragma clang diagnostic pop #endif -EXPORT_SHARED uint16_t Object_GetID(alt::IObject* object); +EXPORT_SHARED uint32_t Object_GetID(alt::IObject* object); EXPORT_SHARED alt::IEntity* Object_GetEntity(alt::IObject* object); EXPORT_SHARED uint8_t Object_GetAlpha(alt::IObject* object); diff --git a/c-api/entities/ped.cpp b/c-api/entities/ped.cpp index 4b9554a..5608a71 100644 --- a/c-api/entities/ped.cpp +++ b/c-api/entities/ped.cpp @@ -6,7 +6,7 @@ CAPI_START() -uint16_t Ped_GetID(alt::IPed* ped) { +uint32_t Ped_GetID(alt::IPed* ped) { return ped->GetID(); } diff --git a/c-api/entities/ped.h b/c-api/entities/ped.h index 46b0919..780267e 100644 --- a/c-api/entities/ped.h +++ b/c-api/entities/ped.h @@ -14,7 +14,7 @@ #pragma clang diagnostic pop #endif -EXPORT_SHARED uint16_t Ped_GetID(alt::IPed* ped); +EXPORT_SHARED uint32_t Ped_GetID(alt::IPed* ped); EXPORT_SHARED alt::IEntity* Ped_GetEntity(alt::IPed* ped); EXPORT_SHARED uint16_t Ped_GetHealth(alt::IPed* ped); diff --git a/c-api/entities/player.cpp b/c-api/entities/player.cpp index 52a8157..1977179 100644 --- a/c-api/entities/player.cpp +++ b/c-api/entities/player.cpp @@ -7,7 +7,7 @@ CAPI_START() -uint16_t Player_GetID(alt::IPlayer* player) { +uint32_t Player_GetID(alt::IPlayer* player) { return player->GetID(); } diff --git a/c-api/entities/player.h b/c-api/entities/player.h index d18b6d1..47e3bc8 100644 --- a/c-api/entities/player.h +++ b/c-api/entities/player.h @@ -22,7 +22,7 @@ #pragma clang diagnostic pop #endif -EXPORT_SHARED uint16_t Player_GetID(alt::IPlayer* player); +EXPORT_SHARED uint32_t Player_GetID(alt::IPlayer* player); EXPORT_SHARED alt::IEntity* Player_GetEntity(alt::IPlayer* player); EXPORT_SHARED const char* Player_GetName(alt::IPlayer* player, int32_t& size); diff --git a/c-api/entities/vehicle.cpp b/c-api/entities/vehicle.cpp index 3d9cb17..699ed4e 100644 --- a/c-api/entities/vehicle.cpp +++ b/c-api/entities/vehicle.cpp @@ -5,7 +5,7 @@ CAPI_START() -uint16_t Vehicle_GetID(alt::IVehicle* entity) { +uint32_t Vehicle_GetID(alt::IVehicle* entity) { return entity->GetID(); } @@ -32,7 +32,7 @@ alt::IPlayer* Vehicle_GetDriver(alt::IVehicle* vehicle) { return vehicle->GetDriver(); } -uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint16_t& id) { +uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint32_t& id) { auto driver = vehicle->GetDriver(); if (driver == nullptr) return false; id = driver->GetID(); diff --git a/c-api/entities/vehicle.h b/c-api/entities/vehicle.h index e0dba33..aa0d825 100644 --- a/c-api/entities/vehicle.h +++ b/c-api/entities/vehicle.h @@ -14,14 +14,14 @@ #pragma clang diagnostic pop #endif -EXPORT_SHARED uint16_t Vehicle_GetID(alt::IVehicle* vehicle); +EXPORT_SHARED uint32_t Vehicle_GetID(alt::IVehicle* vehicle); EXPORT_SHARED alt::IEntity* Vehicle_GetEntity(alt::IVehicle* vehicle); EXPORT_SHARED uint8_t Vehicle_GetWheelsCount(alt::IVehicle* vehicle); EXPORT_SHARED int32_t Vehicle_GetPetrolTankHealth(alt::IVehicle* vehicle); EXPORT_SERVER alt::IPlayer* Vehicle_GetDriver(alt::IVehicle* vehicle); -EXPORT_SERVER uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint16_t& id); +EXPORT_SERVER uint8_t Vehicle_GetDriverID(alt::IVehicle* vehicle, uint32_t& id); EXPORT_SERVER uint8_t Vehicle_IsDestroyed(alt::IVehicle* vehicle); diff --git a/c-api/func_table.cpp b/c-api/func_table.cpp index a190f7d..af46236 100644 --- a/c-api/func_table.cpp +++ b/c-api/func_table.cpp @@ -1,6 +1,6 @@ #include "func_table.h" -inline uint64_t capiHash = 14520310097856707558UL; +inline uint64_t capiHash = 4677548953854785821UL; inline uint64_t capiHashes[] = { 0, #ifdef ALT_CLIENT_API @@ -458,7 +458,7 @@ inline uint64_t capiHashes[] = { 8482470825689546294UL, 6719251755255314299UL, 15889022995396061331UL, - 11677534497960574507UL, + 15103894139399401453UL, 872653086987800810UL, 12256606847122365951UL, 9339331434227951252UL, @@ -1081,7 +1081,7 @@ inline uint64_t capiHashes[] = { 4905441971289102819UL, 17798706175912111294UL, 2095655564565809781UL, - 12913447266302910987UL, + 10233629489933073997UL, 6111944054700936115UL, 7130354370478174789UL, 10262653550309861069UL, @@ -1175,14 +1175,14 @@ inline uint64_t capiHashes[] = { 2951895109234703784UL, 4782965940294523501UL, 4934471410579771998UL, - 12916172794746864343UL, + 6815264172955104609UL, 9053583879265260950UL, 4660664364773957039UL, 4106400780828488738UL, 446737373633343515UL, 17974792644403470118UL, 7104729899977702888UL, - 4733988892192620155UL, + 8160348533631447101UL, 18375756057324289044UL, 6124580830261182834UL, 343339663996265887UL, @@ -1196,7 +1196,7 @@ inline uint64_t capiHashes[] = { 12498998920879213674UL, 17222204554789096264UL, 14695407730559477910UL, - 2649376720891219187UL, + 18416303018230933813UL, 4693803817659874615UL, 4164549052335308174UL, 10963946276172720740UL, @@ -1252,7 +1252,7 @@ inline uint64_t capiHashes[] = { 3918260719528326415UL, 2302278843105157392UL, 8318093389193375258UL, - 17687301249122992283UL, + 15007201997776333277UL, 18440829979133890169UL, 7918377113203812466UL, 6954962557541059864UL, @@ -1330,13 +1330,13 @@ inline uint64_t capiHashes[] = { 16312284234900575747UL, 14452794280175707515UL, 10333270135403224879UL, - 4559218685940666205UL, + 12057843286905322939UL, 419502286495548608UL, 12193205314801108926UL, 13972691773502904173UL, - 4124119004202747553UL, + 11709139263193592519UL, 12784287737200780200UL, - 12414549446254212526UL, + 4074854033126410216UL, 6795936790869684439UL, 5931751806478777368UL, 3581368898059030296UL, @@ -1549,7 +1549,7 @@ inline uint64_t capiHashes[] = { 1312826368700331414UL, 3655237348473428026UL, 8554773347420139463UL, - 6476166832678215577UL, + 1447949168829725163UL, 8002690258276396481UL, 4097244648501164820UL, 10761034670704244318UL,