public static void KnifeChangerThread() { bool shouldReloadModelIndex = true; RuntimeGlobals.selectedKnifeModelIndex = 0; int selectedKnifeIndex = 0; while (true) { if (!Globals.KnifeChangerEnabled) { Thread.Sleep(Globals.IdleWait); shouldReloadModelIndex = true; continue; } if (!EngineDLL.InGame) { Thread.Sleep(Globals.IdleWait); shouldReloadModelIndex = true; continue; } if (shouldReloadModelIndex || selectedKnifeIndex != (int)Constants.KnifeList[Globals.SelectedKnife].itemDefinitionIndex) { RuntimeGlobals.selectedKnifeModelIndex = EngineDLL.GetModelIndexByName(Constants.KnifeList[Globals.SelectedKnife].modelName); selectedKnifeIndex = (int)Constants.KnifeList[Globals.SelectedKnife].itemDefinitionIndex; shouldReloadModelIndex = false; } for (var i = 0; i < 12; i++) { CBaseCombatWeapon currentWeapon = weaponList[i]; if (currentWeapon.IsKnife()) { currentWeapon.ItemDefinitionIndex = (int)Constants.KnifeList[Globals.SelectedKnife].itemDefinitionIndex; currentWeapon.EntityQuality = 3; currentWeapon.ModelIndex = RuntimeGlobals.selectedKnifeModelIndex; currentWeapon.ViewModelIndex = RuntimeGlobals.selectedKnifeModelIndex; } } for (int i = 0; i < 10; i++) //Seems to be making it more stable { if (weaponList.ActiveWeapon.IsKnife()) { weaponList.ActiveWeapon.ViewModelEntityModelIndex = RuntimeGlobals.selectedKnifeModelIndex; } } Thread.Sleep(Globals.UsageDelay); } }
public static void SkinChangerThread() { int lastLoadedModelIndexForSkin = 0; while (true) { if (!Globals.SkinChangerEnabled) { Thread.Sleep(Globals.IdleWait); continue; } if (!EngineDLL.InGame) { Thread.Sleep(Globals.IdleWait); continue; } bool anythingChanged = false; for (var i = 0; i < 8; i++) { CBaseCombatWeapon currentWeapon = weaponList[i]; bool contin = false; Skin selected = null; try { foreach (Skin s in Globals.LoadedPresets) { if (Convert.ToInt32(s.WeaponID) == currentWeapon.ItemDefinitionIndex) { contin = true; selected = s; break; } } } catch { continue; } if (!contin) { continue; } if (currentWeapon.IsKnife()) { if (selected.WeaponID == (int)Constants.KnifeList[Globals.SelectedKnife].itemDefinitionIndex) { if ((currentWeapon.PaintKit != selected.PaintKit || lastLoadedModelIndexForSkin != RuntimeGlobals.selectedKnifeModelIndex)) { currentWeapon.ItemIDHigh = -1; currentWeapon.PaintKit = selected.PaintKit; currentWeapon.Wear = 0.0001f; lastLoadedModelIndexForSkin = RuntimeGlobals.selectedKnifeModelIndex; if (!Globals.ManualLoadEnabled) { EngineDLL.ForceReload = -1; } anythingChanged = true; } } continue; } if (currentWeapon.PaintKit != selected.PaintKit && currentWeapon.ItemDefinitionIndex == selected.WeaponID) { currentWeapon.ItemIDHigh = -1; currentWeapon.PaintKit = selected.PaintKit; if (selected.Seed != -1) { currentWeapon.Seed = selected.Seed; } currentWeapon.Wear = selected.Wear; currentWeapon.AccountID = currentWeapon.XuIDLow; if (selected.CustomName != null && selected.CustomName != "") { currentWeapon.CustomName = selected.CustomName; } if (!Globals.ManualLoadEnabled) { EngineDLL.ForceReload = -1; } anythingChanged = true; } } if (Globals.ManualLoadEnabled && (GetAsyncKeyState((int)Keys.P) & 0x8000) > 0) { EngineDLL.ForceReload = -1; } Thread.Sleep(TimeSpan.FromMilliseconds(0.1)); } }