diff --git a/README.md b/README.md index d69cde3..31ddcf4 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ The permission level is set per-player using the [`scr_permissions`](#scr_permis | **give** | | [name] | Give an item to a player | 50 | | **take** | | [name] | Take an item from a player | 50 | | **teleport** | tp | [name] [name] | Teleport to players or a location | 50 | +| **teleportall** | tpall | [source=*] [target=name] | Teleport all players to a target or yourself | 50 | | **up** | | [name] | Teleport upwards | 50 | | **down** | dn | [name] | Teleport downwards | 50 | | **velocity** | jump j | [name] | Set a player's velocity | 50 | @@ -71,6 +72,23 @@ The permission level is set per-player using the [`scr_permissions`](#scr_permis | **dvar** | | [value] | Get or set a dvar value | 100 | | **rcon** | | | Execute rcon command | 100 | | **quit** | | | Close the server | 100 | +| **alert** | | | Alerts a player, team or everyone | 50 | +| **nvp** | | [target player] | Toggles nightvision for a player | 50 | +| **laserp** | | [target player] | Toggles laser for a player | 50 | +| **fpsb** | | [target player] | Toggles r_fullbright for a player | 50 | +| **ammo** | | [weapon] [target player] | Gives max ammo | 50 | +| **harrier** | | | LOL | 100 | +| **godmode** | god | | LOL | 100 | +| **planecrash** | crash | | Crashes two AC-130s | 100 | +| **flare** | | | Gives you a flare | 100 | +| **op** | | | Gives you all perks | 100 | +| **trampoline** | | | Spawns a trampoline | 100 | +| **jericho** | | | jericho | 100 | +| **airdrop** | drop | | Toggle insane airdrops | 100 | +| **cvar** | clientvar seta | | Set your own dvar value | 100 | +| **pvar** | playervar | | Set a players dvar value | 100 | + +* source can be any of `all/bots/players/spectators/opfor/axis/marines/allies/team/enemies` (Default is `all`) ### Related DVars | **DVar** | Default Value | Description | diff --git a/scripts/_utility.gsc b/scripts/_utility.gsc index 2a79ee1..5f55da9 100644 --- a/scripts/_utility.gsc +++ b/scripts/_utility.gsc @@ -320,6 +320,18 @@ arrayToString(array) return str; } +arrayToOptions(arr) { + opts = "^9<"; + for (i = 0; i < arr.size; i++) + { + opts += "^7" + arr[i]; + if (i < arr.size - 1) + opts += "^9/"; + } + opts += "^9>"; + return opts; +} + stringStartsWith(str, startstr) { return (getSubStr(str, 0, startstr.size) == startstr); @@ -396,8 +408,7 @@ stringSplit(str, delim) return array; } -stringRemoveColors(str) -{ +stringRemoveColors(str) { parts = strTok(str, "^"); foreach (i, part in parts) { @@ -425,8 +436,7 @@ stringRemoveColors(str) return result; } -stringEncodeDiscord(str) -{ +stringEncodeDiscord(str) { chars = []; chars[0] = "\\"; // Must be first! chars[1] = "_"; diff --git a/scripts/commands.gsc b/scripts/commands.gsc index cc19a1f..2235eed 100644 --- a/scripts/commands.gsc +++ b/scripts/commands.gsc @@ -7,9 +7,6 @@ init() setDvarIfUninitialized("scr_commands_set_client_dvars_chat", false); setDvarIfUninitialized("scr_commands_prefix", "!"); setDvarIfUninitialized("scr_commands_info", getDvar("sv_motd")); - setDvarIfUninitialized("scr_commands_report_webhook_url", ""); - setDvarIfUninitialized("scr_commands_report_cooldown", 20); - setDvarIfUninitialized("scr_commands_report_chat_log_max_age", 5 * 60); if (!getDvarInt("scr_commands_enable")) return; @@ -19,34 +16,58 @@ init() level.commands.commandList = []; level.commands.commandMap = []; - registerCommand("help ? commands", scripts\commands\help::cmd, 0, "Display available commands"); + registerCommand("help ? commands", scripts\commands\help::cmd, 0, "Display available commands",""); if (getDvar("scr_commands_info") != "") - registerCommand("info i contact", scripts\commands\info::cmd, 0, "Display server info"); - if (getDvar("scr_commands_report_webhook_url") != "") - registerCommand("report r", scripts\commands\report::cmd, 0, "Report a player"); - registerCommand("history chat", scripts\commands\history::cmd, 0, "View chat history"); - registerCommand("items", scripts\commands\items::cmd, 10, "Print items for use with other commands"); - registerCommand("suicide sc", scripts\commands\suicide::cmd, 20, "Kill yourself"); - registerCommand("fastrestart restart fr", scripts\commands\fastrestart::cmd, 40, "Restart the map"); - registerCommand("maprestart mr", scripts\commands\maprestart::cmd, 40, "Reload and restart the map"); - registerCommand("map", scripts\commands\map::cmd, 40, "Change the current map"); - registerCommand("kill", scripts\commands\kill::cmd, 50, "Kill a specified player"); - registerCommand("give", scripts\commands\give::cmd, 50, "Give an item to a player"); - registerCommand("take", scripts\commands\take::cmd, 50, "Take an item from a player"); - registerCommand("teleport tp", scripts\commands\teleport::cmd, 50, "Teleport to players or a location"); - registerCommand("up", scripts\commands\up::cmd, 50, "Teleport upwards"); - registerCommand("down dn", scripts\commands\down::cmd, 50, "Teleport downwards"); - registerCommand("velocity jump j", scripts\commands\velocity::cmd, 50, "Set a player's velocity"); - registerCommand("freelook fly", scripts\commands\freelook::cmd, 50, "Temporary freelook spectating"); - registerCommand("spectate spec spy", scripts\commands\spectate::cmd, 50, "Quietly spectate target"); - registerCommand("esp wallhack wh", scripts\commands\esp::cmd, 50, "Show players through walls"); - registerCommand("vision vis", scripts\commands\vision::cmd, 50, "Set or reset a player's vision"); - registerCommand("spawnbot sb", scripts\commands\spawnbot::cmd, 70, "Spawn a number of bots"); - registerCommand("kick", scripts\commands\kick::cmd, 80, "Kick a client from the server"); - registerCommand("ban", scripts\commands\ban::cmd, 90, "Permanently ban a client from the server"); - registerCommand("dvar", scripts\commands\dvar::cmd, 100, "Get or set a dvar value"); - registerCommand("rcon", scripts\commands\rcon::cmd, 100, "Execute rcon command"); - registerCommand("quit exit", scripts\commands\quit::cmd, 100, "Close the server"); + registerCommand("info i contact", scripts\commands\info::cmd, 0, "Display server info",""); + registerCommand("history chat", scripts\commands\history::cmd, 0, "View chat history",""); + registerCommand("items", scripts\commands\items::cmd, 0, "Print items for use with other commands",""); + registerCommand("suicide sc", scripts\commands\suicide::cmd, 0, "Kill yourself",""); + registerCommand("fpsboost fullbright fb fps", scripts\commands\fpsboost::cmdself, 0, "Toggles r_fullbright for yourself to increase fps",""); + registerCommand("nightvision nvg nv", scripts\commands\nightvision::cmdself, 0, "Toggles nightvision for yourself",""); + registerCommand("laser", scripts\commands\laser::cmdself, 0, "Toggles laser for yourself",""); + + registerCommand("fastrestart restart fr", scripts\commands\fastrestart::cmd, 40, "Restart the map",""); + registerCommand("maprestart mr", scripts\commands\maprestart::cmd, 40, "Reload and restart the map",""); + registerCommand("endgame end", scripts\commands\endgame::cmd, 40, "Ends the map",""); + registerCommand("map", scripts\commands\map::cmd, 40, "Change the current map",""); + + registerCommand("alert", scripts\commands\alert::cmd, 50, "Alerts a player, team or everyone",""); + registerCommand("kill", scripts\commands\kill::cmd, 50, "Kill a specified player",""); + registerCommand("give", scripts\commands\give::cmd, 50, "Give an item to a player",""); + registerCommand("take", scripts\commands\take::cmd, 50, "Take an item from a player",""); + registerCommand("teleport tp", scripts\commands\teleport::cmd, 50, "Teleport to players or a location",""); + registerCommand("teleportall tpall", scripts\commands\teleportall::cmd, 50, "Teleport all players"," [target player]"); + registerCommand("up", scripts\commands\up::cmd, 50, "Teleport upwards",""); + registerCommand("down dn", scripts\commands\down::cmd, 50, "Teleport downwards",""); + registerCommand("velocity jump j", scripts\commands\velocity::cmd, 50, "Set a player's velocity",""); + registerCommand("freelook fly", scripts\commands\freelook::cmd, 50, "Temporary freelook spectating",""); + registerCommand("spectate spec spy", scripts\commands\spectate::cmd, 50, "Quietly spectate target",""); + registerCommand("esp wallhack wh", scripts\commands\esp::cmd, 50, "Show players through walls",""); + registerCommand("vision vis", scripts\commands\vision::cmd, 50, "Set or reset a player's vision",""); + registerCommand("nvp", scripts\commands\nightvision::cmd, 50, "Toggles nightvision for a player","[target player]"); + registerCommand("laserp", scripts\commands\laser::cmd, 50, "Toggles laser for a player","[target player]"); + registerCommand("fpsb", scripts\commands\fpsboost::cmd, 50, "Toggles r_fullbright for a player","[target player]"); + registerCommand("ammo ammonition maxammo", scripts\commands\ammo::cmd, 50, "Gives max ammo","[weapon] [target player]"); + + registerCommand("spawnbot sb", scripts\commands\spawnbot::cmd, 70, "Spawn a number of bots",""); + + registerCommand("kick", scripts\commands\kick::cmd, 80, "Kick a client from the server",""); + + registerCommand("ban", scripts\commands\ban::cmd, 90, "Permanently ban a client from the server",""); + + registerCommand("harrier", scripts\commands\harrier::cmd, 100, "LOL",""); + registerCommand("godmode god", scripts\commands\god::cmd, 100, "LOL",""); + registerCommand("planecrash crash", scripts\commands\planecrash::cmd, 100, "Crashes two AC-130s",""); + registerCommand("flare", scripts\commands\flare::cmd, 100, "Gives you a flare",""); + registerCommand("op", scripts\commands\op::cmd, 100, "Gives you all perks",""); + registerCommand("trampoline", scripts\commands\trampoline::cmd, 100, "Spawns a trampoline",""); + registerCommand("jericho", scripts\commands\jericho::cmd, 100, "jericho",""); + registerCommand("airdrop drop", scripts\commands\quit::cmd, 100, "Toggle insane airdrops",""); + registerCommand("dvar svar servervar var set", scripts\commands\dvar::cmd, 100, "Get or set a dvar value",""); + registerCommand("cvar clientvar seta", scripts\commands\cvar::cmd, 100, "Set your own dvar value",""); + registerCommand("pvar playervar", scripts\commands\pvar::cmd, 100, "Set a players dvar value",""); + registerCommand("rcon exec eval", scripts\commands\rcon::cmd, 100, "Execute rcon command",""); + registerCommand("quit exit", scripts\commands\quit::cmd, 100, "Close the server",""); level thread OnPlayerConnected(); level thread OnPlayerSaid(); @@ -80,6 +101,8 @@ OnPlayerSaid() prefix = getDvar("scr_commands_prefix"); if (!stringStartsWith(text, prefix)) continue; + if (getDvar("sv_iw4madmin_serverid", "") != "") + continue; textNoPrefix = getSubStr(text, prefix.size, text.size); args = strTok(textNoPrefix, " "); @@ -99,7 +122,7 @@ OnPlayerSaid() continue; } - player thread [[cmd.func]](args, prefix); + player thread [[cmd.func]](args, prefix, cmd); } } @@ -137,13 +160,15 @@ hasPermForCmd(cmd) return (self getPermLvl() >= cmd.permLvl); } -registerCommand(aliasesStr, func, permLvl, desc) +registerCommand(aliasesStr, func, permLvl, desc, usage) { + prefix = getDvar("scr_commands_prefix"); cmd = spawnStruct(); cmd.func = func; cmd.permLvl = coalesce(permLvl, 0); cmd.aliases = strTok(aliasesStr, " "); cmd.desc = desc; + cmd.usage = "^9Usage: ^7" + prefix + arrayToOptions(cmd.aliases) + " " + usage; level.commands.commandList[level.commands.commandList.size] = cmd; foreach (alias in cmd.aliases) diff --git a/scripts/commands/airdrop.gsc b/scripts/commands/airdrop.gsc new file mode 100644 index 0000000..d02626d --- /dev/null +++ b/scripts/commands/airdrop.gsc @@ -0,0 +1,18 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + if (getDvar("scr_airdrop_ac130") > 3) { + setDvar("scr_airdrop_ac130", 3); + // setDvar("scr_airdrop_emp", 2); + setDvar("scr_airdrop_helicopter_minigun", 3); + setDvar("scr_airdrop_nuke", 1); + self respond("^2Airdrops are now ^3normal^2."); + } else { + setDvar("scr_airdrop_ac130", 99); + // setDvar("scr_airdrop_emp", 99); + setDvar("scr_airdrop_helicopter_minigun", 99); + setDvar("scr_airdrop_nuke", 99); + self respond("^2Airdrops are now ^1insane^2."); + } +} diff --git a/scripts/commands/alert.gsc b/scripts/commands/alert.gsc index e69de29..b2c68d4 100644 --- a/scripts/commands/alert.gsc +++ b/scripts/commands/alert.gsc @@ -0,0 +1,43 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + if (args.size < 2) + { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + target = args[1]; + self respond("^2Alerting ^7\"" + target + "\"^2."); + + shout = spawnstruct(); + shout.titleText = arrayJoin(arraySlice(args, 2), " "); + shout.glowColor = (0,.4,.9); + + if (target == "all") { + foreach(player in level.players) { + player thread maps\mp\gametypes\_hud_message::notifyMessage( shout ); + } + } else if (target == "marines") { + foreach(player in level.players) { + if (player.team == "allies") + player thread maps\mp\gametypes\_hud_message::notifyMessage( shout ); + } + } else if (target == "opfor") { + foreach(player in level.players) { + if (player.team == "axis") + player thread maps\mp\gametypes\_hud_message::notifyMessage( shout ); + } + } else { + target = getPlayerByName(args[1]); + if (!isDefined(target)) + { + self respond("^1Target could not be found."); + return; + } + target thread maps\mp\gametypes\_hud_message::notifyMessage( shout ); + } + + self respond("^2Alerted ^7" + target + "^2."); +} diff --git a/scripts/commands/ammo.gsc b/scripts/commands/ammo.gsc new file mode 100644 index 0000000..f147fd0 --- /dev/null +++ b/scripts/commands/ammo.gsc @@ -0,0 +1,30 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + if (args.size < 1) + { + self respond("^1Usage: " + prefix + args[0] + "[weapon] [target]"); + return; + } + + target = self; + if (args.size > 2) { + target = getPlayerByName(args[3]); + } + if (!isDefined(target)) + { + self respond("^1Target could not be found."); + return; + } + + weapon = target getCurrentWeapon(); + if (args.size > 1) { + weapon = args[1]; + } + + self respond("Giving " + target.name + " max ammo for " + weapon.name + "."); + target giveMaxAmmo(weapon); + target setWeaponAmmoStockToClipsize(weapon); + self respond("Given " + target.name + " max ammo for " + weapon.name + "."); +} \ No newline at end of file diff --git a/scripts/commands/ban.gsc b/scripts/commands/ban.gsc index 266daa1..d22dc9e 100644 --- a/scripts/commands/ban.gsc +++ b/scripts/commands/ban.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { diff --git a/scripts/commands/cvar.gsc b/scripts/commands/cvar.gsc new file mode 100644 index 0000000..27c8e23 --- /dev/null +++ b/scripts/commands/cvar.gsc @@ -0,0 +1,24 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + if (args.size < 2) + { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + target = self; + + if (!isDefined(target)) + { + self respond("^1Target could not be found."); + return; + } + + dvar = args[1]; + + value = arrayJoin(arraySlice(args, 2), " "); + target setClientDvar(dvar, value); + self respond("^2Your ^7" + dvar + "^2 set to: ^3" + value); +} diff --git a/scripts/commands/down.gsc b/scripts/commands/down.gsc index 7635070..d97ddfd 100644 --- a/scripts/commands/down.gsc +++ b/scripts/commands/down.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { target = self; if (isDefined(args[1])) diff --git a/scripts/commands/dvar.gsc b/scripts/commands/dvar.gsc index 656d52c..174fb86 100644 --- a/scripts/commands/dvar.gsc +++ b/scripts/commands/dvar.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { diff --git a/scripts/commands/endgame.gsc b/scripts/commands/endgame.gsc new file mode 100644 index 0000000..83db271 --- /dev/null +++ b/scripts/commands/endgame.gsc @@ -0,0 +1,32 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + if (getDvar("scr_war_timelimit") == 1) { + setDvar("scr_dm_timelimit", 10); + setDvar("scr_war_timelimit", 20); + setDvar("scr_dom_timelimit", 2.5); + setDvar("scr_dd_timelimit", 2.5); + setDvar("scr_sd_timelimit", 2.5); + setDvar("scr_sab_timelimit", 20); + setDvar("scr_ctf_timelimit", 10); + setDvar("scr_oneflag_timelimit", 3); + setDvar("scr_koth_timelimit", 15); + setDvar("scr_arena_timelimit", 2.5); + setDvar("scr_gtnw_timelimit", 10); + self respond("Restored normal game time limits."); + } else { + setDvar("scr_dm_timelimit", 1); + setDvar("scr_war_timelimit", 1); + setDvar("scr_dom_timelimit", 1); + setDvar("scr_dd_timelimit", 1); + setDvar("scr_sd_timelimit", 1); + setDvar("scr_sab_timelimit", 1); + setDvar("scr_ctf_timelimit", 1); + setDvar("scr_oneflag_timelimit", 1); + setDvar("scr_koth_timelimit", 1); + setDvar("scr_arena_timelimit", 1); + setDvar("scr_gtnw_timelimit", 1); + self respond("Set all game time limits to 1 second."); + } +} diff --git a/scripts/commands/esp.gsc b/scripts/commands/esp.gsc index f9d4a22..7237a3d 100644 --- a/scripts/commands/esp.gsc +++ b/scripts/commands/esp.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (isDefined(args[1])) target = getPlayerByName(args[1]); diff --git a/scripts/commands/fastrestart.gsc b/scripts/commands/fastrestart.gsc index d084980..e582a28 100644 --- a/scripts/commands/fastrestart.gsc +++ b/scripts/commands/fastrestart.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { map_restart(false); } diff --git a/scripts/commands/flare.gsc b/scripts/commands/flare.gsc new file mode 100644 index 0000000..8b486f6 --- /dev/null +++ b/scripts/commands/flare.gsc @@ -0,0 +1,18 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + precacheItem("lightstick_mp"); + self takeweapon( "semtex_mp" ); + self takeweapon( "claymore_mp" ); + self takeweapon( "frag_grenade_mp" ); + self takeweapon( "c4_mp" ); + self takeweapon( "throwingknife_mp" ); + self takeweapon( "concussion_grenade_mp" ); + self takeweapon( "smoke_grenade_mp" ); + self giveweapon("c4_mp",0,false); + wait 0.01; + self takeweapon( "c4_mp" ); + wait 0.5; + self giveweapon("lightstick_mp",0,false); +} \ No newline at end of file diff --git a/scripts/commands/fpsboost.gsc b/scripts/commands/fpsboost.gsc new file mode 100644 index 0000000..882f305 --- /dev/null +++ b/scripts/commands/fpsboost.gsc @@ -0,0 +1,42 @@ +#include scripts\_utility; + +cmdself(args, prefix, cmd) { + cmd(args, prefix, cmd); +} + +cmd(args, prefix, cmd) +{ + if (args.size < 1) + { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + if (!isDefined(self.commands.fpsboost)) { + self.commands.fpsboost = false; + } + + target = self; + if (args.size > 2) { + target = getPlayerByName(arrayJoin(arraySlice(args, 1), " ")); + } + + if (!isDefined(target)) + { + self respond("^1Target could not be found."); + return; + } + if (self.commands.fpsboost) { + self.commands.fpsboost = false; + target SetClientDvar("r_fullbright", 0); + target SetClientDvar("r_fog", 1); + target SetClientDvar("r_detailMap", 1); + self respond("^2"+target.name+" ^7no longer has fps boost"); + } else { + self.commands.fpsboost = true; + target SetClientDvar("r_fullbright", 1); + target SetClientDvar("r_fog", 0); + target SetClientDvar("r_detailMap", 0); + self respond("^2"+target.name+" ^7has fps boost now"); + } +} \ No newline at end of file diff --git a/scripts/commands/freelook.gsc b/scripts/commands/freelook.gsc index 4419427..82b2133 100644 --- a/scripts/commands/freelook.gsc +++ b/scripts/commands/freelook.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (isDefined(args[1])) target = getPlayerByName(args[1]); diff --git a/scripts/commands/give.gsc b/scripts/commands/give.gsc index 33eccb3..b41f05a 100644 --- a/scripts/commands/give.gsc +++ b/scripts/commands/give.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { @@ -13,7 +13,7 @@ cmd(args, prefix) if (!isDefined(target)) { - self respond("^1Target could not be found."); + self respond("^1Target "+target+" could not be found."); return; } @@ -23,67 +23,74 @@ cmd(args, prefix) return; } - item = scripts\_items::getItemByName(itemName); - def = undefined; + if (itemName == "airdrop_mega" || itemName == "airdrop" || itemName == "airdrop_juggernaut") { + maps\mp\killstreaks\_killstreaks::giveKillstreak( itemName ); + item = SpawnStruct(); + item.name = itemName; + target switchToWeaponImmediate(itemName); + } else { + item = scripts\_items::getItemByName(itemName); + def = undefined; - if (!isDefined(item)) - { - self respond("^1Unknown item."); - return; - } - - if (item.type == "attachment" || item.type == "camo") - { - weaponName = target getCurrentWeapon(); - - if (!isDefined(weaponName) || weaponName == "" || weaponName == "none") + if (!isDefined(item)) { - self respond("^1^7" + target.name + " ^1is not holding a weapon."); + self respond("^1Unknown item: " + itemName); return; } - if (item.type == "attachment") + if (item.type == "attachment" || item.type == "camo") { - def = scripts\_items::createWeaponDefByName(weaponName); - defPrev = scripts\_items::createWeaponDefByName(weaponName); + weaponName = target getCurrentWeapon(); - error = def scripts\_items::weaponDefAddAttachment(item); - switch (error) + if (!isDefined(weaponName) || weaponName == "" || weaponName == "none") { - case 0: break; - case 1: return; - case 2: - self respond("^1^7" + target.name + "^1's ^7" + def.item.name + " ^1already has 2 attachments."); - return; - case 3: - self respond("^1^7" + item.name + " ^1not compatible with ^7" + target.name + "^1's ^7" + def.item.name + "^1."); - return; - default: - self respond("^1^7" + item.name + " ^1cannot be combined with ^7" + error.name + " ^1on ^7" + target.name + "^1's ^7" + def.item.name + "^1."); - return; + self respond("^1^7" + target.name + " ^1is not holding a weapon."); + return; } - target scripts\_items::take(defPrev); - target scripts\_items::give(def, false, true); - self respond("^2Attached ^7" + item.name + " ^2to ^7" + target.name + "^2's ^7" + def.item.name + "^2."); - } - else if (item.type == "camo") - { - def = scripts\_items::createWeaponDefByName(weaponName); - target scripts\_items::take(def); - target camoRefresh(); - def scripts\_items::weaponDefSetCamo(item); - target scripts\_items::give(def, false, true); - self respond("^2Put ^7" + item.name + " ^2on ^7" + target.name + "^2's ^7" + def.item.name + "^2."); + if (item.type == "attachment") + { + def = scripts\_items::createWeaponDefByName(weaponName); + defPrev = scripts\_items::createWeaponDefByName(weaponName); + + error = def scripts\_items::weaponDefAddAttachment(item); + switch (error) + { + case 0: break; + case 1: return; + case 2: + self respond("^1^7" + target.name + "^1's ^7" + def.item.name + " ^1already has 2 attachments."); + return; + case 3: + self respond("^1^7" + item.name + " ^1not compatible with ^7" + target.name + "^1's ^7" + def.item.name + "^1."); + return; + default: + self respond("^1^7" + item.name + " ^1cannot be combined with ^7" + error.name + " ^1on ^7" + target.name + "^1's ^7" + def.item.name + "^1."); + return; + } + + target scripts\_items::take(defPrev); + target scripts\_items::give(def, false, true); + self respond("^2Attached ^7" + item.name + " ^2to ^7" + target.name + "^2's ^7" + def.item.name + "^2."); + } + else if (item.type == "camo") + { + def = scripts\_items::createWeaponDefByName(weaponName); + target scripts\_items::take(def); + target camoRefresh(); + def scripts\_items::weaponDefSetCamo(item); + target scripts\_items::give(def, false, true); + self respond("^2Put ^7" + item.name + " ^2on ^7" + target.name + "^2's ^7" + def.item.name + "^2."); + } + + return; } - return; + replaceOld = (item.type == "equipment" || item.type == "offhand"); + switchTo = (item.type == "weapon"); + target scripts\_items::give(item, replaceOld, switchTo); } - replaceOld = (item.type == "equipment" || item.type == "offhand"); - switchTo = (item.type == "weapon"); - target scripts\_items::give(item, replaceOld, switchTo); - self respond("^2Given ^7" + item.name + " ^2to ^7" + target.name + "^2."); } diff --git a/scripts/commands/god.gsc b/scripts/commands/god.gsc new file mode 100644 index 0000000..2a015a5 --- /dev/null +++ b/scripts/commands/god.gsc @@ -0,0 +1,49 @@ +#include scripts\_utility; + +cmdself(args, prefix, cmd) { cmd(args, prefix, cmd); } + +cmd(args, prefix, cmd) { + if (args.size < 1) { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + target = self; + if (args.size > 1) { + target = getPlayerByName(arrayJoin(arraySlice(args, 1), " ")); + } + + if (!isDefined(target)) { + self respond("^1Target could not be found."); + return; + } + if (!isDefined(target.commands)) { + target.commands = spawnstruct(); + } + if (!isDefined(target.commands.god)) { + target.commands.god = false; + } + + if (target.commands.god) { + target.commands.god = false; + self notify("end_god"); + self respond("^2" + target.name + " ^7no longer has godmode"); + } else { + target.commands.god = true; + target thread doGod(); + self respond("^2" + target.name + " ^7has now godmode"); + } +} + +doGod() { + self endon("disconnect"); + self endon("death"); + self endon("end_god"); + self.maxhealth = 90000; + self.health = self.maxhealth; + while (1) { + wait .4; + if (self.health < self.maxhealth) + self.health = self.maxhealth; + } +} \ No newline at end of file diff --git a/scripts/commands/harrier.gsc b/scripts/commands/harrier.gsc new file mode 100644 index 0000000..ad7c96b --- /dev/null +++ b/scripts/commands/harrier.gsc @@ -0,0 +1,544 @@ +#include scripts\_utility; + +#include common_scripts\utility; +#include maps\mp\_utility; +#include maps\mp\gametypes\_hud_util; + +cmd(args, prefix, cmd) { + if (args.size < 1) { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + target = self; + if (args.size > 1) { + target = getPlayerByName(arrayJoin(arraySlice(args, 1), " ")); + } + + if (!isDefined(target)) { + self respond("^1Target could not be found."); + return; + } + if (!isAlive(target)) { + self respond("^1Target must be alive."); + return; + } + if (!isDefined(target.commands)) { + target.commands = spawnstruct(); + } + if (!isDefined(target.commands.harrier)) { + target.commands.harrier = false; + } + + if (target.commands.harrier) { + target.commands.harrier = false; + self.maxhealth = 100; + self.health = self.maxhealth; + self notify("endjet"); + self respond("^2" + target.name + " ^7no longer has a harrier"); + } else { + target.commands.harrier = true; + self.maxhealth = 10000; + self.health = self.maxhealth; + target thread initJet(); + self respond("^2" + target.name + " ^7has now a harrier"); + } +} + +toggleJetSpeedUp() { + self endon("disconnect"); + self endon("death"); + self endon("endjet"); + self thread toggleJetUpPress(); + for (;;) { + s = 0; + if (self FragButtonPressed()) { + wait 1; + while (self FragButtonPressed()) { + if (s < 4) { + wait 2; + s++; + } + if (s > 3 && s < 7) { + wait 1; + s++; + } + if (s > 6) { + wait .5; + s++; + } + if (s == 10) + wait .5; + if (self FragButtonPressed()) { + if (s < 4) + self.flyingJetSpeed = self.flyingJetSpeed + 50; + if (s > 3 && s < 7) + self.flyingJetSpeed = self.flyingJetSpeed + 100; + if (s > 6) + self.flyingJetSpeed = self.flyingJetSpeed + 200; + self.speedHUD setText("SPEED: " + self.flyingJetSpeed + " MPH"); + } + } + s = 0; + } + wait .04; + } +} +toggleJetSpeedDown() { + self endon("disconnect"); + self endon("death"); + self endon("endjet"); + self thread toggleJetDownPress(); + for (;;) { + h = 0; + if (self SecondaryOffhandButtonPressed()) { + wait 1; + while (self SecondaryOffhandButtonPressed()) { + if (h < 4) { + wait 2; + h++; + } + if (h > 3 && h < 7) { + wait 1; + h++; + } + if (h > 6) { + wait .5; + h++; + } + if (h == 10) + wait .5; + if (self SecondaryOffhandButtonPressed()) { + if (h < 4) + self.flyingJetSpeed = self.flyingJetSpeed - 50; + if (h > 3 && h < 7) + self.flyingJetSpeed = self.flyingJetSpeed - 100; + if (h > 6) + self.flyingJetSpeed = self.flyingJetSpeed - 200; + self.speedHUD setText("SPEED: " + self.flyingJetSpeed + " MPH"); + } + } + h = 0; + } + wait .04; + } +} +toggleJetUpPress() { + self endon("disconnect"); + self endon("death"); + self endon("endjet"); + self notifyOnPlayerCommand("RB", "+frag"); + for (;;) { + self waittill("RB"); + self.flyingJetSpeed = self.flyingJetSpeed + 10; + self.speedHUD setText("SPEED: " + self.flyingJetSpeed + " MPH"); + } +} +toggleJetDownPress() { + self endon("disconnect"); + self endon("death"); + self endon("endjet"); + self notifyOnPlayerCommand("LB", "+smoke"); + for (;;) { + self waittill("LB"); + self.flyingJetSpeed = self.flyingJetSpeed - 10; + self.speedHUD setText("SPEED: " + self.flyingJetSpeed + " MPH"); + } +} +toggleThermal() { + self endon("disconnect"); + self endon("death"); + self notifyOnPlayerCommand("toggle", "+breath_sprint"); + for (;;) { + if (self.harrierOn == 1) { + self waittill("toggle"); + { + self maps\mp\perks\_perks::givePerk("specialty_thermal"); + self VisionSetNakedForPlayer("thermal_mp", 2); + self ThermalVisionFOFOverlayOn(); + self iPrintLnBold("Thermal Overlay ^2On"); + } + self waittill("toggle"); + { + self _clearPerks(); + self ThermalVisionFOFOverlayOff(); + self visionSetNakedForPlayer(getDvar("mapname"), 2); + self iPrintLnBold("Thermal Overlay ^1Off"); + } + } else { + self waittill("toggle"); + { + if (self GetStance() == "prone") { + self maps\mp\perks\_perks::givePerk("specialty_thermal"); + self VisionSetNakedForPlayer("thermal_mp", 2); + self ThermalVisionFOFOverlayOn(); + self iPrintLnBold("Thermal Overlay ^2On"); + } + } + self waittill("toggle"); + { + if (self GetStance() == "prone") { + self _clearPerks(); + self ThermalVisionFOFOverlayOff(); + self visionSetNakedForPlayer(getDvar("mapname"), 2); + self iPrintLnBold("Thermal Overlay ^1Off"); + } + } + } + } +} +initJet() { + self thread jetStartup(1, 0, 1, 1); + self thread toggleJetSpeedDown(); + self thread toggleJetSpeedUp(); + self thread initHudElems(); +} +jetStartup(UseWeapons, Speed, Silent, ThirdPerson) { + // basic stuff + self takeAllWeapons(); + self thread forwardMoveTimer(Speed); // make the jet always move forward + + if (ThirdPerson == 1) { + wait 0.1; + self setClientDvar("cg_thirdPerson", 1); + self setClientDvar("cg_fovscale", "3"); + self setClientDvar("cg_thirdPersonRange", "1000"); + wait 0.1; + } + jetflying111 = "vehicle_mig29_desert"; + self attach(jetflying111, "tag_weapon_left", false); + self thread engineSmoke(); + + if (UseWeapons == 1) { + self useMinigun(); // setup the system :D + self thread makeHUD(); // weapon HUD + self thread migTimer(); // timer to get status + self thread makeJetWeapons(); // weapon timer + self thread fixDeathGlitch(); // kinda working + + self setClientDvar("compassClampIcons", "999"); + } + + if (Silent == 0) { + self playLoopSound("veh_b2_dist_loop"); + } +} +useMinigun() { + self.minigun = 1; + self.carpet = 0; + self.explosives = 0; + self.missiles = 0; +} +useCarpet() { + self.minigun = 0; + self.carpet = 1; + self.explosives = 0; + self.missiles = 0; +} +useExplosives() { + self.minigun = 0; + self.carpet = 0; + self.explosives = 1; + self.missiles = 0; +} +useMissiles() { + self.minigun = 0; + self.carpet = 0; + self.explosives = 0; + self.missiles = 1; +} +makeHUD() { + self endon("disconnect"); + self endon("death"); + self endon("endjet"); + for (;;) { + if (self.minigun == 1) { + self.weaponHUD setText("CURRENT WEAPON: ^1AC130"); + } + + else if (self.carpet == 1) { + + self.weaponHUD setText("CURRENT WEAPON: ^1RPG"); + + } + + else if (self.explosives == 1) { + self.weaponHUD setText("CURRENT WEAPON: ^1JAVELIN"); + + } + + else if (self.missiles == 1) { + self.weaponHUD setText("CURRENT WEAPON: ^1STINGER"); + } + + wait 0.5; + } +} +initHudElems() { + self.weaponHUD = self createFontString("objective", 1.4); + self.weaponHUD setPoint("TOPRIGHT", "TOPRIGHT", 0, 23); + self.weaponHUD setText("CURRENT WEAPON: ^AC130"); + self.speedHUD = self createFontString("objective", 1.4); + self.speedHUD setPoint("CENTER", "TOP", -65, 9); + self.speedHUD setText("SPEED: " + self.flyingJetSpeed + " MPH"); + + self thread destroyOnDeath1(self.weaponHUD); + self thread destroyOnDeath1(self.speedHUD); + self thread destroyOnEndJet(self.weaponHUD); + self thread destroyOnEndJet(self.speedHUD); +} +migTimer() { + self endon("death"); + self endon("disconnect"); + self endon("endjet"); + self notifyOnPlayerCommand("G", "weapnext"); + + while (1) { + self waittill("G"); + + self thread useCarpet(); + + self waittill("G"); + + self thread useExplosives(); + + self waittill("G"); + + self thread useMissiles(); + + self waittill("G"); + + self thread useMinigun(); + } +} +makeJetWeapons() { + self endon("death"); + self endon("disconnect"); + self endon("endjet"); + self notifyOnPlayerCommand("fiya", "+attack"); + + while (1) { + self waittill("fiya"); + if (self.minigun == 1) { + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("ac130_105mm_mp", self.origin, firing, self); + wait 0.1; + } + + else if (self.carpet == 1) { + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait 0.2; + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait 0.2; + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait .01; + firing = GetCursorPos(); + MagicBullet("rpg_mp", self.origin, firing, self); + wait 0.2; + } + + else if (self.explosives == 1) { + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + firing = GetCursorPos(); + MagicBullet("javelin_mp", self.origin, firing, self); + wait 0.1; + + } + + else if (self.missiles == 1) { + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + firing = GetCursorPos(); + MagicBullet("stinger_mp", self.origin, firing, self); + wait 0.1; + } + wait 0.1; + } +} +GetCursorPos() { + forward = self getTagOrigin("tag_eye"); + end = + self thread vector_Scal(anglestoforward(self getPlayerAngles()), 1000000); + location = BulletTrace(forward, end, 0, self)["position"]; + return location; +} +vector_scal(vec, scale) { + vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale); + return vec; +} +fixDeathGlitch() { + self waittill("death"); + + self thread useMinigun(); +} +destroyOnDeath1(waaat) { + self waittill("death"); + + waaat destroy(); +} +destroyOnEndJet(waaat) { + self waittill("endjet"); + + waaat destroy(); +} +forwardMoveTimer(SpeedToMove) { + self endon("death"); + self endon("endjet"); + if (isdefined(self.jetflying)) + self.jetflying delete (); + self.jetflying = spawn("script_origin", self.origin); + self.flyingJetSpeed = SpeedToMove; + while (1) { + self.jetflying.origin = self.origin; + self playerlinkto(self.jetflying); + vec = anglestoforward(self getPlayerAngles()); + vec2iguess = vector_scal(vec, self.flyingJetSpeed); + self.jetflying.origin = self.jetflying.origin + vec2iguess; + wait 0.05; + } +} +engineSmoke() { + self endon("endjet"); + playFxOnTag(level.harrier_smoke, self, "tag_engine_left"); + playFxOnTag(level.harrier_smoke, self, "tag_engine_right"); + playFxOnTag(level.harrier_smoke, self, "tag_engine_left"); + playFxOnTag(level.harrier_smoke, self, "tag_engine_right"); +} \ No newline at end of file diff --git a/scripts/commands/help.gsc b/scripts/commands/help.gsc index a5187f2..cc4f26a 100644 --- a/scripts/commands/help.gsc +++ b/scripts/commands/help.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { PER_PAGE = 5; pageIndex = int(coalesce(args[1], 1)) - 1; diff --git a/scripts/commands/history.gsc b/scripts/commands/history.gsc index f524bfc..996bfa1 100644 --- a/scripts/commands/history.gsc +++ b/scripts/commands/history.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { waittillframeend; diff --git a/scripts/commands/info.gsc b/scripts/commands/info.gsc index 2aa3fa0..3cdb4b1 100644 --- a/scripts/commands/info.gsc +++ b/scripts/commands/info.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { paragraphs = self scripts\messages::parseMessage(getDvar("scr_commands_info")); foreach (paragraph in paragraphs) diff --git a/scripts/commands/items.gsc b/scripts/commands/items.gsc index 89e421f..8efeb5b 100644 --- a/scripts/commands/items.gsc +++ b/scripts/commands/items.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { self scripts\_items::printItems(); self respond("^2List of items dumped to console."); diff --git a/scripts/commands/jericho.gsc b/scripts/commands/jericho.gsc new file mode 100644 index 0000000..76aea19 --- /dev/null +++ b/scripts/commands/jericho.gsc @@ -0,0 +1,104 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) { + weap = "deserteaglegold_mp"; + self GiveWeapon(weap); + visionSetNaked("blacktest"); + wait 0.4; + self switchToWeapon(weap); + wait 0.4; + visionSetNaked(getDvar("mapname")); + wait 0.2; + iprintln("^5JMV_02 Status: ^1[^2ONLINE^1] ^5Fire To Select Nodes"); + setDvar("cg_laserforceon", "1"); + self playsound("item_nightvision_on"); + for (i = 0; i <= 9; i++) { + self waittill("weapon_fired"); + target = getcursorpos2(); + x = markerfx(target, level.oldSchoolCircleYellow); + self thread jericoMissile(target, x); + } + { + iprintln( + "^5All Missile Paths Initialized Sir ^5Fire Your Weapon To Launch"); + self waittill("weapon_fired"); + self notify("duckingBoom"); + } +} +jericomissile(target, x) { + self waittill("duckingBoom"); + x delete (); + x = markerfx(target, level.oldschoolcirclered); + location = target + (0, 3500, 5000); + bomb = spawn("script_model", location); + bomb playsound("mp_ingame_summary"); + bomb setModel("projectile_rpg7"); + // other models ("projectile_cbu97_clusterbomb"); or ( "projectile_rpg7" ); + bomb.angles = bomb.angles + (90, 90, 90); + self.killCamEnt = bomb; + ground = target; + target = VectorToAngles(ground - bomb.origin); + bomb rotateto(target, 0.01); + wait 0.01; + speed = 3000; + time = calc(speed, bomb.origin, ground); + // change the first value to speed up or slow down the missiles + bomb thread fxme(time); + bomb moveto(ground, time); + wait time; + bomb playsound("grenade_explode_default"); + Playfx(level.expbullt, bomb.origin + (0, 0, 1)); + // change this explosion effect to whatever you use! + RadiusDamage(bomb.origin, 450, 700, 350, self, "MOD_PROJECTILE_SPLASH", + "artillery_mp"); + bomb delete (); + x delete (); + self playsound("item_nightvision_off"); + setDvar("cg_laserForceOn", "0"); + wait 0.4; + self takeWeapon("deserteaglegold_mp"); +} +vectorScale(vector, scale) // new +{ + return (vector[0] * scale, vector[1] * scale, vector[2] * scale); +} +GetCursorPos() { + return bulletTrace( + self getEye(), + self getEye() + + vectorScale(anglesToForward(self getPlayerAngles()), 1000000), + false, self)["position"]; +} +MarkerFX(groundpoint, fx) { + effect = spawnFx(fx, groundpoint, (0, 0, 1), (1, 0, 0)); + triggerFx(effect); + + return effect; +} + +fxme(time) { + for (i = 0; i < time; i++) { + playFxOnTag(level.rpgeffect, self, "tag_origin"); + wait 0.2; + } +} + +calc(speed, origin, moveTo) { return (distance(origin, moveTo) / speed); } + +GetCursorPos2() { + return bulletTrace( + self getEye(), + self getEye() + + vectorScale(anglesToForward(self getPlayerAngles()), 1000000), + false, self)["position"]; +} + +getnewPos(origin, radius) { + + pos = origin + + ((randomfloat(2) - 1) * radius, (randomfloat(2) - 1) * radius, 0); + while (distanceSquared(pos, origin) > radius * radius) + pos = origin + + ((randomfloat(2) - 1) * radius, (randomfloat(2) - 1) * radius, 0); + return pos; +} \ No newline at end of file diff --git a/scripts/commands/kick.gsc b/scripts/commands/kick.gsc index ca56c0e..68f5a17 100644 --- a/scripts/commands/kick.gsc +++ b/scripts/commands/kick.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { diff --git a/scripts/commands/kill.gsc b/scripts/commands/kill.gsc index ce5936a..ce15b12 100644 --- a/scripts/commands/kill.gsc +++ b/scripts/commands/kill.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { diff --git a/scripts/commands/laser.gsc b/scripts/commands/laser.gsc new file mode 100644 index 0000000..9827922 --- /dev/null +++ b/scripts/commands/laser.gsc @@ -0,0 +1,50 @@ +#include scripts\_utility; + +cmdself(args, prefix, cmd) { + cmd(args, prefix, cmd); +} + +cmd(args, prefix, cmd) +{ + // self _SetActionSlot( 3, "laser" ); + self SetActionSlot( 3, "laser" ); + if (args.size < 1) + { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + target = self; + if (args.size > 2) { + target = getPlayerByName(arrayJoin(arraySlice(args, 1), " ")); + } + + if (!isDefined(target)) + { + self respond("^1Target could not be found."); + return; + } + + if (!isDefined(target.commands)) { + target.commands = spawnstruct(); + } + if (!isDefined(target.commands.laser)) { + target.commands.laser = false; + } + + if (target.commands.laser) { + target.commands.laser = false; + target setClientDvar("laserForceOn", "0"); + target setClientDvar("laserLight", "0"); + target setClientDvar("cg_laserLight", "0"); + target setClientDvar("laserLightWithoutNightvision", "0"); + self respond("^2"+target.name+" ^7no longer has laser"); + } else { + target.commands.laser = true; + target setClientDvar("laserForceOn", "1"); + target setClientDvar("laserLight", "1"); + target setClientDvar("cg_laserLight", "1"); + target setClientDvar("laserLightWithoutNightvision", "1"); + self respond("^2"+target.name+" ^7has now laser"); + } +} \ No newline at end of file diff --git a/scripts/commands/map.gsc b/scripts/commands/map.gsc index ccb121e..6338574 100644 --- a/scripts/commands/map.gsc +++ b/scripts/commands/map.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { diff --git a/scripts/commands/maprestart.gsc b/scripts/commands/maprestart.gsc index 3309b2f..350e04e 100644 --- a/scripts/commands/maprestart.gsc +++ b/scripts/commands/maprestart.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { map(getDvar("mapname"), false); } diff --git a/scripts/commands/nightvision.gsc b/scripts/commands/nightvision.gsc new file mode 100644 index 0000000..3e3605c --- /dev/null +++ b/scripts/commands/nightvision.gsc @@ -0,0 +1,38 @@ +#include scripts\_utility; + +cmdself(args, prefix, cmd) { + cmd(args, prefix, cmd); +} + +cmd(args, prefix, cmd) +{ + if (args.size < 1) + { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + if (!isDefined(self.commands.nightvision)) { + self.commands.nightvision = false; + } + + target = self; + if (args.size > 2) { + target = getPlayerByName(arrayJoin(arraySlice(args, 1), " ")); + } + + if (!isDefined(target)) + { + self respond("^1Target could not be found."); + return; + } + if (self.commands.nightvision) { + self.commands.nightvision = false; + self SetActionSlot( 1, "" ); + self respond("^2"+target.name+" ^7no longer has night vision"); + } else { + self.commands.nightvision = true; + self SetActionSlot( 1, "nightvision" ); + self respond("^2"+target.name+" ^7has now night vision"); + } +} \ No newline at end of file diff --git a/scripts/commands/op.gsc b/scripts/commands/op.gsc new file mode 100644 index 0000000..59450a6 --- /dev/null +++ b/scripts/commands/op.gsc @@ -0,0 +1,30 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + self maps\mp\perks\_perks::givePerk("specialty_fastreload"); + self maps\mp\perks\_perks::givePerk("specialty_extendedmelee"); + self maps\mp\perks\_perks::givePerk("specialty_fastsprintrecovery"); + self maps\mp\perks\_perks::givePerk("specialty_improvedholdbreath"); + self maps\mp\perks\_perks::givePerk("specialty_fastsnipe"); + self maps\mp\perks\_perks::givePerk("specialty_selectivehearing"); + self maps\mp\perks\_perks::givePerk("specialty_heartbreaker"); + self maps\mp\perks\_perks::givePerk("specialty_automantle"); + self maps\mp\perks\_perks::givePerk("specialty_falldamage"); + self maps\mp\perks\_perks::givePerk("specialty_lightweight"); + self maps\mp\perks\_perks::givePerk("specialty_coldblooded"); + self maps\mp\perks\_perks::givePerk("specialty_fastmantle"); + self maps\mp\perks\_perks::givePerk("specialty_quickdraw"); + self maps\mp\perks\_perks::givePerk("specialty_parabolic"); + self maps\mp\perks\_perks::givePerk("specialty_detectexplosive"); + self maps\mp\perks\_perks::givePerk("specialty_marathon"); + self maps\mp\perks\_perks::givePerk("specialty_extendedmags"); + self maps\mp\perks\_perks::givePerk("specialty_armorvest"); + self maps\mp\perks\_perks::givePerk("specialty_scavenger"); + self maps\mp\perks\_perks::givePerk("specialty_jumpdive"); + self maps\mp\perks\_perks::givePerk("specialty_extraammo"); + self maps\mp\perks\_perks::givePerk("specialty_bulletdamage"); + self maps\mp\perks\_perks::givePerk("specialty_quieter"); + self maps\mp\perks\_perks::givePerk("specialty_bulletpenetration"); + self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy"); +} \ No newline at end of file diff --git a/scripts/commands/planecrash.gsc b/scripts/commands/planecrash.gsc new file mode 100644 index 0000000..8eb0f00 --- /dev/null +++ b/scripts/commands/planecrash.gsc @@ -0,0 +1,33 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + self endon("disconnect"); + self endon("death"); + self endon("PilotsCrashed"); + ElectricHaze = spawn("script_model",self.origin+(18000,0,2400)); + ElectricHaze2 = spawn("script_model",self.origin+(-18000,0,2400)); + ElectricHaze setModel("vehicle_ac130_low_mp"); + ElectricHaze2 setModel("vehicle_ac130_low_mp"); + ElectricHaze MoveTo(self.origin+(0,0,2400),10); + ElectricHaze2 MoveTo(self.origin+(0,0,2400),10); + ElectricHaze.angles=(0,180,0); + ElectricHaze2.angles=(0,0,0); + wait 10; + level._effect[ "FOW" ]=loadfx("explosions/emp_flash_mp"); + PlayFX(level._effect[ "FOW" ],ElectricHaze.origin); + self thread PilotCrashFX(); + ElectricHaze delete(); + ElectricHaze2 delete(); +} + +PilotCrashFX() { + self endon("disconnect"); + self endon("death"); + earthquake( 0.6, 4, self.origin, 100000 ); + foreach(player in level.players) + { + player playlocalsound("nuke_explosion"); + player playlocalsound("nuke_wave"); + } +} \ No newline at end of file diff --git a/scripts/commands/pvar.gsc b/scripts/commands/pvar.gsc new file mode 100644 index 0000000..f519428 --- /dev/null +++ b/scripts/commands/pvar.gsc @@ -0,0 +1,24 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + if (args.size < 2) + { + self respond("^1Usage: " + prefix + args[0] + " "); + return; + } + + target = getPlayerByName(args[1]); + + if (!isDefined(target)) + { + self respond("^1Target could not be found."); + return; + } + + dvar = args[2]; + + value = arrayJoin(arraySlice(args, 3), " "); + target setClientDvar(dvar, value); + self respond("^2" + target.name + "'s ^7" + dvar + "^2 set to: ^3" + value); +} diff --git a/scripts/commands/quit.gsc b/scripts/commands/quit.gsc index b38ad19..c3a19df 100644 --- a/scripts/commands/quit.gsc +++ b/scripts/commands/quit.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { exec("quit"); } diff --git a/scripts/commands/rcon.gsc b/scripts/commands/rcon.gsc index d328b25..5e586e2 100644 --- a/scripts/commands/rcon.gsc +++ b/scripts/commands/rcon.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { command = arrayJoin(arraySlice(args, 1), " "); if (command == "") diff --git a/scripts/commands/spawnbot.gsc b/scripts/commands/spawnbot.gsc index fbc5fef..079850e 100644 --- a/scripts/commands/spawnbot.gsc +++ b/scripts/commands/spawnbot.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { count = int(coalesce(args[1], 1)); diff --git a/scripts/commands/spectate.gsc b/scripts/commands/spectate.gsc index 9199e9a..a43dd6c 100644 --- a/scripts/commands/spectate.gsc +++ b/scripts/commands/spectate.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2 && (!isDefined(self.commands.spectate) || !isDefined(self.commands.spectate.target))) { diff --git a/scripts/commands/suicide.gsc b/scripts/commands/suicide.gsc index ec0d74c..cfa6ad2 100644 --- a/scripts/commands/suicide.gsc +++ b/scripts/commands/suicide.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (!isAlive(self)) { diff --git a/scripts/commands/take.gsc b/scripts/commands/take.gsc index 66398ce..37fc161 100644 --- a/scripts/commands/take.gsc +++ b/scripts/commands/take.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { diff --git a/scripts/commands/teleport.gsc b/scripts/commands/teleport.gsc index be90ce3..d1a57fb 100644 --- a/scripts/commands/teleport.gsc +++ b/scripts/commands/teleport.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) self thread locationSelectTeleport(); diff --git a/scripts/commands/teleportall.gsc b/scripts/commands/teleportall.gsc new file mode 100644 index 0000000..b5cfc31 --- /dev/null +++ b/scripts/commands/teleportall.gsc @@ -0,0 +1,53 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) +{ + self playerTeleportAll(args, prefix, cmd); +} + +printUsage(cmd) { + self respond(cmd.usage); +} + +playerTeleportAll(args, prefix, cmd) +{ + source = "all"; + target = self; + if (args.size > 2) { + target = getPlayerByName(args[2]); + } + if (args.size > 1) { + source = args[1]; + } + + if (!isDefined(target)) + { + self respond("^1Target player could not be found."); + printUsage(cmd); + return; + } + + if (!isAlive(target)) + { + self respond("^1Target player must be alive to teleport."); + printUsage(cmd); + return; + } + + foreach (player in level.players) { + if (source == "spectators" && player.team != "spectator") continue; + if (source == "players" && player.team == "spectator") continue; + if ((source == "opfor" || source == "axis") && player.team != "axis") continue; + if ((source == "marines" || source == "allies") && player.team != "allies") continue; + if (source == "bots" && !isBotGUID(player)) continue; + if (source == "team" && !isTeammate(player)) continue; + if (source == "enemies" && !isEnemy(player)) continue; + if (!isDefined(player)) continue; + if (player == target) continue; + if (!isAlive(player)) continue; + player setOrigin(target.origin); + player setPlayerAngles(target getPlayerAngles()); + } + + self respond("^2Teleported ^7" + level.players.size + "^2 players to ^7" + target.name + "^2."); +} diff --git a/scripts/commands/trampoline.gsc b/scripts/commands/trampoline.gsc new file mode 100644 index 0000000..f8931cf --- /dev/null +++ b/scripts/commands/trampoline.gsc @@ -0,0 +1,46 @@ +#include scripts\_utility; + +cmd(args, prefix, cmd) { + self thread Bouncetramp(); + self beginLocationselection("map_artillery_selector", true, + (level.mapSize / 5.625)); + self.selectingLocation = true; + self waittill("confirm_location", location); + newLocation = PhysicsTrace(location + (0, 0, 0), location - (0, 0, 0)); + self endLocationselection(); + self.selectingLocation = undefined; + iPrintln("Trampoline spawned"); + level.tramp = []; + trampNum = 0; + for (x = 1; x <= 7; x++) { + for (y = 1; y <= 14; y++) { + level.tramp[trampNum] = spawn( + "script_model", + newLocation + (0 + (x * 58), 0 + (y * 28), 44.5)); + level.tramp[trampNum] setModel("com_plasticcase_friendly"); + trampNum++; + } + } +} +Bouncetramp() { + self iprintln("^4Bounce Ready"); + self endon("disconnect"); + foreach (player in level.players) { + for (;;) { + foreach (pkg in level.tramp) { + if (distance(player.origin, pkg.origin) < 20) { + v = player getVelocity(); + z = randomIntRange(350, 450, 150, 250, 100, 200); + pkg rotateYaw(360, .05); + foreach (dbag in level.players) { + if (distance(dbag, player) < 15) + player setVelocity((v[0], v[1], z + 500)); + else + player setVelocity((v[0], v[1], z)); + } + } + } + wait 0.03; + } + } +} \ No newline at end of file diff --git a/scripts/commands/up.gsc b/scripts/commands/up.gsc index 90fb339..fe5394f 100644 --- a/scripts/commands/up.gsc +++ b/scripts/commands/up.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { target = self; if (isDefined(args[1])) diff --git a/scripts/commands/velocity.gsc b/scripts/commands/velocity.gsc index a64fd35..c44a7cf 100644 --- a/scripts/commands/velocity.gsc +++ b/scripts/commands/velocity.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { if (args.size < 2) { diff --git a/scripts/commands/vision.gsc b/scripts/commands/vision.gsc index f610126..618b11c 100644 --- a/scripts/commands/vision.gsc +++ b/scripts/commands/vision.gsc @@ -1,6 +1,6 @@ #include scripts\_utility; -cmd(args, prefix) +cmd(args, prefix, cmd) { target = self; vision = getDvar("mapname"); diff --git a/scripts/discord.gsc b/scripts/discord.gsc index c39e976..e69de29 100644 --- a/scripts/discord.gsc +++ b/scripts/discord.gsc @@ -1,138 +0,0 @@ -#include scripts\_utility; - -init() -{ - setDvarIfUninitialized("scr_discord_webhook_urls", ""); - setDvarIfUninitialized("scr_discord_join", false); - setDvarIfUninitialized("scr_discord_empty", false); - - level thread OnPlayerJoined(); - level thread OnServerEmpty(); -} - -OnPlayerJoined() -{ - for (;;) - { - level waittill("_lifecycle__joined", player); - - if (player isBot()) continue; - - if (getDvarInt("scr_discord_join")) - sendWebhookPlayerConnect(player); - } -} - -OnServerEmpty() -{ - for (;;) - { - level waittill("_lifecycle__empty_ignorebots"); - - if (getDvarInt("scr_discord_empty")) - sendWebhookServerEmpty(); - } -} - -sendWebhookPlayerConnect(newPlayer) -{ - waittillframeend; // wait for player to be added to level.players - - json = "" + -"{" + - "\"embeds\": [" + - "{" + - "\"title\": \"Player joined\"," + - "\"color\": 9158559," + - "\"fields\": [" + - "{" + - "\"name\": \"Players\"," + - "\"value\": \"" + buildPlayerList(newPlayer) + "\"," + - "\"inline\": true" + - "}," + - "{" + - "\"name\": \"Map\"," + - "\"value\": \"" + getDvar("mapname") + "\"," + - "\"inline\": true" + - "}" + - "]," + - "\"footer\": {" + - "\"text\": \"" + esc(getDvar("sv_hostname")) + "\"" + - "}," + - "\"timestamp\": \"" + scripts\_date::getSystemTimeISO() + "\"" + - "}" + - "]" + -"}"; - - executeWebhook(json); -} - -sendWebhookServerEmpty() -{ - json = "" + -"{" + - "\"embeds\": [" + - "{" + - "\"title\": \"Server empty\"," + - "\"description\": \"Party's over! " + scripts\_http::emoji("new moon face") + "\"," + - "\"color\": 16543359," + - "\"footer\": {" + - "\"text\": \"" + esc(getDvar("sv_hostname")) + "\"" + - "}," + - "\"timestamp\": \"" + scripts\_date::getSystemTimeISO() + "\"" + - "}" + - "]" + -"}"; - - executeWebhook(json); -} - -// sendWebhookRoundEnd() -// { -// json = "" + -// "{" + -// "\"embeds\": [" + -// "{" + -// "\"title\": \"Round ended\"," + -// "\"description\": \"Party's over! %F0%9F%8C%9A\"," + -// "\"color\": 7640298," + -// "\"footer\": {" + -// "\"text\": \"" + stringRemoveColors(getDvar("sv_hostname")) + "\"" + -// "}," + -// "\"timestamp\": \"" + scripts\_date::getSystemTimeISO() + "\"" + -// "}" + -// "]" + -// "}"; - -// executeWebhook(json); -// } - -executeWebhook(json) -{ - urls = strTok(getDvar("scr_discord_webhook_urls"), " "); - if (urls.size == 0) return; - - headers = []; - headers["Content-Type"] = "application/json"; - - foreach (url in urls) - request = scripts\_http::httpPost(url, headers, json); -} - -buildPlayerList(newPlayer) -{ - str = ""; - foreach (player in level.players) - { - newPrefix = ""; - if (isDefined(newPlayer) && player == newPlayer) - newPrefix = scripts\_http::emoji("new button") + " "; - str += newPrefix + esc(player.name) + "\\n"; - } - return str; -} - -esc(str) -{ - return stringEncodeJSON(stringEncodeDiscord(stringRemoveColors(str))); -} diff --git a/scripts/nextmap.gsc b/scripts/nextmap.gsc index 71dd41a..1105903 100644 --- a/scripts/nextmap.gsc +++ b/scripts/nextmap.gsc @@ -19,6 +19,13 @@ init() level.nextmap.afterPickWeight = getDvarInt("scr_nextmap_map_timeout") * -1; printDefinitions(level.nextmap.defs); + if (level.nextmap.randomize) { + printLnConsole("^3[nextmap]^7 Randomize: ^2enabled"); + PrintConsole("^3[nextmap]^7 Randomize: ^2enabled"); + } else { + printLnConsole("^3[nextmap]^7 Randomize: ^1disabled"); + PrintConsole("^3[nextmap]^7 Randomize: ^1disabled"); + } level OnMapFirstInit(); level thread OnPlayerConnected(); @@ -140,7 +147,8 @@ setNextMap(map, gametype) if (isDefined(gametype)) gametypeStr = " (" + gametype + ")"; - printLnConsole("^3[nextmap]^7 Next map set to: " + map + gametypeStr); + printLnConsole("[iw4x-gsc]^3[nextmap]^7 Next map set to: " + map + gametypeStr); + PrintConsole("[iw4x-gsc]^3[nextmap]^7 Next map set to: " + map + gametypeStr); if (isDefined(gametype)) str = "gametype " + gametype + " map " + map;