How to change knife model externally?

Posts 1–8 of 8 · Page 1 of 1
How to change knife model externally?
So currently I'm checking if the CurrentWeapon is 59 and if it is, I have this

Code:
DWORD ViewModelEntityIndex = Mem.Read<DWORD>(LocalPlayer + m_hViewModel) & 0xFFF;
				DWORD ViewModel = Mem.Read<DWORD>(ClientDLL + EntityList + ViewModelEntityIndex * 0x10);
				Mem.Write<DWORD>(ViewModel + m_nModelIndex, 575);
				Mem.Write<DWORD>(CurrentWeaponEntity + m_iItemDefinitionIndex, 507);
I've also tried this:
Code:
DWORD nWeaponIndex = Mem.Read<DWORD>(CurrentWeaponEntity + m_AttributeManager + m_Item + m_iItemDefinitionIndex);
				Mem.Write<DWORD>(nWeaponIndex, 507);
I've tried a few other methods as well, but can't seem to figure out how to change the actual model. This changes the icon and name to Karambit, but still holding default knife.

Any help would be much appreciated
Quote Originally Posted by legit_player View Post
You need to change nModelIndex.
So I read that it's like reading for regular weapon skins but with m_hViewModel and have this:

Code:
DWORD KnifeIndex = Mem.Read<DWORD>(LocalPlayer + m_hViewModel + ((i - 1) * 0x4)) & 0xFFF;
DWORD KnifeEntity = Mem.Read<DWORD>(ClientDLL + EntityList + (KnifeIndex - 1) * 0x10);
Mem.Write<DWORD>(KnifeEntity + m_iItemIDHigh, -1);
Then I have a check for the knife and write this:

Code:
Mem.Write<DWORD>(KnifeEntity + m_nModelIndex, 320);
Mem.Write<DWORD>(CurrentWeaponEntity + m_iItemDefinitionIndex, 500);
Mem.Write<DWORD>(pointer + 0x16C, -1);
This changes the icon and name in the bottom right just fine, but doesn't change the model at all. and usually crashes my game.

- - - Updated - - -

Ok, I can get the karambit, but as soon as i switch weapons and switch back, it goes back to default.

I have the same code from the above post, but changed those bottom 3 lines to this:

Code:
Mem.Write<DWORD>(KnifeEntity + m_nModelIndex, 586);
Mem.Write<DWORD>(KnifeEntity + m_iWorldModelIndex, 587);
Mem.Write<DWORD>(pointer + 0x16C, -1);
This tends to crash my game while i'm trying to set the knife. I have it set to run when i press a key, and I have to press it a bunch of times before it finally sets the knife. Then when i change weapons it sets it back to default knife but with the paintkit i had set on the karambit.
You would really want to make it internally, I know you'd need to learn a bit about internals but trust me in that it will be a lot easier in the long run!

The knife resets every time because that's the knife you actaully own. If the game thinks you own a default knife then thats what it will give you. To fix that issue, you'd have to loop and check if the user is holding there knife out. And if they are then set the knife to the custom one.
Code:
int tmodel;
int ctmodel;

if (currentweaponid == tknife) {
tmodel = readcurrentmodel();
setknife(your kewl knife); //set the itemdefinitionindex and stuff
setmodel(your kewl knife);
}

if (currentweaponid == ctknife) {
ctmodel = readcurrentmodel();
setknife(your kewl knife); //set the itemdefinitionindex and stuff
setmodel(your kewl knife);
}

if (readcurrentmodel() == ctmodel || readcurrentmodel() == tmodel)
setmodel(your kewl knife);
Quote Originally Posted by voziak View Post
Code:
int tmodel;
int ctmodel;

if (currentweaponid == tknife) {
tmodel = readcurrentmodel();
setknife(your kewl knife); //set the itemdefinitionindex and stuff
setmodel(your kewl knife);
}

if (currentweaponid == ctknife) {
ctmodel = readcurrentmodel();
setknife(your kewl knife); //set the itemdefinitionindex and stuff
setmodel(your kewl knife);
}

if (readcurrentmodel() == ctmodel || readcurrentmodel() == tmodel)
setmodel(your kewl knife);

This doesn't really help me since I'm not sure what's wrong with my code. I don't know if I'm force updating incorrectly or writing the wrong values or what.

Code:
DWORD KnifeIndex = Mem.Read<DWORD>(LocalPlayer + m_hViewModel + ((i - 1) * 0x4)) & 0xFFF;
DWORD KnifeEntity = Mem.Read<DWORD>(ClientDLL + EntityList + (KnifeIndex - 1) * 0x10);
Mem.Write<DWORD>(KnifeEntity + m_iItemIDHigh, -1);

DWORD LocalPlayer = Mem.Read<DWORD>(ClientDLL + oLocalPlayer);
DWORD ActiveWeapon = Mem.Read<DWORD>(LocalPlayer + m_hMyWeapons);
for (int i = 0; i < 64; i++)
{
    DWORD CurrentWeaponIndex = Mem.Read<DWORD>(LocalPlayer + m_hMyWeapons + ((i - 1) * 0x4)) & 0xFFF;
    DWORD CurrentWeaponEntity = Mem.Read<DWORD>(ClientDLL + EntityList + (CurrentWeaponIndex - 1) * 0x10);
    DWORD MyXuid = Mem.Read<DWORD>(CurrentWeaponEntity + m_OriginalOwnerXuidLow);
 
    Mem.Write<DWORD>(CurrentWeaponEntity + m_iItemIDHigh, -1);
    DWORD myWeaponID = Mem.Read<DWORD>(CurrentWeaponEntity + m_iItemDefinitionIndex);
    DWORD paintkit = Mem.Read<DWORD>(CurrentWeaponEntity + m_nFallbackPaintKit);
    DWORD pointer = Mem.Read<DWORD>(EngineDLL + m_dwClientState);
    DWORD nWeaponIndex = Mem.Read<DWORD>(CurrentWeaponEntity + m_AttributeManager + m_Item + m_iItemDefinitionIndex);
 
    DWORD KnifeIndex = Mem.Read<DWORD>(LocalPlayer + m_hViewModel + ((i - 1) * 0x4)) & 0xFFF;
    DWORD KnifeEntity = Mem.Read<DWORD>(ClientDLL + EntityList + (KnifeIndex - 1) * 0x10);
    Mem.Write<DWORD>(KnifeEntity + m_iItemIDHigh, -1);
    DWORD knifeID = Mem.Read<DWORD>(KnifeEntity + m_iItemDefinitionIndex);
 
    if (myWeaponID == 0)
        continue;
    if (myWeaponID == WEAPON_KNIFE_T)
    {
        Mem.WriteDWORD(KnifeEntity + m_nModelIndex, 586); // 586/587 values for Karambit on Cache
        Mem.WriteDWORD(KnifeEntity + m_iWorldModelIndex, 587);
        Mem.WriteDWORD(CurrentWeaponEntity + m_iItemDefinitionIndex, WEAPON_KNIFE_KARAMBIT);
        Mem.WriteDWORD(CurrentWeaponEntity + m_nFallbackPaintKit, 38); // Fade for karambit
        Mem.WriteDWORD(pointer + 0x16C, -1)
    }
}
@AbsoluteMadman

the model resets after you switch weapons but the knife WeaponID stays the same (WEAPON_KNIFE_KARAMBIT)

add this

Code:
    if (myWeaponID == WEAPON_KNIFE_KARAMBIT)
    {
        Mem.WriteDWORD(KnifeEntity + m_nModelIndex, 586); // 586/587 values for Karambit on Cache
    }
Been over a week since last update/bump after answers, assuming solved.

/Closed.
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us