:)
-
Автор темы
- #1
Пишу JS на миндамаг. Тут строчки которые работают, но не так как надо. Чо писать сюда?
Весь код:
Весь код:
JavaScript:
UI.AddCheckbox("Display indicator")
UI.AddHotkey("Heavy Pistol Override")
UI.AddSliderInt("Heavy Pistol Mindmg", 0, 130)
UI.AddHotkey("Scout Override")
UI.AddSliderInt("Scout Mindmg", 0, 130)
UI.AddHotkey("AWP Override")
UI.AddSliderInt("AWP Mindmg", 0, 130)
UI.AddHotkey("Auto Override")
UI.AddSliderInt("Auto Mindmg", 0, 130)
UI.AddHotkey("Pistol Override")
UI.AddSliderInt("Pistol Mindmg", 0, 130)
var heavy_cache = UI.GetValue("Rage", "HEAVY PISTOL", "Targeting", "Minimum damage")
var scout_cache = UI.GetValue("Rage", "SCOUT", "Targeting", "Minimum damage")
var awp_cache = UI.GetValue("Rage", "AWP", "Targeting", "Minimum damage")
var auto_cache = UI.GetValue("Rage", "AUTOSNIPER", "Targeting", "Minimum damage")
var pistol_cache = UI.GetValue("Rage", "PISTOL", "Targeting", "Minimum damage")
function isActive(a)
{
return UI.IsHotkeyActive("Script items", a)
}
function setValue(cat, value)
{
UI.SetValue("Rage", cat.toUpperCase(), "Targeting", "Minimum damage", value)
}
function isHeavyPistol(name)
{
if (name == "r8 revolver" || name == "desert eagle")
{
return true
}
}
function isAutoSniper(name)
{
if(name == "scar 20" || weapon_name == "g3sg1")
{
return true
}
}
function isPistol(name)
{
if(name == "USP-S" || weapon_name == "glock 18")
{
return true
}
}
function onCM()
{
heavy_value = UI.GetValue("Script items", "Heavy Pistol Mindmg")
scout_value = UI.GetValue("Script items", "Scout Mindmg")
awp_value = UI.GetValue("Script items", "AWP Mindmg")
auto_value = UI.GetValue("Script items", "Auto Mindmg")
pistol_value = UI.GetValue("Script items", "Pistol Mindmg")
weapon_name = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
if (isActive("Heavy Pistol Override") && isHeavyPistol(weapon_name))
{
setValue("HEAVY PISTOL", heavy_value)
}
else{
setValue("HEAVY PISTOL", heavy_cache)
}
if (isActive("Scout Override") && weapon_name == "ssg 08")
{
setValue("SCOUT", scout_value)
}
else{
setValue("SCOUT", scout_cache)
}
if (isActive("AWP Override") && weapon_name == "awp")
{
setValue("AWP", awp_value)
}
else{
setValue("AWP", awp_cache)
}
if (isActive("Auto Override") && isAutoSniper(weapon_name))
{
setValue("AUTOSNIPER", auto_value)
}
else
{
setValue("AUTOSNIPER", auto_cache)
}
if (isActive("Pistol Override") && isPistol(weapon_name))
{
setValue("PISTOL", pistol_value)
}
else
{
setValue("PISTOL", pistol_cache)
}
}
function indicator()
{
screen = Render.GetScreenSize()
wep = Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer()))
x = screen[0]/2
y = screen[1]/2
heavy = "DMG: " + UI.GetValue("Rage", "HEAVY PISTOL", "Targeting", "Minimum damage")
scout = "DMG: " + UI.GetValue("Rage", "SCOUT", "Targeting", "Minimum damage")
awp = "DMG: " + UI.GetValue("Rage", "AWP", "Targeting", "Minimum damage")
auto = "DMG: " + UI.GetValue("Rage", "AUTOSNIPER", "Targeting", "Minimum damage")
pistol= "DMG: " + UI.GetValue("Rage", "PISTOL", "Targeting", "Minimum damage")
var str = ""
if (UI.GetValue("Script items", "Display indicator") && Entity.IsValid(Entity.GetLocalPlayer()) && Entity.IsAlive(Entity.GetLocalPlayer()))
{
if (isHeavyPistol(wep))
{
str = heavy
}
else if(wep == "ssg 08")
{
str = scout
}
else if(wep == "awp")
{
str = awp
}
else if (isAutoSniper(wep))
{
str = auto
}
else if (isPistol(wep))
{
str = pistol
}
}
Render.String(x, y + 142, 1, str+"", [0,0,0,255], 7)
Render.String(x, y + 141, 1, str+"", [255,255,255,255], 7)
}
Cheat.RegisterCallback("Draw", "indicator")
Cheat.RegisterCallback("CreateMove", "onCM")