<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alliedmods.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cybermind</id>
	<title>AlliedModders Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alliedmods.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cybermind"/>
	<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/Special:Contributions/Cybermind"/>
	<updated>2026-06-06T07:35:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.6</generator>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Format_Class_Functions_(SourceMod_Scripting)&amp;diff=8092</id>
		<title>Format Class Functions (SourceMod Scripting)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Format_Class_Functions_(SourceMod_Scripting)&amp;diff=8092"/>
		<updated>2011-05-30T13:46:45Z</updated>

		<summary type="html">&lt;p&gt;Cybermind: /* Format Specifiers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Format-class functions are variable argument functions in [[SourceMod]] which allow you to format a string.  A simple example of this is the &amp;lt;tt&amp;gt;Format()&amp;lt;/tt&amp;gt; function, which looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;decl String:buffer[512];&lt;br /&gt;
Format(buffer, sizeof(buffer), &amp;quot;Your name is: %s&amp;quot;, userName);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If userName contains &amp;quot;&amp;lt;tt&amp;gt;Mark&amp;lt;/tt&amp;gt;,&amp;quot; the contents of &amp;lt;tt&amp;gt;buffer&amp;lt;/tt&amp;gt; will then be: &amp;quot;&amp;lt;tt&amp;gt;Your name is: Mark&amp;lt;/tt&amp;gt;.&amp;quot;  The prototype of these functions almost always contains the following parameters:&lt;br /&gt;
&amp;lt;pawn&amp;gt;const String:fmt[], {Handle,Float,_}:...&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, observe the following two natives:&lt;br /&gt;
&amp;lt;pawn&amp;gt;native Format(String:buffer[], maxlength, const String:fmt[], {Handle,Float,_}:...);&lt;br /&gt;
native PrintToClient(client, String:fmt[], {Handle,Float,_}:...);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus, &amp;lt;tt&amp;gt;PrintToClient&amp;lt;/tt&amp;gt; is a format-class function.  It can be used exactly as shown earlier:&lt;br /&gt;
&amp;lt;pawn&amp;gt;PrintToClient(client, &amp;quot;Your name is: %s&amp;quot;, userName);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Format Specifiers=&lt;br /&gt;
A format specifier is a code that allows you to specify what data-type to print.  The most common specifiers are:&lt;br /&gt;
*'''Numerical'''&lt;br /&gt;
**'''d''' or '''i''': Integer number as decimal&lt;br /&gt;
**'''u''': Unsigned integer number as decimal&lt;br /&gt;
**'''b''': Binary digits in the value&lt;br /&gt;
**'''f''': Floating-point number&lt;br /&gt;
**'''x''' or '''X''': Hexadecimal representation of the binary value (capitalization affects hex letter casing)&lt;br /&gt;
*'''Character(s)'''&lt;br /&gt;
**'''s''': String&lt;br /&gt;
**'''t''' or '''T''': Translates a phrase (explained in [[Translations (SourceMod_Scripting)#Usage_in_a_Plugin|Translations]])&lt;br /&gt;
**'''c''': Prints one character (UTF-8 compliant)&lt;br /&gt;
*'''Special'''&lt;br /&gt;
**'''L''': Requires a client index; expands to 1&amp;lt;2&amp;gt;&amp;lt;3&amp;gt;&amp;lt;&amp;gt; where 1 is the player's name, 2 is the player's userid, and 3 is the player's Steam ID.  If the client index is 0, the string will be: &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;Console&amp;lt;0&amp;gt;&amp;lt;Console&amp;gt;&amp;lt;Console&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
**'''N''': Requires a client index; expands to a string containing the player's name.  If the client index is 0, the string will be: &amp;lt;tt&amp;gt;Console&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Usage=&lt;br /&gt;
Format specifiers are denoted with a &amp;lt;tt&amp;gt;'%s'&amp;lt;/tt&amp;gt; symbol.  For example, to print a float, a number, and a string, you might use this code:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new Float:fNum = 5.0;&lt;br /&gt;
new iNum = 5&lt;br /&gt;
new String:str[] = &amp;quot;5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PrintToClient(client, &amp;quot;Number: %d Float: %f String: %s&amp;quot;, iNum, fNum, str);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note''': Using the wrong data type with a specifier can be very dangerous.  Always make sure you are printing as the right type.  For example, specifying a string and passing a number can crash the server.&lt;br /&gt;
&lt;br /&gt;
=Advanced Formatting=&lt;br /&gt;
Format specifiers have an extended syntax for controlling various aspects of how data is printed.  The full syntax is:&lt;br /&gt;
&amp;lt;tt&amp;gt;%[flags][width][.precision]specifier&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each bracketed section is an optional extension.  Explanations of supported SourceMod format extensions:&lt;br /&gt;
*'''%''': Obviously, this is always required.&lt;br /&gt;
*'''flags''':&lt;br /&gt;
**'''-''': Left-justify (right-justify is set by default)&lt;br /&gt;
**'''0''': Pads with 0s instead of spaces when needed (see '''width''' below).&lt;br /&gt;
*'''width''': Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger.&lt;br /&gt;
*'''precision''': &lt;br /&gt;
**'''For integers''': specifies the minimum number of digits to print (or pad with spaces/zeroes if below the minimum).  &lt;br /&gt;
**'''For strings''': specifies the maximum number of characters to print.&lt;br /&gt;
**'''For floats''': specifies the number of digits to be printed ''after the decimal point''.&lt;br /&gt;
**'''For all other types''': no effect.&lt;br /&gt;
*'''specifier''': character specifying the data type (always required).&lt;br /&gt;
&lt;br /&gt;
todo: examples&lt;br /&gt;
&lt;br /&gt;
For more information, see [http://www.cplusplus.com/reference/clibrary/cstdio/printf.html printf] from the C Standard Library, although not all modes are supported from C.&lt;br /&gt;
&lt;br /&gt;
=Making your function Format-Class=&lt;br /&gt;
&lt;br /&gt;
Sourcemod allows you to make your function Format-class, ie. pass parameters to format string variables.&lt;br /&gt;
Here's an example :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;public formatExample(const String:myString[] , any:...)&lt;br /&gt;
{&lt;br /&gt;
	new String:myFormattedString[strlen(myString)+255];&lt;br /&gt;
	VFormat(myFormattedString, sizeof(myFormattedString), myString, 2);&lt;br /&gt;
	&lt;br /&gt;
	PrintToServer(myFormattedString);&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using the parameter &amp;quot;any: ...&amp;quot;, we can pass data(s) to format our string.&lt;br /&gt;
Now, in order to replace the Format Specifiers by our data(s), we use the API &amp;quot;VFormat&amp;quot;, which documentation can be found here : [http://docs.sourcemod.net/api/].&lt;br /&gt;
&lt;br /&gt;
The three first parameters passed in VFormat are pretty obvious since they are the as in the Format(..) API.&lt;br /&gt;
&lt;br /&gt;
The 4th parameter indicate the &amp;quot;any: ...&amp;quot; parameter position in your function prototype.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Cybermind</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=User:CyberMind&amp;diff=8060</id>
		<title>User:CyberMind</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=User:CyberMind&amp;diff=8060"/>
		<updated>2011-03-22T01:31:37Z</updated>

		<summary type="html">&lt;p&gt;Cybermind: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cybermind</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Vectors_Explained_(Scripting)&amp;diff=8059</id>
		<title>Vectors Explained (Scripting)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Vectors_Explained_(Scripting)&amp;diff=8059"/>
		<updated>2011-03-22T01:27:44Z</updated>

		<summary type="html">&lt;p&gt;Cybermind: /* Velocity Vectors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
Vectors in general tend to be rather confusing until they are explained. There are three different types you will see. Position Vectors, Velocity Vectors, and Angle Vectors. While in most basic cases you will probably only use one of these at a time, it doesn't hurt to know what the other two parameters are there for. Here is an example of the native 'TeleportEntity' to show you what it looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
native TeleportEntity(entity, const Float:origin[3], const Float:angles[3], const Float:velocity[3]);&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Position Vector''': The first Vector in this native, declared as origin[3], is the Position Vector. This simply tells us the entities absolute position in the world. The position vector could look something like {15.0, 30.0, 15.0} and this would mean the entity is 15 units along the X axis, 30 units along the Y axis, and 15 units along the Z axis.&lt;br /&gt;
&lt;br /&gt;
'''Angles Vector''': The second Vector in this native, declared as angles[3], is the Angle Vector. This specifies the rotation of an object. This vector would follow the format {pitch, yaw, roll} which modifies the angles at which the object is looking. 'Pitch' is the up &amp;amp; down angles, 'Yaw' is the left &amp;amp; right, and 'Roll' is the spin along the up/down/left/right vector.&lt;br /&gt;
&lt;br /&gt;
'''Velocity Vector''': The last Vector in the native is the Velocity Vector, declared as velocity[3] in the example. This vector tells the game where the object will be on the next frame. So on the next game frame, the Position Vector of this object will be the sum of the Position Vector and the Velocity Vector from our current frame.&lt;br /&gt;
&lt;br /&gt;
==Velocity Vectors==&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
decl vecOrigin[3], vecVelocity[3], vecResult[3];&lt;br /&gt;
&lt;br /&gt;
AddVectors(vecOrigin, vecVelocity, vecResult);&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cybermind</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Compiling_SourceMod_Plugins&amp;diff=5499</id>
		<title>Compiling SourceMod Plugins</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Compiling_SourceMod_Plugins&amp;diff=5499"/>
		<updated>2007-12-21T01:34:55Z</updated>

		<summary type="html">&lt;p&gt;Cybermind: was a code paste&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cybermind</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=5176</id>
		<title>Metamod:Source</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=5176"/>
		<updated>2007-10-07T04:56:46Z</updated>

		<summary type="html">&lt;p&gt;Cybermind: /* Plugins */ removed instance of &amp;quot;sourcemm&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:{{owned_project}}&lt;br /&gt;
==Introduction==&lt;br /&gt;
Metamod:Source is an API manager and interception handler that sits in between the [[Half-Life_2|Half-Life 2]] Engine (Source) and a subsequent Game Modification (MOD). It can dynamically load &amp;quot;Metamod:Source Plugins&amp;quot;, written in C++, to intercept, override, and hook Engine and GameDLL API interfaces. It also allows for inter-plugin communication.  As a backend it contains [[SourceHook]], a powerful library for safely manipulating virtual table hooks.&lt;br /&gt;
&lt;br /&gt;
[[Category:Half-Life 2]]&lt;br /&gt;
[[Category:Metamod:Source Documentation]]&lt;br /&gt;
&lt;br /&gt;
==Where to Download==&lt;br /&gt;
Metamod:Source is hosted on [http://sourceforge.net/projects/sourcemm Source Forge] or can be accessed via the [http://www.sourcemm.net/ Metamod:Source Home Page].&lt;br /&gt;
&lt;br /&gt;
==Naming Conventions==&lt;br /&gt;
The name &amp;quot;SourceMM&amp;quot; is no longer used.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
Metamod:Source is derived from the [[Metamod]] concept of intercepting calls between a game's engine and mod library.  While not based on the same code, the API is designed to be similar and familiar to [[Half-Life 1]] programmers.&lt;br /&gt;
&lt;br /&gt;
====SourceMod Core1====&lt;br /&gt;
Initially, the [[SourceMod]] project was started as the next-generation continuation of the [[AMX Mod X]] project.  It was designed to be a meta-interface layer for inter-communicating plugins.  However, as development continued, it was soon realized that the [[Valve Server Plugin]] interface would not be sufficient to provide proper engine access.&lt;br /&gt;
&lt;br /&gt;
[[User:PM|Pavol Marko]] (core1 developer) decided to add &amp;quot;SourceHook&amp;quot; to SourceMod core1.  It was embedded as a large library for hooking specific virtual table functions.  After multiple revisions (see [[SourceHook]] history), it became apparent that 1)SourceHook needed to be game and interface generic, and 2)SourceMod and SourceHook needed to be split into two separate projects.  The logic behind this was that SourceHook needed to be a layer above [[Valve Server Plugin]]s, in order to properly manage hooks with the least possibility of conflicts.  Furthermore, SourceMod should be a plugin to the SourceHook interface, rather than managing it.  This decision can be likened to [[Admin-Mod]]'s early decision to split into the first [[Metamod]] project.&lt;br /&gt;
&lt;br /&gt;
====SourceHook Finalized====&lt;br /&gt;
After four major revisions, [[SourceHook]] was mature enough to be used in a production environment.  While [[User:PM|PM]] concentrated on fleshing out [[SourceHook]], [[User:BAILOPAN|BAILOPAN]] and [[User:Damaged Soul|DS]] created the GameDLL wrapper portion.&lt;br /&gt;
&lt;br /&gt;
====Version 1.0====&lt;br /&gt;
On May 6, 2005, Metamod:Source 1.0 was released with SourceHook v4.1 as a backend.  GameDLL wrapping was achieved by providing the engine with fake copies of the IServerGame* interfaces.  Once the true GameDLL location was known it would be loaded by Metamod:Source.  The fake interface then directly wrapped calls to the real GameDLL.&lt;br /&gt;
&lt;br /&gt;
====Version 1.1====&lt;br /&gt;
On October 21, 2005, the first major revision of Metamod:Source was released, featuring SourceHook v4.4, internal event listeners, dropped reliance on STL, and rewritten GameDLL hooking code.  The [[Day of Defeat|Day of Defeat:Source]] release by [[VALVe_Software|Valve Software]] revealed that the binary interface between the engine and mod wasn't necessarily public or current, and MM:S's detection was improved for compatibility and speed.  Furthermore, Metamod:Source stopped wrapping the GameDLL interfaces and began using SourceHook to hook them.&lt;br /&gt;
&lt;br /&gt;
====Version 1.2====&lt;br /&gt;
On January 7th, 2006, Metamod:Source was updated for SourceHook v4.3, but received no major API changes.&lt;br /&gt;
&lt;br /&gt;
====Version 1.3====&lt;br /&gt;
On August 16th, 2006, Metamod:Source was updated for SourceHook v4.4, minor API changes, bug fixes, and a sync to the latest HL2SDK.&lt;br /&gt;
&lt;br /&gt;
====Version 1.4====&lt;br /&gt;
On April 5th, 2007, Metamod:Source was updated with API for [[Valve Server Plugin]] interface hooking and crash-safe user message enumeration. An experimental gameinfo.txt update tool was also added. No SourceHook changes were made in this release.&lt;br /&gt;
&lt;br /&gt;
====Version 1.6====&lt;br /&gt;
Currently in development, Metamod:Source received a near complete overhaul to abstract engine-specific code to support Orange Box.  Additionally, SourceHook received a massive overhaul and is now v4.5, adding global hooks and various major API simplifications.&lt;br /&gt;
&lt;br /&gt;
==Design Considerations==&lt;br /&gt;
====Metamod====&lt;br /&gt;
Originally, Metamod:Source was a plugin co-existing with SourceMod.  However, there are factories, pointers, and certain capabilities not possible from a [[Valve Server Plugin]].  Furthermore, the [[Half-Life 2]] engine does not properly unload VSPs, making debugging and resource unloading more difficult.  Eventually it was decided the added functionality and fine-tuned control outweighed the extra cost of having to configure an intercepting binary.&lt;br /&gt;
&lt;br /&gt;
====Plugins====&lt;br /&gt;
Plugins are specific to Metamod:Source.  This means that [[Valve Server Plugin]]s and [[Open_Source_Plugins_for_Metamod:Source|Metamod:Source Plugins]] are entirely separate in the API characteristics.  While it is certainly possible to expose the necessary interfaces to VSPs, it creates an added layer of complexity for dealing with things that Metamod:Source might not directly control.  For example, when a Metamod:Source plugin is removed at runtime, all of the necessary hooks are also removed.  A VSP has no clear callback for detecting this event, therefore it would be more difficult to ensure proper unloading.  VSP and MM:S plugins also have different ways of attaching and detaching server [[Cvars|cvars]] and [[Console commands|concmds]].&lt;br /&gt;
&lt;br /&gt;
By keeping the plugin system isolated, Metamod:Source can also provide a unique set of console commands and API.  For example, plugins can listen for certain Metamod:Source-specific events and provide communication channels with other plugins.&lt;br /&gt;
&lt;br /&gt;
====Hooking====&lt;br /&gt;
Metamod:Source is powered by [[SourceHook]], a versatile library for hooking virtual functions.  The original [[Half-Life 1]] engine used structs of function pointers which could easily be modified as they passed from one library to another.  However, HL2 is comprised almost entirely of pure virtual interfaces.  SourceHook was designed for declaring single hooks against a given virtual function and a this pointer, which is not only faster than a blanket hooking system like Metamod's, but more flexible and precise.&lt;br /&gt;
&lt;br /&gt;
Hooking under Metamod:Source has a number of features that don't exist in a hooking system style like Metamod's, and it achieves something closer to [[Detours|detours]], rather than Metamod, which is hardcoded.  For example&lt;br /&gt;
*You can change parent parameters during a hooked call&lt;br /&gt;
*You can hook member functions, both by a pre-existing declaration or given vtable offset&lt;br /&gt;
*You can call the original function and still fire its associated hooks, or you can call it without firing hooks in order to prevent infinite recursion&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
For more information on installing, configuring, and coding for Metamod:Source, see [[:Category:Documentation (SourceMM)|Documentation]].&lt;br /&gt;
&lt;br /&gt;
==The Future==&lt;br /&gt;
While Metamod:Source is a stable/production product, more features are on the horizon.  There are distant plans for a [[Detours|detouring]] library and a library for efficiently automated [[Signature Scanning|signature scanning]].&lt;br /&gt;
&lt;br /&gt;
==License==&lt;br /&gt;
Metamod:Source is licensed under the [[zLib/libpng License]].  It is free to use for both open-source and proprietary projects.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[http://www.sourcemm.net/ Metamod:Source Website]&lt;br /&gt;
*[http://www.metamod.org/ Metamod Website]&lt;br /&gt;
*[http://www.sourcemod.net/ SourceMod Website]&lt;br /&gt;
*[http://resonus.net/doxygen_sourcemm/ Doxygen of Metamod:Source]&lt;/div&gt;</summary>
		<author><name>Cybermind</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=5175</id>
		<title>Metamod:Source</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=5175"/>
		<updated>2007-10-07T04:54:48Z</updated>

		<summary type="html">&lt;p&gt;Cybermind: /* Version 1.1 */ removed more instances of &amp;quot;sourcemm&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:{{owned_project}}&lt;br /&gt;
==Introduction==&lt;br /&gt;
Metamod:Source is an API manager and interception handler that sits in between the [[Half-Life_2|Half-Life 2]] Engine (Source) and a subsequent Game Modification (MOD). It can dynamically load &amp;quot;Metamod:Source Plugins&amp;quot;, written in C++, to intercept, override, and hook Engine and GameDLL API interfaces. It also allows for inter-plugin communication.  As a backend it contains [[SourceHook]], a powerful library for safely manipulating virtual table hooks.&lt;br /&gt;
&lt;br /&gt;
[[Category:Half-Life 2]]&lt;br /&gt;
[[Category:Metamod:Source Documentation]]&lt;br /&gt;
&lt;br /&gt;
==Where to Download==&lt;br /&gt;
Metamod:Source is hosted on [http://sourceforge.net/projects/sourcemm Source Forge] or can be accessed via the [http://www.sourcemm.net/ Metamod:Source Home Page].&lt;br /&gt;
&lt;br /&gt;
==Naming Conventions==&lt;br /&gt;
The name &amp;quot;SourceMM&amp;quot; is no longer used.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
Metamod:Source is derived from the [[Metamod]] concept of intercepting calls between a game's engine and mod library.  While not based on the same code, the API is designed to be similar and familiar to [[Half-Life 1]] programmers.&lt;br /&gt;
&lt;br /&gt;
====SourceMod Core1====&lt;br /&gt;
Initially, the [[SourceMod]] project was started as the next-generation continuation of the [[AMX Mod X]] project.  It was designed to be a meta-interface layer for inter-communicating plugins.  However, as development continued, it was soon realized that the [[Valve Server Plugin]] interface would not be sufficient to provide proper engine access.&lt;br /&gt;
&lt;br /&gt;
[[User:PM|Pavol Marko]] (core1 developer) decided to add &amp;quot;SourceHook&amp;quot; to SourceMod core1.  It was embedded as a large library for hooking specific virtual table functions.  After multiple revisions (see [[SourceHook]] history), it became apparent that 1)SourceHook needed to be game and interface generic, and 2)SourceMod and SourceHook needed to be split into two separate projects.  The logic behind this was that SourceHook needed to be a layer above [[Valve Server Plugin]]s, in order to properly manage hooks with the least possibility of conflicts.  Furthermore, SourceMod should be a plugin to the SourceHook interface, rather than managing it.  This decision can be likened to [[Admin-Mod]]'s early decision to split into the first [[Metamod]] project.&lt;br /&gt;
&lt;br /&gt;
====SourceHook Finalized====&lt;br /&gt;
After four major revisions, [[SourceHook]] was mature enough to be used in a production environment.  While [[User:PM|PM]] concentrated on fleshing out [[SourceHook]], [[User:BAILOPAN|BAILOPAN]] and [[User:Damaged Soul|DS]] created the GameDLL wrapper portion.&lt;br /&gt;
&lt;br /&gt;
====Version 1.0====&lt;br /&gt;
On May 6, 2005, Metamod:Source 1.0 was released with SourceHook v4.1 as a backend.  GameDLL wrapping was achieved by providing the engine with fake copies of the IServerGame* interfaces.  Once the true GameDLL location was known it would be loaded by Metamod:Source.  The fake interface then directly wrapped calls to the real GameDLL.&lt;br /&gt;
&lt;br /&gt;
====Version 1.1====&lt;br /&gt;
On October 21, 2005, the first major revision of Metamod:Source was released, featuring SourceHook v4.4, internal event listeners, dropped reliance on STL, and rewritten GameDLL hooking code.  The [[Day of Defeat|Day of Defeat:Source]] release by [[VALVe_Software|Valve Software]] revealed that the binary interface between the engine and mod wasn't necessarily public or current, and MM:S's detection was improved for compatibility and speed.  Furthermore, Metamod:Source stopped wrapping the GameDLL interfaces and began using SourceHook to hook them.&lt;br /&gt;
&lt;br /&gt;
====Version 1.2====&lt;br /&gt;
On January 7th, 2006, Metamod:Source was updated for SourceHook v4.3, but received no major API changes.&lt;br /&gt;
&lt;br /&gt;
====Version 1.3====&lt;br /&gt;
On August 16th, 2006, Metamod:Source was updated for SourceHook v4.4, minor API changes, bug fixes, and a sync to the latest HL2SDK.&lt;br /&gt;
&lt;br /&gt;
====Version 1.4====&lt;br /&gt;
On April 5th, 2007, Metamod:Source was updated with API for [[Valve Server Plugin]] interface hooking and crash-safe user message enumeration. An experimental gameinfo.txt update tool was also added. No SourceHook changes were made in this release.&lt;br /&gt;
&lt;br /&gt;
====Version 1.6====&lt;br /&gt;
Currently in development, Metamod:Source received a near complete overhaul to abstract engine-specific code to support Orange Box.  Additionally, SourceHook received a massive overhaul and is now v4.5, adding global hooks and various major API simplifications.&lt;br /&gt;
&lt;br /&gt;
==Design Considerations==&lt;br /&gt;
====Metamod====&lt;br /&gt;
Originally, Metamod:Source was a plugin co-existing with SourceMod.  However, there are factories, pointers, and certain capabilities not possible from a [[Valve Server Plugin]].  Furthermore, the [[Half-Life 2]] engine does not properly unload VSPs, making debugging and resource unloading more difficult.  Eventually it was decided the added functionality and fine-tuned control outweighed the extra cost of having to configure an intercepting binary.&lt;br /&gt;
&lt;br /&gt;
====Plugins====&lt;br /&gt;
Plugins are specific to Metamod:Source.  This means that [[Valve Server Plugin]]s and [[SourceMM Plugins]] are entirely separate in the API characteristics.  While it is certainly possible to expose the necessary interfaces to VSPs, it creates an added layer of complexity for dealing with things that Metamod:Source might not directly control.  For example, when a Metamod:Source plugin is removed at runtime, all of the necessary hooks are also removed.  A VSP has no clear callback for detecting this event, therefore it would be more difficult to ensure proper unloading.  VSP and MM:S plugins also have different ways of attaching and detaching server [[Cvars|cvars]] and [[Console commands|concmds]].&lt;br /&gt;
&lt;br /&gt;
By keeping the plugin system isolated, Metamod:Source can also provide a unique set of console commands and API.  For example, plugins can listen for certain Metamod:Source-specific events and provide communication channels with other plugins.&lt;br /&gt;
&lt;br /&gt;
====Hooking====&lt;br /&gt;
Metamod:Source is powered by [[SourceHook]], a versatile library for hooking virtual functions.  The original [[Half-Life 1]] engine used structs of function pointers which could easily be modified as they passed from one library to another.  However, HL2 is comprised almost entirely of pure virtual interfaces.  SourceHook was designed for declaring single hooks against a given virtual function and a this pointer, which is not only faster than a blanket hooking system like Metamod's, but more flexible and precise.&lt;br /&gt;
&lt;br /&gt;
Hooking under Metamod:Source has a number of features that don't exist in a hooking system style like Metamod's, and it achieves something closer to [[Detours|detours]], rather than Metamod, which is hardcoded.  For example&lt;br /&gt;
*You can change parent parameters during a hooked call&lt;br /&gt;
*You can hook member functions, both by a pre-existing declaration or given vtable offset&lt;br /&gt;
*You can call the original function and still fire its associated hooks, or you can call it without firing hooks in order to prevent infinite recursion&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
For more information on installing, configuring, and coding for Metamod:Source, see [[:Category:Documentation (SourceMM)|Documentation]].&lt;br /&gt;
&lt;br /&gt;
==The Future==&lt;br /&gt;
While Metamod:Source is a stable/production product, more features are on the horizon.  There are distant plans for a [[Detours|detouring]] library and a library for efficiently automated [[Signature Scanning|signature scanning]].&lt;br /&gt;
&lt;br /&gt;
==License==&lt;br /&gt;
Metamod:Source is licensed under the [[zLib/libpng License]].  It is free to use for both open-source and proprietary projects.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[http://www.sourcemm.net/ Metamod:Source Website]&lt;br /&gt;
*[http://www.metamod.org/ Metamod Website]&lt;br /&gt;
*[http://www.sourcemod.net/ SourceMod Website]&lt;br /&gt;
*[http://resonus.net/doxygen_sourcemm/ Doxygen of Metamod:Source]&lt;/div&gt;</summary>
		<author><name>Cybermind</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=5174</id>
		<title>Metamod:Source</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=5174"/>
		<updated>2007-10-07T04:53:06Z</updated>

		<summary type="html">&lt;p&gt;Cybermind: /* Introduction */ removed instance of &amp;quot;sourcemm&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:{{owned_project}}&lt;br /&gt;
==Introduction==&lt;br /&gt;
Metamod:Source is an API manager and interception handler that sits in between the [[Half-Life_2|Half-Life 2]] Engine (Source) and a subsequent Game Modification (MOD). It can dynamically load &amp;quot;Metamod:Source Plugins&amp;quot;, written in C++, to intercept, override, and hook Engine and GameDLL API interfaces. It also allows for inter-plugin communication.  As a backend it contains [[SourceHook]], a powerful library for safely manipulating virtual table hooks.&lt;br /&gt;
&lt;br /&gt;
[[Category:Half-Life 2]]&lt;br /&gt;
[[Category:Metamod:Source Documentation]]&lt;br /&gt;
&lt;br /&gt;
==Where to Download==&lt;br /&gt;
Metamod:Source is hosted on [http://sourceforge.net/projects/sourcemm Source Forge] or can be accessed via the [http://www.sourcemm.net/ Metamod:Source Home Page].&lt;br /&gt;
&lt;br /&gt;
==Naming Conventions==&lt;br /&gt;
The name &amp;quot;SourceMM&amp;quot; is no longer used.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
Metamod:Source is derived from the [[Metamod]] concept of intercepting calls between a game's engine and mod library.  While not based on the same code, the API is designed to be similar and familiar to [[Half-Life 1]] programmers.&lt;br /&gt;
&lt;br /&gt;
====SourceMod Core1====&lt;br /&gt;
Initially, the [[SourceMod]] project was started as the next-generation continuation of the [[AMX Mod X]] project.  It was designed to be a meta-interface layer for inter-communicating plugins.  However, as development continued, it was soon realized that the [[Valve Server Plugin]] interface would not be sufficient to provide proper engine access.&lt;br /&gt;
&lt;br /&gt;
[[User:PM|Pavol Marko]] (core1 developer) decided to add &amp;quot;SourceHook&amp;quot; to SourceMod core1.  It was embedded as a large library for hooking specific virtual table functions.  After multiple revisions (see [[SourceHook]] history), it became apparent that 1)SourceHook needed to be game and interface generic, and 2)SourceMod and SourceHook needed to be split into two separate projects.  The logic behind this was that SourceHook needed to be a layer above [[Valve Server Plugin]]s, in order to properly manage hooks with the least possibility of conflicts.  Furthermore, SourceMod should be a plugin to the SourceHook interface, rather than managing it.  This decision can be likened to [[Admin-Mod]]'s early decision to split into the first [[Metamod]] project.&lt;br /&gt;
&lt;br /&gt;
====SourceHook Finalized====&lt;br /&gt;
After four major revisions, [[SourceHook]] was mature enough to be used in a production environment.  While [[User:PM|PM]] concentrated on fleshing out [[SourceHook]], [[User:BAILOPAN|BAILOPAN]] and [[User:Damaged Soul|DS]] created the GameDLL wrapper portion.&lt;br /&gt;
&lt;br /&gt;
====Version 1.0====&lt;br /&gt;
On May 6, 2005, Metamod:Source 1.0 was released with SourceHook v4.1 as a backend.  GameDLL wrapping was achieved by providing the engine with fake copies of the IServerGame* interfaces.  Once the true GameDLL location was known it would be loaded by Metamod:Source.  The fake interface then directly wrapped calls to the real GameDLL.&lt;br /&gt;
&lt;br /&gt;
====Version 1.1====&lt;br /&gt;
On October 21, 2005, the first major revision of SourceMM was released, featuring SourceHook v4.4, internal event listeners, dropped reliance on STL, and rewritten GameDLL hooking code.  The [[Day of Defeat|Day of Defeat:Source]] release by [[VALVe_Software|Valve Software]] revealed that the binary interface between the engine and mod wasn't necessarily public or current, and SourceMM's detection was improved for compatibility and speed.  Furthermore, SourceMM stopped wrapping the GameDLL interfaces and began using SourceHook to hook them.&lt;br /&gt;
&lt;br /&gt;
====Version 1.2====&lt;br /&gt;
On January 7th, 2006, Metamod:Source was updated for SourceHook v4.3, but received no major API changes.&lt;br /&gt;
&lt;br /&gt;
====Version 1.3====&lt;br /&gt;
On August 16th, 2006, Metamod:Source was updated for SourceHook v4.4, minor API changes, bug fixes, and a sync to the latest HL2SDK.&lt;br /&gt;
&lt;br /&gt;
====Version 1.4====&lt;br /&gt;
On April 5th, 2007, Metamod:Source was updated with API for [[Valve Server Plugin]] interface hooking and crash-safe user message enumeration. An experimental gameinfo.txt update tool was also added. No SourceHook changes were made in this release.&lt;br /&gt;
&lt;br /&gt;
====Version 1.6====&lt;br /&gt;
Currently in development, Metamod:Source received a near complete overhaul to abstract engine-specific code to support Orange Box.  Additionally, SourceHook received a massive overhaul and is now v4.5, adding global hooks and various major API simplifications.&lt;br /&gt;
&lt;br /&gt;
==Design Considerations==&lt;br /&gt;
====Metamod====&lt;br /&gt;
Originally, Metamod:Source was a plugin co-existing with SourceMod.  However, there are factories, pointers, and certain capabilities not possible from a [[Valve Server Plugin]].  Furthermore, the [[Half-Life 2]] engine does not properly unload VSPs, making debugging and resource unloading more difficult.  Eventually it was decided the added functionality and fine-tuned control outweighed the extra cost of having to configure an intercepting binary.&lt;br /&gt;
&lt;br /&gt;
====Plugins====&lt;br /&gt;
Plugins are specific to Metamod:Source.  This means that [[Valve Server Plugin]]s and [[SourceMM Plugins]] are entirely separate in the API characteristics.  While it is certainly possible to expose the necessary interfaces to VSPs, it creates an added layer of complexity for dealing with things that Metamod:Source might not directly control.  For example, when a Metamod:Source plugin is removed at runtime, all of the necessary hooks are also removed.  A VSP has no clear callback for detecting this event, therefore it would be more difficult to ensure proper unloading.  VSP and MM:S plugins also have different ways of attaching and detaching server [[Cvars|cvars]] and [[Console commands|concmds]].&lt;br /&gt;
&lt;br /&gt;
By keeping the plugin system isolated, Metamod:Source can also provide a unique set of console commands and API.  For example, plugins can listen for certain Metamod:Source-specific events and provide communication channels with other plugins.&lt;br /&gt;
&lt;br /&gt;
====Hooking====&lt;br /&gt;
Metamod:Source is powered by [[SourceHook]], a versatile library for hooking virtual functions.  The original [[Half-Life 1]] engine used structs of function pointers which could easily be modified as they passed from one library to another.  However, HL2 is comprised almost entirely of pure virtual interfaces.  SourceHook was designed for declaring single hooks against a given virtual function and a this pointer, which is not only faster than a blanket hooking system like Metamod's, but more flexible and precise.&lt;br /&gt;
&lt;br /&gt;
Hooking under Metamod:Source has a number of features that don't exist in a hooking system style like Metamod's, and it achieves something closer to [[Detours|detours]], rather than Metamod, which is hardcoded.  For example&lt;br /&gt;
*You can change parent parameters during a hooked call&lt;br /&gt;
*You can hook member functions, both by a pre-existing declaration or given vtable offset&lt;br /&gt;
*You can call the original function and still fire its associated hooks, or you can call it without firing hooks in order to prevent infinite recursion&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
For more information on installing, configuring, and coding for Metamod:Source, see [[:Category:Documentation (SourceMM)|Documentation]].&lt;br /&gt;
&lt;br /&gt;
==The Future==&lt;br /&gt;
While Metamod:Source is a stable/production product, more features are on the horizon.  There are distant plans for a [[Detours|detouring]] library and a library for efficiently automated [[Signature Scanning|signature scanning]].&lt;br /&gt;
&lt;br /&gt;
==License==&lt;br /&gt;
Metamod:Source is licensed under the [[zLib/libpng License]].  It is free to use for both open-source and proprietary projects.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[http://www.sourcemm.net/ Metamod:Source Website]&lt;br /&gt;
*[http://www.metamod.org/ Metamod Website]&lt;br /&gt;
*[http://www.sourcemod.net/ SourceMod Website]&lt;br /&gt;
*[http://resonus.net/doxygen_sourcemm/ Doxygen of Metamod:Source]&lt;/div&gt;</summary>
		<author><name>Cybermind</name></author>
		
	</entry>
</feed>