Welcome to hackvshack.net Forum!
Download Free HvH CS2/CS:GO Cheats, CFG, LUA/JS Scripts, and More!
Register

C++ Function Rain weather changer spoonfed for arctictech

cacaomelio

Expert HvHer
User ID:
108870
Messages:
118
Reactions:
192
Badges:
16
REP:
−0/1+
Level:
126
1772237254478.png1772237291250.png

By following this simple tutorial you will have rain weather changer just like in the tutorial. Sorry for any spelling or naming error , english is not my natal language

1st step go to -> class CBaseEntity and paste the following :
Code:
Expand Collapse Copy
NETVAR(m_nPrecipType, int, "DT_Precipitation", "m_nPrecipType")

2nd step go to and add a variable with the name of your choice that we will later use toggle the the weather changer. I used :
Code:
Expand Collapse Copy
CCheckBox* weather;

3rd step add your menu checkbox ( I personally dont think this needs code drop but I will do it for peaople who don't know what they be doing)
Code:
Expand Collapse Copy
config.visuals.effects.weather = effects->AddCheckBox("Enable rain");

4th step go to World.cpp / World.h and paste the following code :

World.h -> inside class CWorld :
Code:
Expand Collapse Copy
void Weather();

World.cpp:
Code:
Expand Collapse Copy
void CWorld::Weather() { //can also use 0 for heavy rain
    if (!Cheat.InGame)
        return;

    static ClientClass* precip_class = nullptr;
    if (!precip_class) {
        for (auto cc = Client->GetAllClasses(); cc; cc = cc->m_pNext) {
            if (strstr(cc->m_pNetworkName, "CPrecipitation")) {
                precip_class = cc;
                break;
            }
        }
    }

    if (!precip_class || !precip_class->m_pCreateFn)
        return;

    static CBaseEntity* rain_entity = nullptr;
    bool enable_rain = config.visuals.effects.weather->get();

    bool exists = false;
    for (int i = 0; i <= EntityList->GetHighestEntityIndex(); i++) {
        auto ent = EntityList->GetClientEntity(i);
        if (!ent) continue;

        auto cc = ent->GetClientClass();
        if (cc && strstr(cc->m_pNetworkName, "CPrecipitation")) {
            exists = true;
            rain_entity = ent;
            break;
        }
    }

    if (enable_rain) {
        if (!exists) {
            IClientNetworkable* networkable = precip_class->m_pCreateFn(2048 - 1, 0);
            if (networkable) {
                rain_entity = (CBaseEntity*)networkable->GetIClientUnknown()->GetBaseEntity();
                if (rain_entity) {
                    rain_entity->m_nPrecipType() = 1;
                    rain_entity->GetCollideable()->OBBMins() = Vector(-32767.f, -32767.f, -32767.f);
                    rain_entity->GetCollideable()->OBBMaxs() = Vector(32767.f, 32767.f, 32767.f);

                    networkable->PreDataUpdate(0);
                    networkable->OnDataChanged(0);
                    networkable->PostDataUpdate(0);
                }
            }
        }
        else if (rain_entity) {
            rain_entity->m_nPrecipType() = 1; 
        }
    }
    else {
        if (exists && rain_entity) {
            rain_entity->m_nPrecipType() = -1; // -1 kills the precipitation rendering
        }
    }
}


5th step (the last one) . we call the new function in hkFrameStageNotify hook
Code:
Expand Collapse Copy
case FRAME_RENDER_START: {
World->Weather();
    break;
}

Feel free to correct me if the post has any errors .

 
Last edited by a moderator:

Who has read this thread (Total: 0) in last 1 hours View details