C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using Oxide.Core;
using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using Oxide.Core.Configuration;
using Oxide.Game.Rust.Cui;
using System;
using System.Linq;
using Oxide.Core.Plugins;
using Newtonsoft.Json;
using System.Text.RegularExpressions;
using Oxide.Core.Libraries.Covalence;
using Rust;
using Rust.Ai;
using Network;
using Facepunch;
using Rust.Workshop.Editor;
using VLB;
using ProtoBuf;
using Epic.OnlineServices.P2P;
using static ConsoleSystem;
using Rust.UI.ServerAdmin;
using static FreeImage;
//using ConVar;
namespace Oxide.Plugins {
[Info("Payback2", "1928Tommygun", "1.6.1")]
[Description("Special Admin Commands To Mess With Cheaters")]
class Payback2 : RustPlugin {
//| =============================================
//| CHANGELOG
//| =============================================
//| 1.6.1
//| - update for Oct 3 patch
//| 1.6.0
//| Added AirStrike - Annahilate target player with an F15 fighter.//| Added Loudfoot - Target player triggers a tin can alarm whever they crouch-move
//| 1.5.9
//| fixed recycler seated position
//| 1.5.8
//| fixed hogwild positioning
//| fixed roast spears
//| 1.5.7
//| fixed gestures
//| fixed sack
//| fixed roast spear positioning
//| 1.5.6
//| - Fixed Recycler
//| - Added 'force' command to WOODS so that you don't have to wait for the player to farm
//| - Added SLOWBURN command - Target player is burned slowly over time
//| - Added flashbang command - target player is flashbanged continously
//| - Added NoPickup - Target player always drops items when they try to pick them up
//| 1.5.5
//| - Fixed HigherGround
//| 1.5.4
//| - Added OverCompensation - Target player is over compensating for their lack of bulge and ends up shooting into the ground
//| - Added LagSwitch - Target player rubberbands constantly as if experiencing a ton of lag
//| 1.5.3
//| - Fixed roast command rotation / size issues
//| - Upgraded potato to accept a mulitplier on the speed of the effect (add 1 - 100 after the command)
//| 1.5.2
//| - Updated for Sept 2023 patch.//| - Prevent players from moving items around in recyclers that are eating people
//| - Added optional 'kill' parameter to Batman, always kills players on hit
//| 1.5.1
//| - Added Batman : Whack players with a bat, aim for that home run! Use this on the batter to give them the power of the bat.Sprint to triple the power, headshots will kill the target!
//| 1.4.13
//| - Changed recycle command to recycleplayer
//| - Horse dung now stacks correctly while vd is off
//| 1.4.12
//| - Added Reycle command - Recycle's target cheater -- works like the sit command with a sick twist!
//| 1.4.11
//| - Fixed missing image links
//| 1.4.10
//| - Fixed console and chat binds when targeting a player with raycast
//| 1.4.9
//| - Added 'fast' parameter to SPITROAST
//| - Added POOPROCKET command
//| 1.4.8
//| - Updated missing image urls
//| 1.4.7
//| - Added verbal diarrhea command : Target player starts spewing increasing amounts of horse dung when they use voice chat
//| 1.4.6
//| - Sit command now uses a toilet chair by default! Includes options for using other chairs
//| - Added config to disable showing UI to admins while commands are active
//| - fixed POTATO command
//| - Updated License : you are allowed to use this plugin on multiple servers as long as you are the owner of the servers without purchasing additional copies.Please consider tipping!
//| 1.4.5
//| - Restored rocketman to its former glory with the return of the invisible chair!
//| - Updated for multithreaded networking
//| 1.4.4
//| - Added a temporary fix for rocketman and other broken commands, next month Facepunch will update the game and it will work just like before!
//| - Added ability to for commands to persist between server restarts
//| 1.4.3
//| - Jan 2023 patch basemounteable
//| 1.4.2
//| - added TRAIN command
//| 1.4.1
//| - added MINEFIELD command
//| 1.4.0
//| - Added BONK - Bonk that cheater right into the ground | use bonk on yourself to make anyone you hit bonkable
//| - BuggedGun - Makes target's weapon bug out and randomly unequip
//| - Added Radiation - Applies a ton of rads to target player
//| - Added UI - Shows which commands are currently active
//| - Added ability to log admins using payback to discord
//| - Improved support for conflicting commands
//| 1.3.8
//| - Added CRUCIFY command
//| 1.3.7
//| - Added SPITROAST command
//| 1.3.6
//| - Updated for Jan 28 new year content
//| 1.3.5
//| - attempt to fix wounded NRE in hog
//| 1.3.4
//| - added INTERROGATE command
//| - hog now attempts to keep player's wearables in their inventory
[PluginReference]
Plugin Payback;
//| reference to the original payback plugin
[PluginReference]
private Plugin ImageLibrary;
//| Optional reference to ImageLibrary
//| Hello!
//| This is Payback 2! To make sure you can use this plugin on its own, it comes with some essential features from Payback 1!
//| If you want to have classic admin commands like ROCKETMAN, JAWS, and BSOD, please purchase Payback 1 at https://payback.fragmod.com
//| TUTORIAL:
//| admins require the permission payback.admin to use this plugin
//| this oxide command works for that: oxide.grant group admin payback.admin
//| put 'payback' in the F1 or server console to see the tutorial!
//| =========
//| ===================
//| ==============================================================================
//| TOMMYGUN'S EULA - BY USING THIS PLUGIN YOU AGREE TO THE FOLLOWING!
//| ==============================================================================
//|
//| Code contained in this file is not licensed to be copied, shared, resold, or modified in any way.//| You may copy the plugin freely to each server instance that your organization owns.I ask that you include an optional tip if you are a large server organization, the suggested amount is one copy for every 10 servers you are running.//| Do not share this plugin with other server organizations, they must purchase their own licenses.//|
//| =======================================
//| ===================
//| =========
//| TOMMYGUN
//MMMMMMMMMMMMMMMMMMMMMMMMWNO::loll::kKKXXXXXXXXXXKXXKx;o000000KKKKNWWWWWWWWWWWWWWWWWWMMMMMMWWXxkNNNNN
//MMMMMMMMMMMMMMMMMMMMMMMMKc,.....................................'',,,,,,,,,,,,,,,,,;;;;;;;;:..,'''.//MMMMMMMMMMMMMMMMMMMMMMMMXc',,;;;;;;;;;;;;;;;;;;;,.',''',;:::::::::::::clldxxxxxxxxxxooocccc
//MMMMMMMMMMMMMMNXK00KXKOdc;'',;:;,,;lxddl::,;::;'.',..''.kWNNNK:...',,........'oXMMMMMMMMMMMMMMMMM
//MMMMWNX0Oxol:;'.......:Oc.xMMMKc....','.;ool,...OMMMMNxcdO0KKo.lNMMMMMMMMMMMMMMMMMM
//Odlc;'...:,';xNMMWk.;xoxXXx'..cXMMMMMMMMMWO:.;OMMMMMMMMMMMMMMMMMMM
//.';:clodxO0XWMMMXo..:x000KK0Ol..xMMMMMMMW0:..:0WWMMMMMMMMMMMMMMMMMMM
//..,lONMMMMMMMMMMMMMX: ,0WMMMMMMMMx.cXMMMMMMMK, 'kNWMMMMMMMMMMMMMMMMMMMMMMMM
//'.;o0NMMMMMMMMMMMMMMMMk..oWMMMMMMMMMx..OMMMMMMMMNl ,OWMMMMMMMMMMMMMMMMMMMMMMM
//'.:xKWMMMMMMMMMMMMMMMMMMMNd..oNMMMMMMMMMMx..OMMMMMMMMMNkl::kWMMMMMMMMMMMMMMMMMMMMMMMM
//..,lkXMMMMMMMMMMMMMMMMMMMMMMMMMXOdxXMMMMMMMMMMMx..OMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//..,lkKWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXOkkONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//:.l0NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
//| ==============================================================
//| Definitions
//| ==============================================================
#region FNUTIL
List<Item> PooledList = new List<Item>();
List<Item> GetAllItems(BasePlayer player) {
player.inventory.GetAllItems(PooledList);
return PooledList;
}
#endregion
public enum Card {
Pacifism = 0, //zeros all outgoing damage from target player
InstantKarma = 4, //reflects damage back to the player
Dud = 5, //prevents damage to non-player entities
Sit = 8, //force player to sit
HigherGround = 11, //target player is teleported 100m into the air
NoRest, // No Rest For The Wicked! Force the player to respawn!
ViewLoot, // View target entities loot
Hammer, // hammer - gives target player a hammer that will destroy all the entities owned by the hammer's target
Bag, // Bag - Print all players that have bagged target player in, and print all players that have been bagged.Include "discord" after the command to log the results to discord
//| Payback 2
Woods, // Woods - If you go down to the woods today, be ready for big surprise!
PotatoMode, // PotatoMode - Target's frame rate will decrease dramatically over time - Warning, this is designed to eventually crash Rust
Hogwild, // Hogwild - Ride the cheater around like a pig! REEE!
Interrogate, // Interrogate - Throw a hood over the cheater's head, force them to spill their secrets! They can't see anything unless they speak!!
Spitroast, // Spitroast - Stick 'em with the pointy end and feast on their tears.Roast the cheater roticery style over the fire!
Crucify, // Crucify - It's like the 'sit' command but taken to biblical proportions!
Radiation, // Radiation - Applies a ton of rads to target player
BuggedGun, // BuggedGun - Makes target's weapon bug out and randomly unequip
Bonk, // Bonk - Bonk that cheater right into the ground
Minefield, // Minefield - Continuously generates a minefield around target player (can only hurt the target)
Train, // Train - Hogtie target player to the ground then run em over with a train!
VerbalDiarrhea, // VerbalDiarrhea - Target player starts spewing increasing amounts of horse dung when they use voice chat
PoopRocket, // PoopRocket - Propells a player through the air using organic fuel systems
RecyclePlayer, // Recycle - Recycle target cheater
Batman, // Bat - home runs
OverCompensation, // MegaRecoil - Target player has massive amounts of recoil when they shoot
LagSwitch, // LagSwitch - Target player rubberbands constantly as if experiencing a ton of lag
SlowBurn, // SlowBurn - Target player is burned slowly over time
Flash, // Flash - Flashbang target player repeatedly
NoPickup, // NoPickup - Target player always drops items when they try to pick them up
AirStrike, // AirStrike - Annahilate target player with an F15 fighter
Loudfoot, // Loudfoot - Target player triggers a tin can alarm whever they crouch-move
}
Dictionary<Card, string> descriptions = new Dictionary<Card, string>() {
{
Card.Dud, "target player deals no damage to NON-PLAYER entities.Also prevents farming / tool use"
}
, {
Card.InstantKarma, "target player deals no damage to enemies and 35% of the damage is reflected back to them"
}
, {
Card.Pacifism, "target player deals no player damage to non-teammates; add 'silent' to not send a message about it to other players."
}
, {
Card.Sit, "spawns a chair in front of you and forces the cheater to sit.Doesn't let them get up and will place them back in if they die.add 'beach' or 'gamer' to the end of the command to change the chair prefab!"
}
, {
Card.HigherGround, "target player is teleported 100m into the air"
}
, {
Card.NoRest, "No Rest For The Wicked! Force the player to respawn when they die!"
}
, {
Card.ViewLoot, "View target player's loot"
}
, {
Card.Hammer, "Gives admin a hammer that will destroy all the entities owned by the hammer's target.Add -noloot to also delete the loot"
}
, {
Card.Bag, "Print all players that have bagged target player in, and print all players that have been bagged.Include \"discord\" after the command to log the results to discord"
}
, //| Payback 2
{
Card.Woods, "Target will get attacked by a bear if he's farming wood or stone.Add 'landmine' to strap a bunch of landmines to the bear's face.Add 'force' to instantly spawn the bear"
}
, {
Card.PotatoMode, "Target's frame rate will decrease dramatically over time.-- *Warning, this is designed to crash Rust* | add a number 1-100 after the command to make it faster"
}
, {
Card.Hogwild, "Ride the cheater around like a pig! REEE!"
}
, {
Card.Interrogate, "Throw a hood over the cheater's head, force them to spill their secrets! They can't see anything unless they speak!! Supports spectate mode!"
}
, {
Card.Spitroast, "Stick 'em with the pointy end and feast on their tears.Roast the cheater roticery style over the fire! Add 'fast' after the command for good taste: roast <player> fast"
}
, {
Card.Crucify, "It's like the 'sit' command but taken to biblical proportions!"
}
, {
Card.Radiation, "Applies a ton of rads to target player"
}
, {
Card.BuggedGun, "Prevents target player from using their weapons"
}
, {
Card.Bonk, "Bonk that cheater right into the ground | use bonk on yourself to make anyone you hit bonkable"
}
, {
Card.Minefield, "Continuously generates a minefield around target player (can only hurt the target) -- /mine <targetplayer> <1 to 100> changes the density of the minefield"
}
, {
Card.Train, "Hogtie target player to the ground then run em over with a train!"
}
, {
Card.VerbalDiarrhea, "Target player starts spewing increasing amounts of horse dung when they use voice chat"
}
, {
Card.PoopRocket, "Propells a player through the air using organic fuel systems"
}
, {
Card.RecyclePlayer, "Recycle target cheater"
}
, {
Card.Batman, "Whack players with a bat, aim for that home run! Use this on the batter to give them the power of the bat.Sprint to triple the power, headshots will kill the target! Add -kill parameter to always kill on hit."
}
, {
Card.OverCompensation, "Target player is over compensating for their lack of bulge and ends up shooting into the ground"
}
, {
Card.LagSwitch, "Target player rubberbands constantly as if experiencing a ton of lag.Try different numbers after the command to change the ping"
}
, {
Card.SlowBurn, "Target player is burned slowly over time"
}
, {
Card.Flash, "Target player is flashbanged repeatedly"
}
, {
Card.NoPickup, "Target player always drops items when they try to pick them up"
}
, {
Card.AirStrike, "Annahilate target player with an F15 fighter.add 'unsafe' to enable damage to everything.Add 'precision' to target what you're looking at (great for bases)"
}
, {
Card.Loudfoot, "Target player triggers a tin can alarm whever they crouch-move"
}
,
}
;
Dictionary<string, Card> cardAliases = new Dictionary<string, Card>() {
{
"dud", Card.Dud
}
, {
"in", Card.InstantKarma
}
, {
"pf", Card.Pacifism
}
, {
"hg", Card.HigherGround
}
, {
"nr", Card.NoRest
}
, {
"res", Card.NoRest
}
, {
"loot", Card.ViewLoot
}
, {
"ham", Card.Hammer
}
, {
"bg", Card.Bag
}
, //| Payback 2
{
"bear", Card.Woods
}
, {
"potato", Card.PotatoMode
}
, {
"hog", Card.Hogwild
}
, {
"sack", Card.Interrogate
}
, {
"roast", Card.Spitroast
}
, {
"cr", Card.Crucify
}
, {
"rad", Card.Radiation
}
, {
"bug", Card.BuggedGun
}
, {
"bk", Card.Bonk
}
, {
"mine", Card.Minefield
}
, {
"tr", Card.Train
}
, {
"vd", Card.VerbalDiarrhea
}
, {
"shitter", Card.VerbalDiarrhea
}
, {
"poop", Card.PoopRocket
}
, {
"pr", Card.PoopRocket
}
, {
"re", Card.RecyclePlayer
}
, {
"bat", Card.Batman
}
, {
"recoil", Card.OverCompensation
}
, {
"lag", Card.LagSwitch
}
, {
"sb", Card.SlowBurn
}
, {
"fl", Card.Flash
}
, {
"np", Card.NoPickup
}
, {
"as", Card.AirStrike
}
, {
"lf", Card.Loudfoot
}
,
}
;
HashSet<Card> cardsWhichCauseConflicts = new HashSet<Card>() {
Card.Sit, Card.Crucify, Card.Hogwild, Card.Spitroast, Card.Train, Card.PoopRocket, Card.RecyclePlayer, Card.Batman, Card.LagSwitch,
}
;
HashSet<Card> cardsWhichCanPersist = new HashSet<Card>() {
//Card.Butterfingers,
Card.Dud, Card.InstantKarma, Card.Pacifism, //Card.DogDoo,
//Card.BSOD,
//Card.Thirsty,
//Card.DrNo,
Card.NoRest, //Card.ChickenChaser,
//Card.Masochist,
Card.Woods, Card.PotatoMode, Card.Interrogate, Card.Radiation, Card.BuggedGun, Card.Minefield, Card.VerbalDiarrhea, Card.OverCompensation, Card.LagSwitch, Card.SlowBurn, Card.Flash, Card.NoPickup, Card.Loudfoot,
}
;
HashSet<Card> cardsThatNeedNoTarget = new HashSet<Card>() {
Card.AirStrike,
}
;
//| ==============================================================
//| Giving
//| ==============================================================
public void GiveCard(ulong userID, Card card, string[] args = null, BasePlayer admin = null) {
//Puts($"Payback card {card} given to {userID}");
BasePlayer player = BasePlayer.FindByID(userID);
if (cardsWhichCauseConflicts.Contains(card)) {
ResolveConflictingCommands(player, admin, (int)card);
}
HashSet<Card> cards;
if (!cardMap.TryGetValue(userID, out cards)) {
cards = new HashSet<Card>();
cardMap[userID] = cards;
}
cards.Add(card);
if (player != null) {
if (card == Card.Sit) {
DoSitCommand(player, admin, args);
}
else if (card == Card.HigherGround) {
DoHigherGround(player);
}
else if (card == Card.Pacifism) {
silentPacifism = false;
if (args != null) {
if (args.Contains("silent")) {
silentPacifism = true;
}
}
}
else if (card == Card.NoRest) {
if (player.IsDead()) {
player.Respawn();
}
}
else if (card == Card.ViewLoot) {
ViewTargetPlayerInventory(player, admin);
TakeCard(player, Card.ViewLoot);
}
else if (card == Card.Hammer) {
GiveAdminHammer(player);
if (args.Contains("noloot")) {
flag_kill_no_loot = true;
PrintToPlayer(admin, $"Hammer set to remove loot!");
}
else {
flag_kill_no_loot = false;
}
}
else if (card == Card.Woods) {
if (args.Contains("landmine")) {
woodsHasLandmines.Add(player.userID);
}
else {
woodsHasLandmines.Remove(player.userID);
}
if (args.Contains("force")) {
DoWoods(player);
}
}
else if (card == Card.PotatoMode) {
DoPotato(player, admin, args);
}
else if (card == Card.Hogwild) {
DoHog(player, admin, args);
}
else if (card == Card.Interrogate) {
DoInterrogate(player, admin, args);
}
else if (card == Card.Spitroast) {
DoSpitroastCommand(player, admin, args);
}
else if (card == Card.Crucify) {
DoCrucifyCommand(player, admin);
}
else if (card == Card.Radiation) {
DoRadiation(player, admin);
}
else if (card == Card.BuggedGun) {
DoBuggedGun(player, admin);
}
else if (card == Card.Bonk) {
DoBonk(player, admin);
}
else if (card == Card.Minefield) {
DoMinefield(player, admin, args);
}
else if (card == Card.Train) {
DoTrain(player, admin, args);
}
else if (card == Card.VerbalDiarrhea) {
DoVerbalDiarrhea(player, admin, args);
}
else if (card == Card.PoopRocket) {
DoPoopRocket(player, admin, args);
}
else if (card == Card.RecyclePlayer) {
DoRecycle(player, admin, args);
}
else if (card == Card.Batman) {
DoBat(player, admin, args);
}
else if (card == Card.OverCompensation) {
DoOverCompensation(player, admin, args);
}
else if (card == Card.LagSwitch) {
DoLagSwitch(player, admin, args);
}
else if (card == Card.SlowBurn) {
DoSlowBurn(player, admin, args);
}
else if (card == Card.Flash) {
DoFlash(player, admin, args);
}
else if (card == Card.AirStrike) {
DoAirstrike(player, admin, args);
}
else if (card == Card.Loudfoot) {
DoLoudfoot(player, admin, args);
}
if (config.logPaybackCommands) {
if (config.logPaybackCommands) {
SendToDiscordWebhook(new Dictionary<string, string>() {
{
"Admin", $"{admin?.displayName} | {admin?.userID}"
}
, {
$"{card.ToString()}", $"{player.displayName} | {player?.userID}"
}
,
}
, $"{ConVar.Server.hostname}");
}
}
//| if we are saving commands and this command can be saved, do the saving
if (config.persistentCommands && cardsWhichCanPersist.Contains(card)) {
HashSet<Card> persistentCards = null;
if (!paybackData.persistentCommandMap.TryGetValue(player.userID, out persistentCards)) {
persistentCards = new HashSet<Card>();
paybackData.persistentCommandMap[player.userID] = persistentCards;
}
persistentCards.Add(card);
}
}
}
bool silentPacifism = false;
#region VISUALIZATION
string url_payback_logo = "http://na.fragmod.com/fragimages/dec2023/payback_logo_broad.png";
string url_payback_logo_raised = "http://na.fragmod.com/fragimages/dec2023/payback_logo_broad_down.png";
List<BasePlayer> admins = new List<BasePlayer>();
float ts_admin = 0;
//| ===================================================
List<ulong> adminsNoUI = new List<ulong>();
[ConsoleCommand("paybacknoui2")]
void Console_Payback_NoUI2(ConsoleSystem.Arg arg) {
var player = arg.Connection?.player as BasePlayer;
if (player != null) {
if (!IsAdmin(player)) return;
if (!adminsNoUI.Contains(player.userID)) {
adminsNoUI.Add(player.userID);
PrintToPlayer(player, "paybackui disabled");
UpdateAdminUI(player);
}
else {
adminsNoUI.Remove(player.userID);
PrintToPlayer(player, "paybackui enabled");
UpdateAdminUI(player);
}
}
}
//| ===================================================
void CacheAdmins() {
if (Time.realtimeSinceStartup - ts_admin > 3) {
ts_admin = Time.realtimeSinceStartup;
admins.Clear();
foreach (var player in BasePlayer.activePlayerList) {
if (IsAdmin(player)) {
admins.Add(player);
}
}
}
}
int currentActiveCardCount = 0;
IEnumerator AdminVisualizationCo() {
while (config.showUI && Payback == null) {
var allCards = GetActiveCards();
currentActiveCardCount = allCards.Count;
//if (Payback2 != null)
//{
// var otherCards = Payback2.Call("GetActiveCardsStrings") as List<string>;
// currentActiveCardCount += otherCards.Count;
//}
if (cachedCards != currentActiveCardCount) {
animState = 1;
animationFlag = true;
}
else {
if (animState != 0) {
animationFlag = true;
}
animState = 0;
}
foreach (var admin in admins) {
if (admin == null) continue;
UpdateAdminUI(admin);
}
animationFlag = false;
cachedCards = currentActiveCardCount;
CacheAdmins();
yield return new WaitForSeconds(0.3f);
}
}
HashSet<Card> GetActiveCards() {
HashSet<Card> allCards = new HashSet<Card>();
foreach (var userid in cardMap.Keys.ToArray()) {
var target = BasePlayer.FindByID(userid);
if (target == null) continue;
var cards = cardMap[userid];
if (cards == null || cards.Count == 0) continue;
allCards.UnionWith(cards);
}
return allCards;
}
//| Bridge to other Payback
List<string> GetActiveCardsStrings() {
List<string> cards = new List<string>();
foreach (var card in GetActiveCards()) {
cards.Add(card.ToString());
}
return cards;
}
int cachedCards = 0;
int animState = 0;
bool animationFlag = false;
HashSet<ulong> activePaybackUIS = new HashSet<ulong>();
void UpdateAdminUI(BasePlayer player) {
//| disable showing the UI
if (!config.showUI) {
return;
}
//| ===================================
//| BASE UI SETUP
//| ===================================
if (player.net.connection == null) return;
string guid = "guid_admin";
UI2.guids.Add(guid);
var elements = new CuiElementContainer();
if (currentActiveCardCount == 0 || adminsNoUI.Contains(player.userID)) {
CuiHelper.DestroyUi(player, guid);
activePaybackUIS.Remove(player.userID);
return;
}
if (animState == 1) {
CuiHelper.DestroyUi(player, "payback_logo");
}
if (animState == 0) {
CuiHelper.DestroyUi(player, "payback_logo_raised");
}
//| refresh the commands
CuiHelper.DestroyUi(player, "commands");
//| ===================================
//| Bounds definitions
//| ===================================
float width = 0.4f;
//float height = 0.2f;
float logoWidth = 0.125f;
Vector4 mainBounds = new Vector4(0.5f - width / 2f, 0.5f, 0.5f + width / 2f, 0.9f);
Vector4 logoBounds = new Vector4(0.5f - logoWidth / 2f, 0.90f, 0.5f + logoWidth / 2f, 1f);
string output = "";
var allCards = GetActiveCards();
foreach (var card in allCards) {
output += $"{UI2.ColorText("•", "#B00101")} {card.ToString()}" + "\n";
}
//if (Payback2 != null)
//{
// var otherCards = Payback2.Call("GetActiveCardsStrings") as List<string>;
// foreach (var card in otherCards)
// {
// output += $"{UI2.ColorText("•", "#B00101")} {card.ToString()}" + "\n";
// }
//}
bool updateLogo = false;
if (!activePaybackUIS.Contains(player.userID)) {
UI2.CreatePanel(elements, "Under", guid, "1 1 1 0", UI2.vectorFullscreen, null, false);
activePaybackUIS.Add(player.userID);
updateLogo = true;
}
if (animationFlag) {
updateLogo = true;
}
if (updateLogo) {
if (ImageLibrary != null) {
if (animState == 0) {
UI2.CreatePanel(elements, guid, "payback_logo", "1 1 1 1", logoBounds, GetImage(url_payback_logo), false, 0.0f, 0.0f, true);
}
else if (animState == 1) {
UI2.CreatePanel(elements, guid, "payback_logo_raised", "1 1 1 1", logoBounds, GetImage(url_payback_logo_raised), false, 0.0f, 0.0f, true);
}
}
else {
if (animState == 0) {
UI2.CreatePanel(elements, guid, "payback_logo", "1 1 1 1", logoBounds, GetImage(url_payback_logo), false, 0.0f, 0.0f, false);
}
else if (animState == 1) {
UI2.CreatePanel(elements, guid, "payback_logo_raised", "1 1 1 1", logoBounds, GetImage(url_payback_logo_raised), false, 0.0f, 0.0f, false);
}
}
}
UI2.CreateOutlineLabel(elements, guid, "commands", output, "1 1 1 1", 28, mainBounds, TextAnchor.UpperCenter);
//| ===================================
//| CONDITIONAL UI UPDATES
//| ===================================
//send the ui updates
if (elements.Count > 0) {
CuiHelper.AddUi(player, elements);
}
}
#endregion
//| ==============================================================
//| COMMAND Implementation
//| ==============================================================
string prefab_tincan = "assets/prefabs/deployable/playerioents/detectors/tincanalarm/tincan.alarm.deployed.prefab";
Dictionary<BasePlayer, BaseEntity> tinCanMap = new Dictionary<BasePlayer, BaseEntity>();
void DoLoudfoot(BasePlayer targetPlayer, BasePlayer adminPlayer, string[] args) {
Worker.StaticStartCoroutine(TinCanTarget(targetPlayer));
}
IEnumerator TinCanTarget(BasePlayer targetPlayer) {
var canEntity = GameManager.server.CreateEntity(prefab_tincan, targetPlayer.transform.position);
canEntity.transform.position = targetPlayer.transform.position + Vector3.up * -2f;
canEntity.Spawn();
DestroyGroundCheck(canEntity);
entitiesThatDealNoDamage.RemoveWhere(x => x == null || x.IsDestroyed);
entitiesThatDealNoDamage.Add(canEntity);
bool crouchFlag = false;
Vector3 lastPlayerPosition = targetPlayer.transform.position;
float tsLastAlarm = Time.time;
float minimumTimeBetweenAlarms = 2f;
while (targetPlayer != null && HasCard(targetPlayer.userID, Card.Loudfoot) && canEntity != null) {
if (targetPlayer.IsDucked() && crouchFlag && Time.time - tsLastAlarm > minimumTimeBetweenAlarms + UnityEngine.Random.Range(0, 2)) {
float d = Vector3.Distance(targetPlayer.transform.position, lastPlayerPosition);
if (d > 0.1f) {
canEntity.ClientRPC(RpcTarget.NetworkGroup("RPC_TriggerAlarm"));
tsLastAlarm = Time.time;
lastPlayerPosition = targetPlayer.transform.position;
}
}
if (targetPlayer.IsDucked() && !crouchFlag) {
crouchFlag = true;
lastPlayerPosition = targetPlayer.transform.position;
tsLastAlarm = Time.time;
}
if (!targetPlayer.IsDucked()) {
crouchFlag = false;
}
canEntity.transform.position = targetPlayer.transform.position + Vector3.up * -4f;
canEntity.SendNetworkUpdate();
yield return new WaitForFixedUpdate();
}
if (targetPlayer != null) {
TakeCard(targetPlayer, Card.Loudfoot);
}
canEntity?.Kill();
}
string jetfighterprefab = "assets/scripts/entity/misc/f15/f15e.prefab";
bool airstrikeIsUnsafe = false;
string sound_mlrs = $"assets/prefabs/gamemodes/objects/capturepoint/effects/capturepoint_progress_beep.prefab";
string sound_mlrs_2 = $"assets/prefabs/gamemodes/objects/capturepoint/effects/capturepoint_progress_complete.prefab";
void DoAirstrike(BasePlayer targetPlayer, BasePlayer adminPlayer, string[] args) {
TakeCard(targetPlayer, Card.AirStrike);
Vector2 offset = UnityEngine.Random.insideUnitCircle;
offset.Normalize();
offset = offset * 1200;
F15 fighter = GameManager.server.CreateEntity(jetfighterprefab, targetPlayer.transform.position + new Vector3(offset.x, 0, offset.y)) as F15;
fighter.enabled = false;
fighter.Spawn();
airstrikeIsUnsafe = false;
if (args.Contains("unsafe")) {
airstrikeIsUnsafe = true;
}
Vector3 precisionStrikeLocation = Vector3.zero;
bool usePrecisionStrike = false;
if (args.Contains("precision")) {
airstrikeIsUnsafe = true;
precisionStrikeLocation = RaycastStatic(adminPlayer.eyes.HeadRay());
targetPlayer = adminPlayer;
usePrecisionStrike = true;
}
Worker.StaticStartCoroutine(FighterCo(fighter, targetPlayer, adminPlayer, precisionStrikeLocation, usePrecisionStrike));
}
string mlrs_rocket_prefab = "assets/content/vehicles/mlrs/rocket_mlrs.prefab";
List<BaseEntity> airstrikeRockets = new List<BaseEntity>();
HashSet<ulong> airstrikeTargetPlayers = new HashSet<ulong>();
IEnumerator FighterCo(F15 fighter, BasePlayer targetPlayer, BasePlayer adminPlayer, Vector3 precisionStrike, bool usePrecisionStrike) {
entitiesThatDealNoDamage.RemoveWhere(x => x == null || x.IsDestroyed);
entitiesThatDealNoDamage.Add(fighter);
airstrikeRockets.RemoveAll(x => x == null || x.IsDestroyed);
if (!usePrecisionStrike) {
airstrikeTargetPlayers.Add(targetPlayer.userID);
}
float flyoverDuration = 15;
float dipStartTime = 0.3f;
float dipEndTime = 0.6f;
float dipHeight = 75f;
float tsStart = Time.time;
float height = 100;
Vector3 flightVector = targetPlayer.transform.position - fighter.transform.position;
flightVector.y = 0;
float flightDistance = 2 * flightVector.magnitude;
flightVector.Normalize();
Vector3 targetPosition = Vector3.zero;
Vector3 startPosition = fighter.transform.position;
Vector3 endPosition = startPosition + flightVector * flightDistance;
Vector3 lastPosition = fighter.transform.position;
float p = 0;
Vector3 anchor = (startPosition + endPosition) / 2f;
startPosition = startPosition - anchor;
endPosition = endPosition - anchor;
startPosition.y = 0;
endPosition.y = 0;
Vector3 lastKnownTargetPosition = targetPlayer.transform.position;
if (usePrecisionStrike) {
lastKnownTargetPosition = precisionStrike;
}
//| combat
int rockets = 6;
float rocketCooldown = 0.15f;
float lastRocketTs = Time.time;
float payloadStartTime = 0.42f;
//| precision hud targeting
float tsLastHudUpdate = Time.time;
float hudUpdateDuration = 0.3f;
while (fighter != null && !fighter.IsDead() && p < 1) {
p = (Time.time - tsStart) / flyoverDuration;
targetPosition = Vector3.Lerp(startPosition, endPosition, p);
if (p > dipStartTime && p < dipEndTime) {
float x = (p - dipStartTime) / (dipEndTime - dipStartTime);
targetPosition.y = startPosition.y - Mathf.Lerp(0, dipHeight, (float) Mathf.Sin(x * (float) Math.PI) );
}
if (!usePrecisionStrike && targetPlayer != null && !targetPlayer.IsDead()) {
lastKnownTargetPosition = targetPlayer.transform.position;
}
targetPosition += lastKnownTargetPosition + Vector3.up * height;
fighter.transform.position = targetPosition;
fighter.transform.LookAt(targetPosition + (targetPosition - lastPosition), Vector3.up);
lastPosition = targetPosition;
fighter.SendNetworkUpdate();
//| combat
if (rockets > 0 && (Time.time - lastRocketTs) > rocketCooldown && p > payloadStartTime) {
lastRocketTs = Time.time;
rockets--;
Vector3 capturedLastPos = lastPosition;
Vector3 capturedLastKnownPos = lastKnownTargetPosition + Vector3.up * 5;
// delay for visual impact
timer.Once(1f, () => {
var rocket = GameManager.server.CreateEntity(mlrs_rocket_prefab, capturedLastPos, fighter.transform.rotation);
rocket.Spawn();
var rb = rocket.GetComponent<Rigidbody>();
if (rb != null) {
rb.isKinematic = false;
rb.useGravity = false;
}
MLRSRocket mRocket = rocket as MLRSRocket;
if (mRocket != null) {
mRocket.enabled = false;
}
var targetVelocity = (capturedLastKnownPos - capturedLastPos);
targetVelocity.Normalize();
//targetVelocity += Vector3.up * 0.1f;
targetVelocity *= 150;
rocket.SetVelocity(targetVelocity);
rocket.transform.LookAt(capturedLastKnownPos);
rocket.creatorEntity = rocket;
airstrikeRockets.Add(rocket);
}
);
}
if (airstrikeRockets.Count > 0) {
foreach (var r in airstrikeRockets) {
if (r != null) {
var rb = r.GetComponent<Rigidbody>();
if (rb != null) {
r.transform.LookAt(r.transform.position + rb.velocity);
}
}
}
}
if (p < 0.6f && Time.time - tsLastHudUpdate > hudUpdateDuration) {
tsLastHudUpdate = Time.time;
ShowText(adminPlayer.userID, "precisionstrike", $"{ColorText($"◯", "red")}", hudUpdateDuration, lastKnownTargetPosition, 64, true);
if (p < 0.42f) {
PlaySFX(adminPlayer, sound_mlrs);
}
else {
PlaySFX(adminPlayer, sound_mlrs_2);
}
}
yield return new WaitForFixedUpdate();
}
fighter?.Kill();
if (!usePrecisionStrike) {
ulong id = targetPlayer.userID;
timer.Once(5f, () => {
airstrikeTargetPlayers.Remove(id);
}
);
}
yield return null;
}
object OnItemPickup(Item item, BasePlayer player) {
if (HasCard(player.userID, Card.NoPickup)) {
timer.Once(0.1f, () => {
if (player != null && GetAllItems(player).Contains(item)) {
var velocity = player.eyes.HeadRay().direction * 5;
item.Drop(player.transform.position + Vector3.up * 1.5f, velocity);
}
}
);
}
return null;
}
void DoFlash(BasePlayer targetPlayer, BasePlayer adminPlayer, string[] args) {
Worker.StaticStartCoroutine(DoFlashCo(targetPlayer));
}
IEnumerator DoFlashCo(BasePlayer player) {
var flashbang2 = GameManager.server.CreateEntity("assets/prefabs/weapons/flashbang/grenade.flashbang.deployed.prefab", player.transform.position) as Flashbang;
flashbang2.Spawn();
flashbang2.SetFuse(float.MaxValue);
while (player != null && HasCard(player.userID, Card.Flash) && player.net.connection != null) {
yield return new WaitForSeconds(1.0f + Random() * 1.75f);
flashbang2?.ClientRPCEx(new SendInfo(new List<Connection>() {
player.Connection
}
), null, "Client_DoFlash", player.transform.position);
PlaySound("assets/prefabs/weapons/flashbang/effects/fx-flashbang-boom.prefab", player, false);
}
flashbang2?.Kill();
}
void DoSlowBurn(BasePlayer targetPlayer, BasePlayer adminPlayer, string[] args) {
Worker.StaticStartCoroutine(DoSlowBurnCo(targetPlayer));
}
IEnumerator DoSlowBurnCo(BasePlayer player) {
while (player != null && !player.IsDead() && HasCard(player.userID, Card.SlowBurn) && player.net.connection != null) {
HitInfo info = new HitInfo(null, player, DamageType.Heat, 1.0f);
player.Hurt(info);
PlaySound("assets/bundled/prefabs/fx/fire/fire_v2.prefab", player);
DoScreaming(player, null, true);
Effect.server.Run("assets/bundled/prefabs/fx/impacts/additive/fire.prefab", player, 0u, new Vector3(0f, 1f, 0f), Vector3.up);
yield return new WaitForSeconds(1);
}
TakeCard(player, Card.SlowBurn);
}
void DoLagSwitch(BasePlayer targetPlayer, BasePlayer adminPlayer, string[] args) {
float multiplier = 1;
if (args != null && args.Length > 0) {
if (!float.TryParse(args[0], out multiplier)) {
multiplier = 1;
}
}
Worker.StaticStartCoroutine(LagSwitchCo(targetPlayer, multiplier));
}
// ... [Code preview truncated due to length. Full source in attached file] ...