iseekwonderful / csgoGlow

Simple macOS CSGO glow hack
111 stars 66 forks source link

GameResources / ScoreboardBase #148

Closed sacredgeo closed 7 years ago

sacredgeo commented 8 years ago

Check out this thread: http://www.unknowncheats.me/forum/counterstrike-global-offensive/138066-scoreboards-beauty.html

Using Bit Slicer, I was able to find the memory addresses for score, kills, assists, deaths, health, armor, etc, for all players on the server. I want to find the offset for the scoreboard. I found the general area in memory viewer and did a byte array search. I found a few offsets for client.dylib. These include:

base("/client.dylib") + 0x50E2310 base("/client.dylib") + 0x5159808 base("/client.dylib") + 0x5199400

I'm not sure which one (if any) is correct. I'm also having a hard time figuring out how to find the score info based on that offset. My idea is to add some code to the hack to show which enemy player has the highest score. I'd probably just change the glow color. Then you could either seek him out or avoid him. It's not an important feature by any means, but I thought it would be fun.

I understand I'll have to find all the scores and compare them. The hard part is finding the scores based on the client.dylib offset. Can you give me any advice? Thank you.

extrenebiibues commented 7 years ago

this would be a good idea like blue base colour (Before being shot) if they are in the top 3 or top fragger

sacredgeo commented 7 years ago

If I find the address for my kills and subtract 0x1288 and find pointers to that address it returns the first two offsets listed above. I believe that is the start of the scoreboard.

I'm still doing testing. I've got it partially working. Using the code below:

uint64_t scoreBase          = 0x50E2310;

uint64_t scoreAddress;
Utils::ReadMemAndDeAllocate(csgo, current_task(), clientBase + scoreBase, &scoreAddress);
Utils::ReadMemAndDeAllocate(csgo, current_task(), scoreAddress + 0x1288, &ikills);
printf("My kills: %i\n", ikills);

Returns this in terminal: My kills: 16

So now I'm successfully able to read the scoreboard.

Starting at scoreAddress + 0x1288, every 4 bytes refers to another player's kill count. I believe they are in the order of when the player joined the game. The scoreboardBase contains the team number at scoreAddress + 0x15D8.

I believe the next step is to put all the scores in an array then compare them. I'd appreciate any input.

aKalisch commented 7 years ago

Why don't you just start a bot game. So you are Player 0 (entitylist + (0x20 * 0)).

Kill a Bot and search for 1 in Bit Slicer ... repeat theses steps until there are just a few results left. I'll investigate to it when I'm at home (working right now).

Also for Bot Games you can look into Wiki in the https://github.com/iseekwonderful/csgoGlow/wiki/Guides----Get-SetViewAngle-memory-address. Published a config for a never ending Bot game :-)

sacredgeo commented 7 years ago

Thank you for the reply. I've been trying with bots mostly, but also in other servers. I'm getting very close. It works at first. All the players start green, and when one gets a higher kill count he turns pink. It seems to be working, but then I notice other enemy players also turning pink as they get kills. Here's my code:

int highscore = 0;

for (int i = 0; i < 60; i++) {
    int playerTeamNum;

    //excess code removed for this post

    int playerKills;

    Utils::ReadMemAndDeAllocate(task, current_task(), imgbase + scoreBase, &scoreAddress);
    Utils::ReadMemAndDeAllocate(task, current_task(), scoreAddress + 0x1288 + 0x4 * i, &playerKills);

    if(highscore < playerKills){
            highscore = playerKills;
            Color color = {(255 / 255), (0 / 255), (255 / 255), 0.55f};
            applyGlowEffect(task, startAddress, glowIndex, color);

        }else{
            Color color = {float((100 - health) / 100.0), float((health) / 100.0), 0.0f, 0.55f};
            applyGlowEffect(task, startAddress, glowIndex, color);
        }
    }
}

The problem has to be with the way I'm determining the highest score. I'll admit I haven't done any programming in several years so I'm very rusty.

Also, that's a nice sever config. I've been typing all that by hand every time. You should add "bot_chatter off" so they stop doing radio commands nonstop.

aKalisch commented 7 years ago

@sacredgeo Yes sure they get all pink... because highscore is a global variable.

    if(highscore < playerKills){
        highscore = playerKills;
        Color color = {(255 / 255), (0 / 255), (255 / 255), 0.55f};
        applyGlowEffect(task, startAddress, glowIndex, color);

    }else{
        Color color = {float((100 - health) / 100.0), float((health) / 100.0), 0.0f, 0.55f};
        applyGlowEffect(task, startAddress, glowIndex, color);
    }

you should change the code to:

    Color color = {float((100 - health) / 100.0), float((health) / 100.0), 0.0f, 0.55f};
    if(myKills < playerKills) { // you need to read your own kills also
        color = {(255 / 255), (0 / 255), (255 / 255), 0.55f};
    }
   applyGlowEffect(task, startAddress, glowIndex, color);
sacredgeo commented 7 years ago

Thanks again for the reply. Why read my own kills? In your code there is an "if statement" that skips the loop if the player is on the same team. I'm sorry for the confusion, but I removed that code from my post so it wouldn't be so large. I'm just looking at enemy kills. My goal is to highlight which enemy player has the most kills.

How can I fix the highscore variable? I'm afraid to put it in the loop.

aKalisch commented 7 years ago

Ahhh you want to color the player with the highest kill count on enemy team...

int highestScorePlayer;
int highscore = 0;
if(highscore < playerKills || highestScorePlayer == i)
{
    highestScorePlayer = i;
    highscore = playerKills;
    // do some magic
}

Pseudo code. But should work.

sacredgeo commented 7 years ago

I'm going to test it now.

I'm just concerned because the "highscore = 0" is contained within your loop:

    for (int i = 0; i < 60; i++) {

Won't it keep resetting to zero? Anyway I'll test it now. Thanks for your help!

aKalisch commented 7 years ago

Have a look at the last sentence. This is PSEUDO CODE!

sacredgeo commented 7 years ago

Ah I didn't notice that. I see what you're getting at with the code. I'm working on it now.

sacredgeo commented 7 years ago

I got it working. I feel like I'm doing it rather inefficiently, but it's working for now.

I gave the best enemy player this color scheme, which goes from blue -> purple -> pink as they lose health:

Color color = {float((100 - health) / 100.0), (0 / 255), float((health) / 100.0), 0.50f};

It even works if they take over a bot.

bertrand2012 commented 7 years ago

@sacredgeo I like the idea i just want to add my own touch onto it so it suits me. Also where do I find the code?

sacredgeo commented 7 years ago

Leave me your email and I'll send it. It's too large to post here.

aKalisch commented 7 years ago

Why don't you just create a gist out of it?

sacredgeo commented 7 years ago

Done! https://github.com/sacredgeo/csgoGlow

I left several comments in the code, explaining what each new part does.

@aKalisch This code works, but if you can improve it, please let me know. I'm a terrible programmer.

@acer2245 What changes are you thinking about making?

bertrand2012 commented 7 years ago

@sacredgeo oh only small changes like the colour not being a whole new colour but maybe a darker green or something like that. It was only an idea but im definitely going to give yours a run. Thanks for implementing this btw.

sacredgeo commented 7 years ago

@acer2245 Have fun with it. I thought a long time about what color to make them. I like it being a gradient that changes with the health. Experiment with it and let me know what you come up with.

No need to thank me. It was only possible due to aKlisch, gabsens and iseekwonderful.

iPredictable commented 7 years ago

@sacredgeo can u post the full code bro?

bertrand2012 commented 7 years ago

@PredictEr https://github.com/sacredgeo/csgoGlow