-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
67 lines (67 loc) · 2.59 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function addCMD(){
var key = document.getElementById("key");
var strKey = key.options[key.selectedIndex].value;
var weapon = document.getElementById("weapon");
var strWeapon = weapon.options[weapon.selectedIndex].value;
var scriptbox = document.getElementById("script");
//============ detect grenades ==========
var nades = "";
var he = document.getElementById("he");
var flash = document.getElementById("flashbang");
var doubleflash = document.getElementById("doubleflash");
var smoke = document.getElementById("smoke");
if(he.checked)
nades = nades + ";buy hegrenade";
if(flash.checked){
nades = nades + ";buy flashbang";
if(doubleflash.checked)
nades = nades + ";buy flashbang";
}
if(smoke.checked)
nades = nades + ";buy smokegrenade";
//============ end detect grenades ========
//============ detect ammo ============
var ammo = "";
var prim = document.getElementById("primammo");
var sec = document.getElementById("secammo");
if(prim.checked)
ammo = ammo + ";buy primammo";
if(secammo.checked)
ammo = ammo + ";buy secammo";
//========= end detect ammo ========
//========= detect equipment =======
var equip = "";
var vest = document.getElementById("vest");
var vesthelm = document.getElementById("vesthelm");
var defkit = document.getElementById("defkit");
if(vest.checked)
equip = equip + ";buy vest";
if(vesthelm.checked)
equip = equip + ";buy vesthelm";
if(defkit.checked)
equip = equip + ";buy defuser";
//========= end detect equipment
//write to textarea
scriptbox.value = scriptbox.value + "bind \"" + strKey + "\" \"" + strWeapon + nades + ammo + equip + "\"\n";
}
function downloadScript(){
//js download code
var data = document.getElementById("script").value;
var txtBlob = new Blob([data], {type:'text/plain'});
var saveAs = "buyscript.cfg";
var dLink = document.createElement("a");
dLink.download = saveAs;
dLink.innerHTML = "Download Link";
dLink.href = window.URL.createObjectURL(txtBlob);
dLink.onclick = destroyClickedElement;
dLink.style.display = "none";
document.body.appendChild(dLink);
alert("Save the file on \"C:/Program Files (x86)/Steam/steamapps/common/Counter-Strike Global Offensive/csgo/cfg\" and when you run the game, press ~ and type \"exec buyscript.cfg\".");
dLink.click();
}
function destroyClickedElement(event){
document.body.removeChild(event.target);
}
function clearScript(){
document.getElementById("script").value = "";
}