And there it is !!! Fully working mod for weapons. Only the weapon is modded
I used a simple PrimitiveCount feature, it means that in DrawIndexedPrimitive, when the PrimitiveCount is the same that the modding weapon, then we apply the texture.
To know these numbers, we have to log them like we would do with addies or vertice. It's quite simple, just select the gun, then press a hotkey that will show a popup in DrawIndexedPrimitive with various PrimitiveCount. Most of the times, they aren't greater than 200, so you know which one to use
Example :

So the number to keep in your code for K2 is 2034 :
Code:
int primAW50F = 3583, primMP5k = 2447, primMP7A1 = 1417, primAIAW = 2449, primK2 = 2034;
As you can see in my code, I've found Prims for AW50F, MP5k, MP7A1 and AIAW because there are some cool textures for them. Take a look at… My AW50F !

There is the code in DrawIndexedPrimitive :
Code:
if (Stride == 32)
{
// Here begins the "logging"
if (currentPrim > 0) {
char buff1[6];
sprintf(buff1,"%d",PrimitiveCount);
MessageBoxA(GetActiveWindow(),buff1,"Essai",MB_OK);
}
// Here it ends.
if (pTextureAW50F == NULL) D3DXCreateTextureFromFile(pDevice,L"C:/CT/aw50f.dds",&pTextureAW50F);
if (pTextureMP5k == NULL) D3DXCreateTextureFromFile(pDevice,L"C:/CT/2mp5.dds",&pTextureMP5k);
if (pTextureMP7A1 == NULL) D3DXCreateTextureFromFile(pDevice,L"C:/CT/mp7.dds",&pTextureMP7A1);
if (pTextureAIAW == NULL) D3DXCreateTextureFromFile(pDevice,L"C:/CT/aiaw.dds",&pTextureAIAW);
pDevice->SetRenderState(D3DRS_ZENABLE,TRUE);
if (PrimitiveCount == primAW50F) pDevice->SetTexture(0,pTextureAW50F);
else if (PrimitiveCount == primMP5k) pDevice->SetTexture(0,pTextureMP5k);
else if (PrimitiveCount == primMP7A1) pDevice->SetTexture(0,pTextureMP7A1);
else if (PrimitiveCount == primAIAW) pDevice->SetTexture(0,pTextureAIAW);
}
The green part is the path to the texture you want to apply. I put them in the "CT" directory at my hard drive root.
And you have to define the pointers for the texture, so under the int declarations :
Code:
LPDIRECT3DTEXTURE9 pTextureAW50F = NULL, pTextureMP5k = NULL, pTextureMP7A1 = NULL, pTextureAIAW = NULL;
I think that's all… If you have any questions, feel free to ask me