

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
You must be registered for see links
-> class CBaseEntity and paste the following :
Code:
NETVAR(m_nPrecipType, int, "DT_Precipitation", "m_nPrecipType")
2nd step go to
You must be registered for see links
and add a variable with the name of your choice that we will later use toggle the the weather changer. I used :
Code:
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:
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:
void Weather();
World.cpp:
Code:
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:
case FRAME_RENDER_START: {
World->Weather();
break;
}
Feel free to correct me if the post has any errors .
You must be registered for see links
Last edited by a moderator: