So for my aimbot i wanted to add a new method of aiming which was to aim at the closest player. Here is my function to calculate the closest player but it isn't returning the closest player just another player. Here is my function:
You never initialize the values of 'enemies' before the loop so the test is redundant and would depend on the state of the memory before you allocated it.
Secondly I'd just declare a function to find the distance between two players, it'll be much easier in the long run to read and maintain.
Something like that. I'm at work so I can't do much.
Thx for ur reply @Jason I will try out ur advice and report back. Ur method seems a lot more efficient than mine. Thx a bunch I appreciate it.
don't square root the distance, saves some processing time and therefor makes the aimbot faster
I have edited your code to work for my case since the game was crashing and it works great thanks. But my problem now is that it's slow. Like after i kill a player then it will automatically go to the next player but it takes like 4 seconds to get to the next player. Here is my code:
---------- Post added at 09:01 PM ---------- Previous post was at 08:47 PM ----------
EDIT:
NEVER MIND, I just put in a check to make sure that the player isn't dead and now it works. Now i just gotta make a visibility check lol. Thx guys.
Originally Posted by 258456
I have edited your code to work for my case since the game was crashing and it works great thanks. But my problem now is that it's slow. Like after i kill a player then it will automatically go to the next player but it takes like 4 seconds to get to the next player. Here is my code:
---------- Post added at 09:01 PM ---------- Previous post was at 08:47 PM ----------
EDIT:
NEVER MIND, I just put in a check to make sure that the player isn't dead and now it works. Now i just gotta make a visibility check lol. Thx guys.
Do your NULL check on yourself (pMe) before the loop, no point in looping 16 times if your pointer is NULL the whole time. Also, as you're no longer returning a PlayerTable pointer (for whatever reason, I can't really figure out why you'd just return the index...), you don't need the pCurrent variable as you never do anything with the it.
Also, where are xD, yD and zD declared? Surely not as globals?
Originally Posted by Jason
Do your NULL check on yourself (pMe) before the loop, no point in looping 16 times if your pointer is NULL the whole time. Also, as you're no longer returning a PlayerTable pointer (for whatever reason, I can't really figure out why you'd just return the index...), you don't need the pCurrent variable as you never do anything with the it.
Also, where are xD, yD and zD declared? Surely not as globals?
Well for the way i am using the function i use the index not the position. And the floats aren't global it just got erased when i was pasting it on here. Thanks for your help @Jason i appreciate it.