Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //by gopro_2027
- //On console, the structure format is like:
- #define nearbyPedArraySize 100
- struct nearbyEnts {
- int size;//32 bit integer
- int entities[nearbyPedArraySize];
- };
- //on pc it's the same but with int64_t for the entities:
- struct nearbyEnts {
- int size;//still 32 bit integer
- int64_t entities[nearbyPedArraySize];
- };
- //heres an example of it:
- void deletePed(int pedID) {
- //do something with pedID
- int ped = pedID;
- ENTITY::DELETE_ENTITY(&ped);
- }
- void runOnAllNearbyPedsToPlayer(int player, void (*f)(int)) {
- nearbyEnts arr;
- arr.size = nearbyPedArraySize;
- int ped = PLAYER::GET_PLAYER_PED(player);
- int size = PED::GET_PED_NEARBY_PEDS(ped,(int*)&arr,ped);
- for (int i = 0; i < size; i++) {
- f(arr.entities[i]);
- }
- }
- //then call
- runOnAllNearbyPedsToPlayer(PLAYER::PLAYER_ID(),deletePed);
- //Note: I have not tested the pc version because I do not play on pc but based on the old code that was posted in the documentation, this should work on pc also.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement