L3uX Posted February 25, 2015 Share Posted February 25, 2015 (edited) Hey guys! Currently trying to get the player coordinates of all players online on a server. Someone got an idea how to loop through? Currently using ptr: DWORD * dwCheck = (DWORD*)(0xB74498); dwCheck = (DWORD*)*(DWORD*)(dwCheck); CPed * Players = (CPed*)dwCheck; Edited February 25, 2015 by L3uX Link to comment https://gtaforums.com/topic/769065-looping-through-cped-c/ Share on other sites More sharing options...
KELASHI Posted February 25, 2015 Share Posted February 25, 2015 Document on GTAModding: 0xB74490 - Contains a pointer to a main struct below This struct: +0 = Contains a pointer to the first element in the pool +4 = Contains a pointer to a byte map indicating which elements are in use +8 = [dword] Is the maximum number of elements in the pool +12 = [dword] Is the current number of elements in the pool template <class T>struct CPool //"main struct" mentioned above{ T *objects; //T objects[size] uint8_t *flags; //BYTE flags[size] int32_t size; //in document int32_t count; //in document bool initialized; bool f11; int16_t f12;};void loop(){ CPool<CPed> *PedPool = *(CPool<CPed> **)0xB74490; for (int i = 0; i < PedPool->size; ++i) { if (PedPool->flags[i] < 0x80) //test highest bit of a flag to know if a element used, flags[i] is the flag of objects[i] { CPed *target = PedPool->objects + i; //then you get a player pointer } }} This is a sp method, i dont know if it works on samp. Link to comment https://gtaforums.com/topic/769065-looping-through-cped-c/#findComment-1067021408 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now