Sourcemod Plugins: Difference between revisions

From Empires Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
(36 intermediate revisions by the same user not shown)
Line 14: Line 14:
== Sourcemod offsets and signatures ==
== Sourcemod offsets and signatures ==
Calculating updated sourcemod vtable offsets: https://forums.empiresmod.com/index.php?threads/calculating-updated-sourcemod-vtable-offsets.20571/ <br />
Calculating updated sourcemod vtable offsets: https://forums.empiresmod.com/index.php?threads/calculating-updated-sourcemod-vtable-offsets.20571/ <br />
Updated game.empires.txt for sdkhooks (16.3.2017 emp 2.11.3): https://forums.empiresmod.com/index.php?attachments/game-empires-txt.1358/ <br />
'''Neoonys empires ready offsets and signatures release (22.03.2017):''' https://github.com/Neoony/Empires-SM-offsets-signatures/releases


If you have issues with invalid signatures. <br />
If you have issues with invalid signatures. <br />
Line 21: Line 21:
L 03/18/2017 - 00:02:51: [SM] Exception reported: Entity Outputs are disabled - See error logs for details</pre>
L 03/18/2017 - 00:02:51: [SM] Exception reported: Entity Outputs are disabled - See error logs for details</pre>


Replace the linux signatures in sdkhooks and sdktools files with the mac signatures.  <br />
'''Choice 1.''' '''Just download this release of offsets and signatures:''' https://github.com/Neoony/Empires-SM-offsets-signatures/releases <br />
'''Choice 2.''' Replace the linux signatures in sdkhooks and sdktools files with the mac signatures. (this is already included in the above release) <br />
This is rather temporary fix and needs testing <br />
This is rather temporary fix and needs testing <br />
Example: <br />
Example: <br />
Line 38: Line 39:
}
}
}</pre>
}</pre>
== Plugin-Making tips ==
Dumping:
To get a dump of entity properties specific to empires and similar things, use following commands. <br />
'''"sm_dump_teprops"''' - Dumps tempentity props to a file <br />
'''"sm_dump_netprops_xml"''' - Dumps the networkable property table as an XML file <br />
'''"sm_dump_netprops"''' - Dumps the networkable property table as a text file <br />
'''"sm_dump_classes"''' - Dumps the class list as a text file  <br />
'''"sm_dump_datamaps"''' - Dumps the data map list as a text file <br />
'''"sm_dump_admcache"''' - Dumps the admin cache for debugging  <br />
'''"sm_dump_handles"''' - Dumps Handle usage to a file for finding Handle leaks  <br />
Just add a filename after the command and you will find the dump files in empires folder.  <br />
Just using some of those commands might make your client/server hang or even crash, but it will probably still make the dump, or just retry.  <br />
------
'''Colors for messages:''' <br />
Custom colors usable by PrintToChat and similar. <br />
''Examples:'' <br />
<pre>\x079764FF BE
\x07FF2323 NF
PrintToChatAll("\x04[PLUGIN]\x079764FF BE\x01 not ready");
PrintToChatAll("\x04[PLUGIN]\x01 Commander left\x07FF2323 NF");</pre>
'''\x07''' - ''Type of coloring/message (custom colors seem to only work with \x07 and \x08)'' <br />
'''9764FF''' - ''HTML '''RRGGBB''' color without the '''#''' (You can pick your own color for example here: https://www.w3schools.com/colors/colors_picker.asp)'' <br />
'''Neoony's color standards:''' (Updated 18.4.2017 - Added player name color<br />
<pre>\x01 for standard text
\x04 for plugin things (example: "\x04[NCEV]\x01") [green]
\x079764FF for Brenodi Empire team [eyedropped from chat text]
\x07FF2323 for Northern Faction team [eyedropped from chat text]
\x07CB4491 for Both teams [mixed color of BE and NF, somewhat pink]
\x07CCCCCC for Spectators [gray]
\x07ff6600 for player name, if you cant use team colors for that [orange]
\x073399ff for displaying time, mainly seconds [light blue]
\x07008000 for enabled, unlocked or simply positive [green]
\x07b30000 for disabled, locked or simply negative, also for warnings [red]</pre>


== End of Round AllTalk ==
== End of Round AllTalk ==
Line 165: Line 204:
Plugin link: https://forums.alliedmods.net/showthread.php?p=585758 <br />
Plugin link: https://forums.alliedmods.net/showthread.php?p=585758 <br />
Adds commandlist.txt functionality (From Mani) to SourceMod. <br />
Adds commandlist.txt functionality (From Mani) to SourceMod. <br />
You can easily define chat commands (e.g. !unstuck), to be linked to console commands.
You can easily define chat commands (e.g. !unstuck), to be linked to console commands. <br />
triggers_rcon to define the flags of admins which will be able to use the R flag commands. <br />
And if you for example want !addtime #### with custom value after it you have to use quotes. <br />
Examples:
<pre>!us C emp_unstuck
!unstuck C emp_unstuck
!recwalls F emp_eng_recycle_walls
!fixsound C snd_restart
!enablespec R emp_allowspectators 1
!disablespec R emp_allowspectators 0
"!addtime R emp_sv_vote_commander_time"
</pre>
 
EDIT: Reported some commands not working with quotes, probably only works for R flags. Only use it if you need it.


== Advertisements 2.0 ==
== Advertisements 2.0 ==
Line 179: Line 231:


== SourceBot ==
== SourceBot ==
Original Plugin link: https://forums.alliedmods.net/showthread.php?p=883997 <br />
''Original Plugin link:'' https://forums.alliedmods.net/showthread.php?p=883997 <br />
Fixed version by Neoony: https://www.dropbox.com/s/akkdgbrdq0wfw2i/SourceBot%20-%20EmpiresFix%20by%20Neoony.rar?dl=0 <br />
EDIT: You dont have to use this fix, if you fix the signatures as noted in offsets category above. And this should be better option. <br />
(Leave empty model path in config, for the bot to not float around, example: "model"    "") <br />
SourceBot is a bot that you install into your server. You can set it to give helpful server info, or give it a personality, from the things it says. <br />
SourceBot is a bot that you install into your server. You can set it to give helpful server info, or give it a personality, from the things it says. <br />
It floats around the server greeting the players. It has feelings about each player it encounters, and remembers what it feels about each one. <br />
It floats around the server greeting the players. It has feelings about each player it encounters, and remembers what it feels about each one. <br />
'''If you have problems with getting this plugin to run update your signature as stated in "offsets and signatures" category above.''' <br />
(Leave empty model path in config, for the bot to not float around, example: "model"    "") <br />


== TeamSwitch ==
== TeamSwitch ==
Line 200: Line 251:
* Which maps are available for nominations <br />
* Which maps are available for nominations <br />
You can control how the randomization works by dividing your map rotation into groups, and controlling the weights of each group or each individual map, <br />
You can control how the randomization works by dividing your map rotation into groups, and controlling the weights of each group or each individual map, <br />
specify a minimum or maximum number of players allowed on the server for the map to be available, specify how many maps from a group are allowed in a vote, etc.
specify a minimum or maximum number of players allowed on the server for the map to be available, specify how many maps from a group are allowed in a vote, etc. <br />
EDIT: It seems the original version isnt working even with Creepers event fix for end of map votes. <br />
Here is cyberkillers version: https://github.com/CyberKiller/Ultimate-Mapchooser <br />
But it might be a little outdated...<br />


== Ungrief ==
== Ungrief ==
Line 207: Line 261:


== Execute Configs ==
== Execute Configs ==
Plugin link: https://forums.alliedmods.net/showthread.php?t=67620<br />
''Original Plugin link:'' https://forums.alliedmods.net/showthread.php?t=67620<br />
This plugin executes configs when there are either a certain amount of clients on, a certain event occurs, a certain round starts or when there are a certain amount of minutes left on the map. <br />
This plugin executes configs when there are either a certain amount of clients on, a certain event occurs, a certain round starts or when there are a certain amount of minutes left on the map. <br />
You can use this to disable alltalk above x clients, or to change the map when the timelimit hits, etc.
You can use this to disable alltalk above x clients, or to change the map when the timelimit hits, etc. <br />
'''More updated version (1.2.4) + added empires roundstart/gamestart events:''' https://github.com/Neoony/Execute-Configs-Empiresfix/releases <br />
 
== No Comm Extend Vote ==
''Plugin link:'' https://forums.empiresmod.com/index.php?threads/sm-plugin-release-nocommextendvote.20887<br />
Extend commander vote when nobody opted in and someone voted for him and much more. <br />
Features: <br />
- Extending vote time if no comms. <br />
- You can set minimum players needed in a team for the plugin to work. <br />
- Regular info message about comms and votes. <br />
- Customize almost everything. <br />
- Skipping to another map if CV stays empty after round starts, set your custom time. (CV with no comm will die) <br />
- Locking spectators and enabling at custom time after round starts. <br />
- Ability to limit how many times can the vote be extended. <br />
- Config file. <br />
- And much more! <br />
 
== Surrender ==
''Plugin link:'' https://forums.empiresmod.com/index.php?threads/sm-plugin-release-surrender.21056/<br />
Simply a plugin for surrendering. <br />
 
== Updater ==
''Plugin link:'' https://git.empiresmod.com/sourcemod/Updater/tags<br />
Updater plugin to keep other plugins which support Updater updated. <br />

Revision as of 00:31, 24 September 2017

~Fixme
Everything, making a crude start page right now.

Home > Sourcemod Plugins

For instructions on how to install, see the Sourcemod page.

Compiling from Source

Thanks to people smarter than me, compiling from source is pretty easy.
Take your source-file or source-text and pop it in this: http://www.sourcemod.net/compiler.php
Download your compiled plugin, and put it in your sourcemod/plugins folder.

Or you can use spcomp.exe inside your sourcemod folders (\addons\sourcemod\scripting\spcomp.exe) (for windows)
Just drag and drop your source-file onto the .exe.

Sourcemod offsets and signatures

Calculating updated sourcemod vtable offsets: https://forums.empiresmod.com/index.php?threads/calculating-updated-sourcemod-vtable-offsets.20571/
Neoonys empires ready offsets and signatures release (22.03.2017): https://github.com/Neoony/Empires-SM-offsets-signatures/releases

If you have issues with invalid signatures.
Example:

L 03/18/2017 - 00:02:51: [SDKTOOLS] Invalid detour address passed - Disabling detour to prevent crashes
L 03/18/2017 - 00:02:51: [SM] Exception reported: Entity Outputs are disabled - See error logs for details

Choice 1. Just download this release of offsets and signatures: https://github.com/Neoony/Empires-SM-offsets-signatures/releases
Choice 2. Replace the linux signatures in sdkhooks and sdktools files with the mac signatures. (this is already included in the above release)
This is rather temporary fix and needs testing
Example:

/* CBaseEntityOutput::FireOutput */
	"#default"
	{
		"Signatures"
		{
			"FireOutput"
			{
				"library"	"server"
				"windows"	"\x55\x8B\xEC\x81\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\x2A\x8B\x45\x2A\x53\x56\x8B\x2A\x2A\x57\x8B\x2A\x2A\x89\x2A\x2A\x2A\x2A\x2A\x89\x2A\x2A\x2A\x2A\x2A\x89\x2A\x2A\x2A\x2A\x2A\xC7"
				"linux"		"@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
				"mac"		"@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
			}
		}
	}

Plugin-Making tips

Dumping: To get a dump of entity properties specific to empires and similar things, use following commands.
"sm_dump_teprops" - Dumps tempentity props to a file
"sm_dump_netprops_xml" - Dumps the networkable property table as an XML file
"sm_dump_netprops" - Dumps the networkable property table as a text file
"sm_dump_classes" - Dumps the class list as a text file
"sm_dump_datamaps" - Dumps the data map list as a text file
"sm_dump_admcache" - Dumps the admin cache for debugging
"sm_dump_handles" - Dumps Handle usage to a file for finding Handle leaks

Just add a filename after the command and you will find the dump files in empires folder.
Just using some of those commands might make your client/server hang or even crash, but it will probably still make the dump, or just retry.


Colors for messages:
Custom colors usable by PrintToChat and similar.
Examples:

\x079764FF BE
\x07FF2323 NF

PrintToChatAll("\x04[PLUGIN]\x079764FF BE\x01 not ready");
PrintToChatAll("\x04[PLUGIN]\x01 Commander left\x07FF2323 NF");

\x07 - Type of coloring/message (custom colors seem to only work with \x07 and \x08)
9764FF - HTML RRGGBB color without the # (You can pick your own color for example here: https://www.w3schools.com/colors/colors_picker.asp)

Neoony's color standards: (Updated 18.4.2017 - Added player name color

\x01 for standard text
\x04 for plugin things (example: "\x04[NCEV]\x01") [green]
\x079764FF for Brenodi Empire team [eyedropped from chat text]
\x07FF2323 for Northern Faction team [eyedropped from chat text]
\x07CB4491 for Both teams [mixed color of BE and NF, somewhat pink]
\x07CCCCCC for Spectators [gray]
\x07ff6600 for player name, if you cant use team colors for that [orange]
\x073399ff for displaying time, mainly seconds [light blue]
\x07008000 for enabled, unlocked or simply positive [green]
\x07b30000 for disabled, locked or simply negative, also for warnings [red]

End of Round AllTalk

Original Plugin: https://forums.alliedmods.net/showthread.php?p=1246351

#pragma semicolon 1

#include <sourcemod>

#define PLUGIN_VERSION "1.0.2"

new Handle:cvar_round_end_enabled = INVALID_HANDLE;
new Handle:cvar_bomb_enabled = INVALID_HANDLE;
new Handle:cvar_announce = INVALID_HANDLE;
new Handle:cvar_alltalk = INVALID_HANDLE;

new alltalk_being_changed_by_us = false;
new okay_to_disable_alltalk = false;

public Plugin:myinfo = {
  name = "Round-End Alltalk",
  author = "Mister_Magotchi",
  description = "Turns sv_alltalk on at round end or when all Terrorists are dead (in CS:S).",
  version = PLUGIN_VERSION,
  url = "https://forums.alliedmods.net/showthread.php?t=133016"
};

public OnPluginStart() {
  CreateConVar(
    "sm_round_end_alltalk_version",
    PLUGIN_VERSION,
    "Round-End Alltalk Version",
    FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD
  );
  cvar_round_end_enabled = CreateConVar(
    "sm_round_end_alltalk_round",
    "1",
    "Toggles whether alltalk is on at round end",
    FCVAR_PLUGIN
  );
  cvar_bomb_enabled = CreateConVar(
    "sm_round_end_alltalk_bomb",
    "0",
    "Toggles whether alltalk is on when all Terrorists are dead",
    FCVAR_PLUGIN
  );
  cvar_announce = CreateConVar(
    "sm_round_end_alltalk_announce",
    "1",
    "Toggles whether changes to sv_alltalk are announced in chat",
    FCVAR_PLUGIN
  );
  cvar_alltalk = FindConVar("sv_alltalk");
  SetConVarFlags(cvar_alltalk, GetConVarFlags(cvar_alltalk)&~FCVAR_NOTIFY);

  HookConVarChange(cvar_alltalk, AlltalkChanged);
  HookEvent("round_start", OnRoundStart);
  HookEvent("player_death", OnPlayerDeath);
  HookEvent("game_end", OnRoundEnd);
  AutoExecConfig(true, "round-end-alltalk");
}

TurnAlltalkOn () {
//  PrintToChatAll("Alltalk: DEBUG1");
  if (!GetConVarBool(cvar_alltalk)) {
    okay_to_disable_alltalk = true;
    alltalk_being_changed_by_us = true;
    SetConVarBool(cvar_alltalk, true);
  }
}

public AlltalkChanged (Handle:convar, const String:oldValue[], const String:newValue[]) {
//  PrintToChatAll("Alltalk: DEBUG2");
  new bool:announce = GetConVarBool(cvar_announce);
  if (StringToInt(newValue)) {
    if (announce) {
      PrintToChatAll("Alltalk is now on.");
    }
    if (alltalk_being_changed_by_us) {
      alltalk_being_changed_by_us = false;
    }
    else {
      okay_to_disable_alltalk = false;
    }
  }
  else {
    if (announce) {
      PrintToChatAll("Alltalk is now off.");
    }
  }
}

public OnRoundStart (Handle:event, const String:name[], bool:dontBroadcast) {
//  PrintToChatAll("Alltalk: DEBUG3");
  if (okay_to_disable_alltalk) {
    SetConVarBool(cvar_alltalk, false);
  }
}

public OnPlayerDeath (Handle:event, const String:name[], bool:dontBroadcast) {
//  PrintToChatAll("Alltalk: DEBUG4");
  if (GetConVarBool(cvar_bomb_enabled)) {
    new client;
    new bool:terrorists_dead = true;
    for (client = MaxClients; 0 < client; client--) {
      if (IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 2) {
        terrorists_dead = false;
        break;
      }
    }
    if (terrorists_dead) {
      TurnAlltalkOn();
    }
  }
}

public OnRoundEnd (Handle:event, const String:name[], bool:dontBroadcast) {
//  PrintToChatAll("Alltalk: DEBUG5");
  if (GetConVarBool(cvar_round_end_enabled)) {
    TurnAlltalkOn();
  }
}

Chat Triggers

Plugin link: https://forums.alliedmods.net/showthread.php?p=585758
Adds commandlist.txt functionality (From Mani) to SourceMod.
You can easily define chat commands (e.g. !unstuck), to be linked to console commands.
triggers_rcon to define the flags of admins which will be able to use the R flag commands.
And if you for example want !addtime #### with custom value after it you have to use quotes.
Examples:

!us C emp_unstuck
!unstuck C emp_unstuck
!recwalls F emp_eng_recycle_walls
!fixsound C snd_restart
!enablespec R emp_allowspectators 1
!disablespec R emp_allowspectators 0
"!addtime R emp_sv_vote_commander_time"

EDIT: Reported some commands not working with quotes, probably only works for R flags. Only use it if you need it.

Advertisements 2.0

Plugin link: https://forums.alliedmods.net/showthread.php?t=155705
Simple advertisements plugin. It supports center, chat, hint, menu and top messages.

SourceBans++

(Not tested yet)
Plugin link: https://sbpp.github.io/
Unofficial more updated version of SourceBans.
-SourceBans++ is a majorly improved version of SourceBans 1.4.11 which was developed by GameConnect.
Those major improvements include a new design, more stable web application, login via steam account and much more community made customizations.

SourceBot

Original Plugin link: https://forums.alliedmods.net/showthread.php?p=883997
SourceBot is a bot that you install into your server. You can set it to give helpful server info, or give it a personality, from the things it says.
It floats around the server greeting the players. It has feelings about each player it encounters, and remembers what it feels about each one.
If you have problems with getting this plugin to run update your signature as stated in "offsets and signatures" category above.
(Leave empty model path in config, for the bot to not float around, example: "model" "")

TeamSwitch

Plugin link: https://forums.alliedmods.net/showthread.php?p=587405
This is a fully mod-independent team switching plugin, which gives an admin the ability to switch players to the opposite team either immediately,
when they die, or at the end of the round (where appropriate).
Players can also be switched to spectators.
TeamSwitch detects which mod it is being run on at startup and configures itself accordingly.

Ultimate Mapchooser 3.4.5

Plugin link: https://forums.alliedmods.net/showthread.php?t=134190
Ultimate Mapchooser allows for increased control over map selection. This includes:

  • Random selection of the next map.
  • Which maps are added to votes
  • Which maps are available for nominations

You can control how the randomization works by dividing your map rotation into groups, and controlling the weights of each group or each individual map,
specify a minimum or maximum number of players allowed on the server for the map to be available, specify how many maps from a group are allowed in a vote, etc.
EDIT: It seems the original version isnt working even with Creepers event fix for end of map votes.
Here is cyberkillers version: https://github.com/CyberKiller/Ultimate-Mapchooser
But it might be a little outdated...

Ungrief

Plugin link: https://forums.alliedmods.net/showthread.php?t=89361
Teleports the specified command vehicle to where you are looking.

Execute Configs

Original Plugin link: https://forums.alliedmods.net/showthread.php?t=67620
This plugin executes configs when there are either a certain amount of clients on, a certain event occurs, a certain round starts or when there are a certain amount of minutes left on the map.
You can use this to disable alltalk above x clients, or to change the map when the timelimit hits, etc.
More updated version (1.2.4) + added empires roundstart/gamestart events: https://github.com/Neoony/Execute-Configs-Empiresfix/releases

No Comm Extend Vote

Plugin link: https://forums.empiresmod.com/index.php?threads/sm-plugin-release-nocommextendvote.20887
Extend commander vote when nobody opted in and someone voted for him and much more.
Features:
- Extending vote time if no comms.
- You can set minimum players needed in a team for the plugin to work.
- Regular info message about comms and votes.
- Customize almost everything.
- Skipping to another map if CV stays empty after round starts, set your custom time. (CV with no comm will die)
- Locking spectators and enabling at custom time after round starts.
- Ability to limit how many times can the vote be extended.
- Config file.
- And much more!

Surrender

Plugin link: https://forums.empiresmod.com/index.php?threads/sm-plugin-release-surrender.21056/
Simply a plugin for surrendering.

Updater

Plugin link: https://git.empiresmod.com/sourcemod/Updater/tags
Updater plugin to keep other plugins which support Updater updated.