Skip to content

Commit

Permalink
Plugins Source Code
Browse files Browse the repository at this point in the history
  • Loading branch information
punteroo committed Feb 2, 2021
1 parent 93cdfe2 commit 74c96e4
Show file tree
Hide file tree
Showing 11 changed files with 2,218 additions and 0 deletions.
37 changes: 37 additions & 0 deletions configs/vip-system.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// V I P M A N A G E M E N T C O N F I G
//
// This configuration file is utilized to manage the plugins' behaivour. All commands utilized by VIP members of your community
// will be here. I'll spit some information about what the plugin does and how to use this CFG file correctly as well.
//
// This plugin is a fast and easy menu utilized to concise all VIP / Donator commands into one. It is highly customizable and
// stable, it is optimized to not lag any server on its usage. You can customize the menu's title, options, descriptions, etc.
// I've made an example configuration below (you must modify it at your liking) for you to check out how everything works and
// how to change what. Keep in mind, the limit of commands by default is 30. This can be changed in the plugins' code.
// Here are all the effect attributes cause on the plugin (i planned more but they're unnecesary for now :3):
//
// command - The command the user executes once he selects that option. If it's a command whose case is similar to the noclip one
// explained above, then leave it blank. If it's left blank no command will be executed on the user.
//
// level - Determines the VIP "level" to use that command (or have it even listed). It is currently disabled as it will not be
// used.
//

"VIP-System"
{
"Menu - Inusuales"
{
"command" "sm_unu"
}
"Menu - Killstreaks"
{
"command" "sm_killstreak"
}
"Toggle - Australiums"
{
"command" "sm_aussie"
}
"Noclip"
{
"command" "sm_noclip @me"
}
}
58 changes: 58 additions & 0 deletions scripting/custom-includes/paintcosmetics.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include <tf2idb>
#include <tf2attributes>

enum struct PaintedHat {
// This enum controls a player's painted hats status.
// A maximum of 3 painted hats can be used at a time.
float values[3];
int hatIndex;

void WriteValues(float[3] buffer) {
for (int i = 0; i < 3; i++)
buffer[i] = this.values[i];
}
}

// Returns wether or not an Item Definition Index is paintable or not.
bool IsHatPaintable(int iItemDefinitionIndex)
{
char strItemDefinitionIndex[32];
IntToString(iItemDefinitionIndex, strItemDefinitionIndex, 32);

ArrayList arg = CreateArray(sizeof(strItemDefinitionIndex));
arg.PushString(strItemDefinitionIndex);

DBStatement result = TF2IDB_CustomQuery("SELECT capability FROM tf2idb_capabilities WHERE id = ?", arg, sizeof(strItemDefinitionIndex));
if (result != INVALID_HANDLE) {
while (SQL_FetchRow(result)) {
char capability[64];
SQL_FetchString(result, 0, capability, sizeof(capability));

if (StrEqual(capability, "paintable"))
return true;
}
}
return false;
}

// Writes an array of all paint values present on a CTFWearable entity index, if any.
// If there was no present paint, 0.0 is returned. Else just returns the paint value present.
void GetPaint(float[] val, int[] ids, int amount, float paints[3])
{
for (int i = 0; i < amount; i++) {
switch (ids[i]) {
case 142:
paints[0] = val[i];
case 261:
paints[1] = val[i];
case 1004:
paints[2] = val[i];
}
}
}


#if defined _INCLUDE_included
#endinput
#endif
#define _INCLUDE_included
151 changes: 151 additions & 0 deletions scripting/include/killstreak-class.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
methodmap KsClient < StringMap {
public KsClient() {
return view_as<KsClient>(new StringMap());
}

// Initializes all values to 0
public void Initialize() {
this.SetValue("type", 0.0);
this.SetValue("sheen", 0.0);
this.SetValue("streaker", 0.0);
this.SetValue("all", false);
}

// Temporary slot selection. Stores the selected slot on the menu to work with.
public void SetSlot(int slot) {
this.SetValue("slot", slot);
}

// Temporary slot selection. Gets the selected slot on the menu to work with.
public int GetSlot() {
int slot;
this.GetValue("slot", slot);

return slot;
}

// Sets the type of Killstreak the client chose.
public void SetType(float val, int slot) {
bool all;
this.GetValue("all", all);

if (!all) {
float type[3];
this.GetArray("type", type, sizeof(type));

type[slot] = val;
this.SetArray("type", type, sizeof(type));
}
else
this.SetValue("type", val);
}

// Sets the sheen of a Specialized Killstreak the client chose.
public void SetSheen(float val, int slot) {
bool all;
this.GetValue("all", all);

if (!all) {
float sheen[3];
this.GetArray("sheen", sheen, sizeof(sheen));

sheen[slot] = val;
this.SetArray("sheen", sheen, sizeof(sheen));
}
else
this.SetValue("sheen", val);
}

// Sets the killstreaker of a Professional Killstreak the client chose.
public void SetStreaker(float val, int slot) {
bool all;
this.GetValue("all", all);

if (!all) {
float streaker[3];
this.GetArray("streaker", streaker, sizeof(streaker));

streaker[slot] = val;
this.SetArray("streaker", streaker, sizeof(streaker));
}
else
this.SetValue("streaker", val);
}

// Changes if the mode is for all weapons or not.
public void AllWeapons(bool mode) {
this.SetValue("all", mode);
}

// Gets the current type array (index is slot).
public void GetType(float array[3]) {
bool all;
this.GetValue("all", all);

if (!all) {
float t[3];
this.GetArray("type", t, sizeof(t));
array = t;
}
else {
float t1[3], t2;
this.GetValue("type", t2);

for (int i = 0; i < sizeof(t1); i++)
t1[i] = t2;

array = t1;
}
}

// Gets the current sheen array (index is slot).
public void GetSheen(float array[3]) {
bool all;
this.GetValue("all", all);

if (!all) {
float s[3];
this.GetArray("sheen", s, sizeof(s));

array = s;
}
else {
float s1[3], s2;
this.GetValue("sheen", s2);

for (int i = 0; i < sizeof(s1); i++)
s1[i] = s2;

array = s1;
}
}

// Gets the current killstreaker array (index is slot).
public void GetStreaker(float array[3]) {
bool all;
this.GetValue("all", all);

if (!all) {
float st[3];
this.GetArray("streaker", st, sizeof(st));
array = st;
}
else {
float st1[3], st2;
this.GetValue("streaker", st2);

for (int i = 0; i < sizeof(st1); i++)
st1[i] = st2;

array = st1;
}
}

// Checks if the client has All Weapons Mode.
public bool IsAllMode() {
bool all;
this.GetValue("all", all);

return all;
}
}
127 changes: 127 additions & 0 deletions scripting/include/unusual-class.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// Unusual Class
methodmap UnusualClient < StringMap {
public UnusualClient() {
return view_as<UnusualClient>(new StringMap());
}

public void Initialize() {
this.SetValue("slot", 0);
this.SetArray("id", { 0, 0, 0 }, 3);
this.SetArray("unusual", { 0.0, 0.0, 0.0 }, 3);
}

// SetSlot() - Temporary function, used only to keep track of the slot selected by the user.
public void SetSlot(int slot) {
this.SetValue("slot", slot);
}

// SetId() - Temporary function, used only to keep track of the item ID selected by the user.
public void SetId(int id) {
int slot;
this.GetValue("slot", slot);

int arr[3];
if (!this.GetArray("id", arr, sizeof(arr)))
arr = { 0, 0, 0 };
arr[slot] = id;
this.SetArray("id", arr, sizeof(arr));
}

// SetUnusual() - Sets the Unusual effect the user chose.
// Keep in mind, a max of 3 different effects and hats can be chosen.
public void SetUnusual(float eff) {
int slot;
this.GetValue("slot", slot);

float unu[3];
if (!this.GetArray("unusual", unu, sizeof(unu)))
unu = { 0.0, 0.0, 0.0 };

unu[slot] = eff;
this.SetArray("unusual", unu, sizeof(unu));
}

public int GetSlot() {
int slot;
this.GetValue("slot", slot);

return slot;
}

// GetId() - Gets the ID at a certain slot.
// Empty slots (no unusual) is identified with 0.0 content.
public int GetId(int slot) {
int id[3];
this.GetArray("id", id, sizeof(id));

return id[slot];
}

// GetUnusual() - Gets the unusual array the client has currently on n slot.
// Empty slots (no unusual) is identified with 0.0 content.
public float GetUnusual(int slot) {
float unusual[3];
this.GetArray("unusual", unusual, sizeof(unusual));

return unusual[slot];
}
}

// Unusual Particle Effects List
int unusualIds[138] = {
0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 43, 44, 45, 46, 47, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110,
111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
137, 138, 139, 141, 142, 143, 144, 145, 147, 148, 149,
150, 151, 152, 153, 154, 155,
156, 157, 158, 159, 160, 161, 162, 163
};

char unusualNames[138][64] = {
"Ninguno", "Green Confetti", "Purple Confetti", "Haunted Ghosts", "Green Energy",
"Purple Energy", "Circling TF Logo", "Massed Flies", "Burning Flames",
"Scorching Flames", "Searing Plasma", "Vivid Plasma", "Sunbeams",
"Circling Peace Sign", "Circling Heart", "Stormy Storm", "Blizzardy Storm",
"Nuts n' Bolts", "Orbiting Planets", "Orbiting Fire", "Bubbling", "Smoking",
"Steaming", "Flaming Lantern", "Cloudy Moon", "Cauldron Bubbles", "Eerie Orbiting Fire",
"Knifestorm", "Misty Skull", "Harvest Moon", "It's A Secret To Everybody",
"Stormy 13th Hour", "Kill-a-Watt", "Terror-Watt", "Cloud 9", "Aces High",
"Dead Presidents", "Miami Nights", "Disco Beat Down", "Phosphorous", "Sulphurous",
"Memory Leak", "Overclocked", "Electrostatic", "Power Surge", "Anti-Freeze",
"Time Warp", "Green Black Hole", "Roboactive", "Arcana", "Spellbound",
"Chiroptera Venenata", "Poisoned Shadow", "Something Burning This Way Comes",
"Hellfire", "Darkblaze", "Demonflame", "Bonzo The All-Gnawing", "Amaranthine",
"Stare From Beyond", "The Ooze", "Ghastly Ghosts Jr", "Haunted Phantasm Jr",
"Frostbite", "Molten Mallard", "Morning Glory", "Death at Dusk", "Abduction",
"Atomic", "Subatomic", "Electric Hat Protector", "Magnetic Hat Protector",
"Voltaic Hat Protector", "Galactic Codex", "Ancient Codex", "Nebula", "Death by Disco",
"It's a mystery to everyone", "It's a puzzle to me", "Ether Trail", "Nether Trail",
"Ancient Eldritch", "Eldritch Flame", "Neutron Star", "Tesla Coil", "Starstorm Insomnia",
"Starstorm Slumber", "Brain Drain", "Open Mind", "Head of Steam", "Galactic Gateway",
"The Eldritch Opening", "The Dark Doorway", "Ring of Fire", "Vicious Circle", "White Lightning",
"Omniscient Orb", "Clairvoyance", "Fifth Dimension", "Vicious Vortex", "Menacing Miasma", "Abyssal Aura",
"Wicked Wood", "Ghastly Grove", "Mystical Medley", "Ethereal Essence", "Twisted Radiance",
"Violet Vortex", "Verdant Vortex", "Valiant Vortex", "Sparkling Lights", "Frozen Icefall",
"Fragmented Gluons", "Fragmented Quarks", "Fragmented Photons", "Defragmenting Reality",
"Fragmenting Reality", "Refragmenting Reality", "Snowfallen", "Snowblinded", "Pyroland Daydream",
"Verdatica", "Aromatica", "Chromatica", "Prismatica", "Bee Swarm", "Frisky Fireflies", "Smoldering Spirits",
"Wandering Wisps", "Kaleidoscope",
"Green Giggler", "Laugh-O-Lantern", "Plum Prankster", "Pyroland Nightmare", "Gravelly Ghoul", "Vexed Volcanics",
"Gourdian Angels", "Pumpkin Party"
};

// AddUnusuals(Menu menu) - Adds all Unusual Effects to a menu.
void AddUnusuals(Menu menu)
{
for (int i = 0; i < sizeof(unusualIds); i++) {
char id[5];
IntToString(unusualIds[i], id, sizeof(id));

AddMenuItem(menu, id, unusualNames[i]);
}
}
Loading

0 comments on commit 74c96e4

Please sign in to comment.