The_Belch

Advanced Visuals

Jul 21st, 2019
1,104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.22 KB | None | 0 0
  1. local showMenu = gui.Checkbox(gui.Reference("VISUALS", "MISC", "Yourself Extra"), "rab_advanced_chams_menu", "Show Advanced Chroma Menu", false)
  2. local mainWindow = gui.Window("rab_advanced_chams", "Advanced Chroma", 200, 200, 682, 700);
  3. local chamsgroup = gui.Groupbox(mainWindow, "Settings", 13, 13, 655, 620);
  4. local masterSwitch = gui.Checkbox(chamsgroup, "rab_advanced_chams_masterswitch", "Master Switch", false);
  5. local menuPressed = 1;
  6. local checkboxVarNames = { "rab_pmodal_masterswitch", "rab_hands_masterswitch", "rab_weapons_masterswitch", "rab_ghost_masterswitch", "rab_glow_masterswitch", "rab_crosshair_masterswitch" };
  7. local comboBoxVarNames = { "rab_select_mod_playermodal", "rab_select_mod_hands", "rab_select_mod_weapons", "rab_select_mod_ghost", "rab_select_mod_glow", "rab_select_mod_crosshair" };
  8. local editboxVarNames = { "rab_pmodal_hex_input", "rab_hands_hex_input", "rab_weapons_hex_input", "rab_ghost_hex_input", "rab_glow_hex_input", "rab_crosshair_hex_input" };
  9. local chromaSpeedVarNames = { "rab_pmodal_chroma_speed", "rab_hands_chroma_speed", "rab_weapons_chroma_speed", "rab_ghost_chroma_speed", "rab_glow_chroma_speed", "rab_crosshair_chroma_speed" };
  10. local alphaVarNames = { "rab_chams_alpha_playermodal", "rab_chams_alpha_hands", "rab_chams_alpha_weapons", "rab_chams_alpha_ghost", "rab_chams_alpha_glow", "rab_chams_alpha_crosshair" };
  11. local enablePulsatingVarNames = { "rab_pmodal_pulsating_masterswitch", "rab_hands_pulsating_masterswitch", "rab_weapons_pulsating_masterswitch", "rab_ghost_pulsating_masterswitch", "rab_glow_pulsating_masterswitch", "rab_crosshair_pulsating_masterswitch" };
  12. local pulsatingSpeedVarNames = { "rab_pmodal_pulsating_speed", "rab_hands_pulsating_speed", "rab_weapons_pulsating_speed", "rab_ghost_pulsating_speed", "rab_glow_pulsating_speed", "rab_crosshair_pulsating_speed" };
  13.  
  14.  
  15. local function getMenuItems(checkBoxVarName, comboBoxVarName, editBoxVarName, chromaSpeedSliderVarName, alphaSliderVarName, enablePulsatingVarName, pulsatingSpeedVarName)
  16. local menuItems = {};
  17. menuItems[1] = { "checkbox", checkBoxVarName, "Enable", { true } };
  18. menuItems[2] = { "combobox", comboBoxVarName, "Modification Type", { "Chroma", "Static" } };
  19. menuItems[3] = { "text", "Hex Value" };
  20. menuItems[4] = { "editbox", editBoxVarName, "f62222" };
  21. menuItems[5] = { "slider", chromaSpeedSliderVarName, "Chroma Speed", { 1, 1, 10 } };
  22. menuItems[6] = { "slider", alphaSliderVarName, "Alpha", { 255, 0, 255 } };
  23. menuItems[7] = { "checkbox", enablePulsatingVarName, "Enable Pulsating", { false } };
  24. menuItems[8] = { "slider", pulsatingSpeedVarName, "Pulsating Speed", { 1, 1, 10 } };
  25. return menuItems;
  26. end
  27.  
  28. local function addMenuToGui(menus)
  29. for i = 1, #menus do
  30. local menu = menus[i];
  31. local menuWindow = menu[1];
  32. local menuName = menu[2];
  33. local menuPaddingLeft = menu[3];
  34. local menuPaddingTop = menu[4];
  35. local menuWidth = menu[5];
  36. local menuHeight = menu[6];
  37. local menuItems = menu[7];
  38. local menuGroup = gui.Groupbox(menuWindow, menuName, menuPaddingLeft, menuPaddingTop, menuWidth, menuHeight);
  39. for i2 = 1, #menuItems do
  40. local menuItem = menuItems[i2];
  41. local menuItemType = menuItem[1];
  42. local menuItemVarName = menuItem[2];
  43. local menuItemName;
  44. if (#menuItem >= 3) then menuItemName = menuItem[3] end;
  45. local menuItemValues;
  46. if (#menuItem >= 4) then menuItemValues = menuItem[4] end;
  47. if (menuItemType == "combobox") then
  48. gui.Combobox(menuGroup, menuItemVarName, menuItemName, menuItemValues[1], menuItemValues[2]);
  49. elseif (menuItemType == "slider") then
  50. gui.Slider(menuGroup, menuItemVarName, menuItemName, menuItemValues[1], menuItemValues[2], menuItemValues[3]);
  51. elseif (menuItemType == "checkbox") then
  52. gui.Checkbox(menuGroup, menuItemVarName, menuItemName, menuItemValues[1]);
  53. elseif (menuItemType == "editbox") then
  54. gui.Editbox(menuGroup, menuItemVarName, menuItemName);
  55. elseif (menuItemType == "text") then
  56. gui.Text(menuGroup, menuItemVarName);
  57. end;
  58. end
  59. end
  60. end
  61.  
  62. local function getMenuItemsForID(id)
  63. return getMenuItems(checkboxVarNames[id], comboBoxVarNames[id], editboxVarNames[id], chromaSpeedVarNames[id], alphaVarNames[id], enablePulsatingVarNames[id], pulsatingSpeedVarNames[id])
  64. end
  65.  
  66. local pModalMenu = { chamsgroup, "Player Model", 0, 30, 200, 265, getMenuItemsForID(1) };
  67.  
  68. local handsMenu = { chamsgroup, "Hands", 0, 310, 200, 265, getMenuItemsForID(2) };
  69.  
  70. local weaponMenu = { chamsgroup, "Weapons", 210, 30, 200, 265, getMenuItemsForID(3) };
  71.  
  72. local ghostMenu = { chamsgroup, "Ghost", 210, 310, 200, 265, getMenuItemsForID(4) };
  73.  
  74. local glowMenu = { chamsgroup, "Glow", 420, 30, 200, 265, getMenuItemsForID(5) };
  75.  
  76. local crosshairMenu = { chamsgroup, "Crosshair", 420, 310, 200, 265, getMenuItemsForID(6) };
  77.  
  78. addMenuToGui({ pModalMenu, handsMenu, weaponMenu, ghostMenu, glowMenu, crosshairMenu })
  79.  
  80. gui.Text(mainWindow, "Advanced Chroma - Made by Rab");
  81.  
  82. local function getChamsVar(i)
  83. if (i == 1) then
  84. return { { "clr_chams_ct_vis", "v" }, { "clr_chams_t_vis", "v" } };
  85. elseif (i == 2) then
  86. return { { "clr_chams_hands_primary", "v" }, { "clr_chams_hands_primary", "v" } };
  87. elseif (i == 3) then
  88. return { { "clr_chams_weapon_primary", "v" }, { "clr_chams_weapon_secondary", "v" } };
  89. elseif (i == 4) then
  90. return { { "clr_chams_ghost_client", "v" }, { "clr_chams_ghost_server", "v" }, { "clr_chams_historyticks", "v" } };
  91. elseif (i == 5) then
  92. return { { "vis_glowalpha", "sf" }, { "clr_esp_box_ct_vis", "v" }, { "clr_esp_box_t_vis", "v" }, { "clr_esp_box_ct_invis", "v" }, { "clr_esp_box_t_invis", "v" } };
  93. elseif (i == 6) then
  94. return { { "clr_esp_crosshair", "v" }, { "clr_esp_crosshair_recoil", "v" }, { "clr_misc_hitmarker", "v" } };
  95. end;
  96. end
  97.  
  98. local function getPulsateAlpha(speed)
  99. return math.floor(math.abs(math.sin(globals.CurTime() * speed) * 255));
  100. end
  101.  
  102. local function getFadeRGB(speed)
  103. local r = math.floor(math.sin(globals.RealTime() * speed) * 127 + 128)
  104. local g = math.floor(math.sin(globals.RealTime() * speed + 2) * 127 + 128)
  105. local b = math.floor(math.sin(globals.RealTime() * speed + 4) * 127 + 128)
  106. return { r, g, b };
  107. end
  108.  
  109. local function validHexColor(color)
  110. return nil ~= (color:find("^%x%x%x%x%x%x$") or color:find("^%x%x%x$"));
  111. end
  112.  
  113. local function getHexInput(hexInput)
  114. local hex = gui.GetValue(hexInput);
  115. hex = hex:gsub("#", "");
  116. local validHex = validHexColor(hex);
  117. if (validHex == nil) then validHex = "f62222" end;
  118. local rgb = {};
  119. if hex:len() == 3 then
  120. rgb[1] = (tonumber("0x" .. hex:sub(1, 1) .. hex:sub(1, 1)));
  121. rgb[2] = (tonumber("0x" .. hex:sub(2, 2) .. hex:sub(2, 2)));
  122. rgb[3] = (tonumber("0x" .. hex:sub(3, 3) .. hex:sub(3, 3)));
  123. return rgb;
  124. elseif (hex:len() == 6) then
  125. rgb[1] = (tonumber("0x" .. hex:sub(1, 2)));
  126. rgb[2] = (tonumber("0x" .. hex:sub(3, 4)));
  127. rgb[3] = (tonumber("0x" .. hex:sub(5, 6)));
  128. return rgb;
  129. end;
  130. return { 255, 0, 0 }
  131. end
  132.  
  133. local function setChromaValue(keys, alpha, speed)
  134. for i = 1, #keys do
  135. local rgb = getFadeRGB(gui.GetValue(speed));
  136. local key = keys[i];
  137. local var = key[1];
  138. local wat = key[2];
  139. if (wat == "v") then
  140. gui.SetValue(var, rgb[1], rgb[2], rgb[3], math.floor(alpha));
  141. elseif (wat == "sf") then
  142. gui.SetValue(var, alpha / 255);
  143. end
  144. end
  145. end
  146.  
  147. local function setGuiValues(keys, rgb, alpha)
  148. for i = 1, #keys do
  149. local key = keys[i];
  150. local var = key[1];
  151. local wat = key[2];
  152. if (wat == "v") then
  153. gui.SetValue(var, rgb[1], rgb[2], rgb[3], math.floor(alpha));
  154. elseif (wat == "sf") then
  155. gui.SetValue(var, alpha / 255);
  156. end
  157. end
  158. end
  159.  
  160. local function drawChams(enabled, selection, chamsVars, alpha, hexInput, pulsating, pulsatingSpeed, chromaSpeed)
  161. if (gui.GetValue(enabled)) then
  162. local shouldPulsate = gui.GetValue(pulsating);
  163. local alphaValue = gui.GetValue(alpha);
  164. if (shouldPulsate) then
  165. alphaValue = getPulsateAlpha(gui.GetValue(pulsatingSpeed));
  166. end
  167. if (gui.GetValue(selection) == 0) then
  168. setChromaValue(chamsVars, alphaValue, chromaSpeed);
  169. else
  170. setGuiValues(chamsVars, getHexInput(hexInput), alphaValue);
  171. end
  172. end
  173. end
  174.  
  175. callbacks.Register('Draw', function()
  176. if input.IsButtonPressed(gui.GetValue("msc_menutoggle")) then
  177. menuPressed = menuPressed == 0 and 1 or 0;
  178. end
  179. if (showMenu:GetValue()) then
  180. mainWindow:SetActive(menuPressed);
  181. else
  182. mainWindow:SetActive(0);
  183. end
  184. if (not masterSwitch:GetValue()) then return end
  185. for i = 1, #checkboxVarNames do
  186. drawChams(checkboxVarNames[i], comboBoxVarNames[i], getChamsVar(i), alphaVarNames[i], editboxVarNames[i], enablePulsatingVarNames[i], pulsatingSpeedVarNames[i], chromaSpeedVarNames[i])
  187. end
  188. end);
Add Comment
Please, Sign In to add comment