Raised This Month: $ Target: $400
 0% 

[CS:GO] Changing weapon skin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
notMe2
Member
Join Date: Feb 2014
Old 04-09-2015 , 00:08   [CS:GO] Changing weapon skin
Reply With Quote #1

final results:
https://www.youtube.com/watch?v=Sb9NcwOKEGo
https://www.youtube.com/watch?v=U8fkTf8gu5w

So, first of all we need to understand what is about changing skins. When we dump the netvars from client we can see those vars:

Code:
Member: m_nFallbackPaintKit (offset 2224) (type integer) (bits 16) (Unsigned)
Member: m_nFallbackSeed (offset 2228) (type integer) (bits 10) (Unsigned)
Member: m_flFallbackWear (offset 2232) (type float) (bits 0) (NoScale)
Member: m_nFallbackStatTrak (offset 2236) (type integer) (bits 20) ()
But they are all fallbacks, otherwise, they'll be used when it fails to load the inventory from the owner.
And then we have the owner id:

Code:
Member: m_OriginalOwnerXuidLow (offset 2216) (type integer) (bits 32) ()
Member: m_OriginalOwnerXuidHigh (offset 2220) (type integer) (bits 32) ()
Basically, OwnerID is accessed when you pickup a weapon (probably to show its owner) and when the weapon is created (to set its skin) and if owner id isnt a valid id the game tries to find the entity's fall backs.

so if you just:
Code:
entity = GivePlayerItem(client, "weapon_bayonet");
SetEntProp(entity,Prop_Send,"m_OriginalOwnerXuidLow",0);
SetEntProp(entity,Prop_Send,"m_OriginalOwnerXuidHigh",0);
SetEntProp(entity,Prop_Send,"m_nFallbackPaintKit",38);
the player will recive a bayonet fade.

But what if the weapon doesn't have a skin, i mean, if you don't have any skin on a, by example, a awp, the game create the weapon with m_Item skin section stripped. And when you set OwnerID to 0 no one is the owner of the weapon, then, the fist one that pick this weapon from a drop will be set as a owner.

So we need that the weapon has a owner and create the entire m_Item even if the original weapon from player's inventory is a "vanilla" (no skin). Other ID that weapon has is the itemID, this specifies the id from the item on player's inventory, and if the item itself doesn't have a skin its just 0.

If we set the itemID to a random number, even if there is no skin on the weapon, the m_Item will be fully created:
Code:
SetEntProp(entity,Prop_Send,"m_iItemIDLow",2048);
SetEntProp(entity,Prop_Send,"m_iItemIDHigh",0);
so
Code:
entity = GivePlayerItem(client, "weapon_bayonet");
SetEntProp(entity,Prop_Send,"m_iItemIDLow",2048);
SetEntProp(entity,Prop_Send,"m_iItemIDHigh",0);

SetEntProp(entity,Prop_Send,"m_nFallbackPaintKit",38);
this will give you a bayonet fade with owner... and client side crashes xD
Nothing that couldn't be fixed, you just need to restore the previous itemID after the change

Code:
Handle pack;
entity = GivePlayerItem(client, "weapon_bayonet");

new m_iItemIDHigh = GetEntProp(entity, Prop_Send, "m_iItemIDHigh");
new m_iItemIDLow = GetEntProp(entity, Prop_Send, "m_iItemIDLow");

SetEntProp(entity,Prop_Send,"m_iItemIDLow",2048);
SetEntProp(entity,Prop_Send,"m_iItemIDHigh",0);

SetEntProp(entity,Prop_Send,"m_nFallbackPaintKit",38);

CreateDataTimer(2.0, RestoreItemID, pack);
WritePackCell(pack,entity);
WritePackCell(pack,m_iItemIDHigh);
WritePackCell(pack,m_iItemIDLow);

public Action:RestoreItemID(Handle:timer, Handle:pack)
{
    new entity;
    new m_iItemIDHigh;
    new m_iItemIDLow;
    
    ResetPack(pack);
    entity = ReadPackCell(pack);
    m_iItemIDHigh = ReadPackCell(pack);
    m_iItemIDLow = ReadPackCell(pack);
    
    
    SetEntProp(entity,Prop_Send,"m_iItemIDHigh",m_iItemIDHigh);
    SetEntProp(entity,Prop_Send,"m_iItemIDLow",m_iItemIDLow);
}
now you have you bayonet fade... wo crashes :p

General tips and links:
Skins list by nov
i nerver logged m_nFallbackSeed but its about the skin "position" or "blue % on fade" stuff
m_flFallbackWear is about the condition of the skin, 1.0 = worse possible, 0.0 = minimal wear
m_nFallbackStatTrak -1 = no stattrak, 1337 = stattrak with 1337 kills
set m_iEntityQuality to 3 on knifes to get the star (rare items icon) on the item's name.

my steam

Credits:
Me & Nov

Last edited by notMe2; 06-20-2015 at 19:13.
notMe2 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode