❓ Knife changer infos

Posts 1–15 of 49 · Page 1 of 4
❓ Knife changer infos
Hey,

Few days ago, i asked some infos about skin changing and today, it's working perfectly so thanks u a lot legit_player, rwby and viking911.
Today, i need some help to know what i need to read/write to add a basic external skin changer so can you help me please?

Thanks you MPGH Community !
Quote Originally Posted by Background View Post
Hey,

Few days ago, i asked some infos about skin changing and today, it's working perfectly so thanks u a lot legit_player, rwby and viking911.
Today, i need some help to know what i need to read/write to add a basic external skin changer so can you help me please?

Thanks you MPGH Community !
If you mean knife changer, unfortunately i dont know how to do it externally but you can achieve knife changer internally by doing recvprop hook.
Thanks u rwby, unfortunately i don't know anything about internal so i'll not do anything on it, i'll continue to learn external to help back the community
Quote Originally Posted by Background View Post
Thanks u rwby, unfortunately i don't know anything about internal so i'll not do anything on it, i'll continue to learn external to help back the community
Internal isnt that hard to learn. If you are interested in a proper Internal knife changer ill get you started.

Code:
void RecvProxy_Viewmodel(const CRecvProxyData* pData, void* pStruct, void* pOut)
{
	int iModel = pData->m_Value.m_Int;

	int cCTDefault = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_default_ct.mdl");
	int cBayonet = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
	int cGut = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
	int cTDefault = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_default_t.mdl");
	int cButterfly = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
	int cGunGame = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_gg.mdl");
	int cFlip = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
	int cM9Bayonet = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
	int cFalchion = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
	int cKarambit = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
	int cDagger = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_push.mdl");
	int cHuntsman = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");

	C_BaseEntity *localPlayer = (C_BaseEntity*)MPGHContribV2.m_pEntlist->GetClientEntity(MPGHContribV2.m_pEngine->GetLocalPlayer());
	if (localPlayer)
	{
		if (MPGHContribV2.m_pEntity->GetBaseCombatWeapon(localPlayer))
		{
			if (iModel == cBayonet
				|| iModel == cButterfly
				|| iModel == cCTDefault
				|| iModel == cTDefault
				|| iModel == cFlip
				|| iModel == cGunGame
				|| iModel == cGut
				|| iModel == cKarambit
				|| iModel == cM9Bayonet
				|| iModel == cHuntsman
				|| iModel == cFalchion)
			{
				//int iKnife = MPGHContribV2.m_pConvars->flknife;

				if (CMDMPGH->getValue("bayonet") == 1)
				{
					iModel = cBayonet;
				}
				else if (CMDMPGH->getValue("flip") == 1)
				{
					iModel = cFlip;
				}
				else if (CMDMPGH->getValue("gut") == 1)
				{
					iModel = cGut;
				}
				else if (CMDMPGH->getValue("karambit") == 1)
				{
					iModel = cKarambit;
				}
				else if (CMDMPGH->getValue("m9bayonet") == 1)
				{
					iModel = cM9Bayonet;
				}
				else if (CMDMPGH->getValue("huntsman") == 1)
				{
					iModel = cHuntsman;
				}
				else if (CMDMPGH->getValue("butterfly") == 1)
				{
					iModel = cButterfly;
				}
				else if (CMDMPGH->getValue("falchion") == 1)
				{
					iModel = cFalchion;
				}
				else if (CMDMPGH->getValue("dagger") == 1)
				{
					iModel = cDagger;
				}
			}
		}
	}

	*(int*)pOut = iModel;
}
After you have your recvprop hook you need to hook it.

Code:
MPGHContribV2.m_pNetVars->HookProp("DT_BaseViewModel", "m_nModelIndex", RecvProxy_Viewmodel);
This wont help you externally in anyway possible but if you decide to take a stab at internal this will help lead you in the right direction.
Quote Originally Posted by 4nuoFZf9aE View Post
Internal isnt that hard to learn. If you are interested in a proper Internal knife changer ill get you started.

Code:
void RecvProxy_Viewmodel(const CRecvProxyData* pData, void* pStruct, void* pOut)
{
	int iModel = pData->m_Value.m_Int;

	int cCTDefault = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_default_ct.mdl");
	int cBayonet = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
	int cGut = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
	int cTDefault = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_default_t.mdl");
	int cButterfly = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
	int cGunGame = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_gg.mdl");
	int cFlip = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
	int cM9Bayonet = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
	int cFalchion = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
	int cKarambit = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
	int cDagger = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_push.mdl");
	int cHuntsman = MPGHContribV2.m_pModelinfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");

	C_BaseEntity *localPlayer = (C_BaseEntity*)MPGHContribV2.m_pEntlist->GetClientEntity(MPGHContribV2.m_pEngine->GetLocalPlayer());
	if (localPlayer)
	{
		if (MPGHContribV2.m_pEntity->GetBaseCombatWeapon(localPlayer))
		{
			if (iModel == cBayonet
				|| iModel == cButterfly
				|| iModel == cCTDefault
				|| iModel == cTDefault
				|| iModel == cFlip
				|| iModel == cGunGame
				|| iModel == cGut
				|| iModel == cKarambit
				|| iModel == cM9Bayonet
				|| iModel == cHuntsman
				|| iModel == cFalchion)
			{
				//int iKnife = MPGHContribV2.m_pConvars->flknife;

				if (CMDMPGH->getValue("bayonet") == 1)
				{
					iModel = cBayonet;
				}
				else if (CMDMPGH->getValue("flip") == 1)
				{
					iModel = cFlip;
				}
				else if (CMDMPGH->getValue("gut") == 1)
				{
					iModel = cGut;
				}
				else if (CMDMPGH->getValue("karambit") == 1)
				{
					iModel = cKarambit;
				}
				else if (CMDMPGH->getValue("m9bayonet") == 1)
				{
					iModel = cM9Bayonet;
				}
				else if (CMDMPGH->getValue("huntsman") == 1)
				{
					iModel = cHuntsman;
				}
				else if (CMDMPGH->getValue("butterfly") == 1)
				{
					iModel = cButterfly;
				}
				else if (CMDMPGH->getValue("falchion") == 1)
				{
					iModel = cFalchion;
				}
				else if (CMDMPGH->getValue("dagger") == 1)
				{
					iModel = cDagger;
				}
			}
		}
	}

	*(int*)pOut = iModel;
}
After you have your recvprop hook you need to hook it.

Code:
MPGHContribV2.m_pNetVars->HookProp("DT_BaseViewModel", "m_nModelIndex", RecvProxy_Viewmodel);
This wont help you externally in anyway possible but if you decide to take a stab at internal this will help lead you in the right direction.
Can you show this?
MPGHContribV2.m_pModelinfo->GetModelIndex
Also
m_pNetVars->HookProp("DT_BaseViewModel", "m_nModelIndex".....)

You get the nModelIndex from weaponBase or from playerBase? or client/engine dll?
Quote Originally Posted by PhY'z View Post
Can you show this?
MPGHContribV2.m_pModelinfo->GetModelIndex
Also
m_pNetVars->HookProp("DT_BaseViewModel", "m_nModelIndex".....)

You get the nModelIndex from weaponBase or from playerBase? or client/engine dll?
Look in the recv hook i go ahead and grab the BaseCombatWeapon of the local player. IModel is being grabbed from pData->m_Value.m_int
Quote Originally Posted by 4nuoFZf9aE View Post
Look in the recv hook i go ahead and grab the BaseCombatWeapon of the local player. IModel is being grabbed from pData->m_Value.m_int
IModel != nModelIndex if i'm not so wrong, let me re-make the question, the NetVar->HookProp, get the netvar nModelIndex, and you write to it setting a new number, so that make the Knife Model change, my question is, this netvar, come from where? ("DT_BaseViewModel", k i know that...) I mean, you "find that netvar" inside the weaponbase? if no, where?

Also what the pData->m_Value means, "pData" means? PlayerData?
No problem man currently there is no public method for changing knife externaly.
There is a way to do it externally.
However, as far as i know. The game won't detect your normal knife if you are making Mem.Write<int>(Weapondata + m_Attri + m_item + m_itemdef);
so... that's useless.
But i wen't thru the netvars and saw "m_nModelIndex" which has the offset of "0x254".
I well post back result if i manage to make a knife changer.

Also, you should write the knife viewmodel & worldmodels.

See this pic.
The current knife is actually 42 <--- which should be ct i believe.

so... Mem.Write<int>(Weapondata + m_Attri + m_item + m_itemdef, 507); makes it useless.
Credits to: shadiku for pic.
Greetings,

Searching through the forums, I read somewhere that External Knifechanger is significantly harder, because you have to change the model right before it draws, and that caused several users to have flikering knives or their normal knife model.

That's just from reading on the forum, hopefully you find a way that suits you
Quote Originally Posted by Aegisreaper View Post
Greetings,

Searching through the forums, I read somewhere that External Knifechanger is significantly harder, because you have to change the model right before it draws, and that caused several users to have flikering knives or their normal knife model.

That's just from reading on the forum, hopefully you find a way that suits you
Interesting...
so, if the active weapon is 42 [CT Knife],
you should set it to karambit (for example)
then make a check for karambit aswell

let me show u what i mean.
Code:
if(Weapon == 42) {
 Mem.Write<int>(WeaponData + Attri + Item + ItemDef, 507);
}
if(Weapon == 507) {
// Do iViewModel
// Do WorldModel
}
or
Code:
if(Weapon == 42 || Weapon == 507) {
 Mem.Write<int>(WeaponData + Attri + Item + ItemDef, 507);
// Do iViewModel
// Do WorldModel
}
EDIT: i do now see bot's using custom knifes.
But not the local player.
Quote Originally Posted by viking911 View Post
Interesting...
so, if the active weapon is 42 [CT Knife],
you should set it to karambit (for example)
then make a check for karambit aswell

let me show u what i mean.
Code:
if(Weapon == 42) {
 Mem.Write<int>(WeaponData + Attri + Item + ItemDef, 507);
}
if(Weapon == 507) {
// Do iViewModel
// Do WorldModel
}
or
Code:
if(Weapon == 42 || Weapon == 507) {
 Mem.Write<int>(WeaponData + Attri + Item + ItemDef, 507);
// Do iViewModel
// Do WorldModel
}
EDIT: i do now see bot's using custom knifes.
But not the local player.
EDIT: You need to write to modelindex and itll change the model.
Quote Originally Posted by 4nuoFZf9aE View Post
EDIT: You need to write to modelindex and itll change the model.
Yes, correct, its what i said, but i asked from where nModelIndex come, like PlayerBase, Client.dll, Engine.dll, WeaponBase, but i got no reply from you
Quote Originally Posted by PhY'z View Post
Yes, correct, its what i said, but i asked from where nModelIndex come, like PlayerBase, Client.dll, Engine.dll, WeaponBase, but i got no reply from you
Well it came from DT_BaseViewModel, anyways i was trying to do it earlier but even if you wrote to modelindex it wont work online.
Good job viking! When i Will be at home i will look at it.
Posts 1–15 of 49 · Page 1 of 4
This thread is closed for replies.

Similar Threads

Talk with us