<?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=Castile</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=Castile"/>
	<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/Special:Contributions/Castile"/>
	<updated>2026-05-27T21:31:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.6</generator>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=10571</id>
		<title>Building SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=10571"/>
		<updated>2018-06-10T00:49:45Z</updated>

		<summary type="html">&lt;p&gt;Castile: /* Source and Dependencies */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Compiling SourceMod is not difficult, but requires a number of prerequisites.  This article details the requirements and steps to being able to build working SourceMod binaries.&lt;br /&gt;
&lt;br /&gt;
Note that specific compiler versions are required to maintain ABI compatibility with Source engine binaries.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
==Windows==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Visual Studio or Visual C++. VS/VC 2010 or above is required for SourceMod 1.6.x and earlier. VS/VC 2013 Update 2 or above is required for SourceMod 1.7.x and later. Express editions should work fine. If you use 2013 or higher, make sure to get the &amp;quot;Desktop&amp;quot; version: [http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Visual Studio Express 2013 for Desktop].&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install [http://git-scm.com/ Git]. Make sure that you select the option that adds Git to PATH.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Next, you will need to start an environment capable of running Python and interacting with the Visual Studio compiler. There are two ways to do this.&lt;br /&gt;
 &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Use [https://wiki.mozilla.org/MozillaBuild MozillaBuild]. MozillaBuild comes with Python, Mercurial, and a unix-like shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install MozillaBuild to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Navigate to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt; and run as administrator the batch file corresponding to your Visual Studio version. For example, &amp;lt;tt&amp;gt;start-msvc10.bat&amp;lt;/tt&amp;gt; for Visual Studio 2010 (10.0). Do not run an x64 version.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Git to MozillaBuild's &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. The easiest way to do this is to enter the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;export PATH=\$PATH:/c/Program\ Files\ \(x86\)/Git/bin&amp;quot; &amp;gt;&amp;gt; ~/.profile&lt;br /&gt;
source ~/.profile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Or, you can manually set up a shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install [http://python.org/ Python] 2.7. It will install to C:\Python27 by default. (Version 3.4 will work, but is not recommended for compatibility with other tools).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Python to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; variable. Go to Control Panel, System, Advanced, Environment Variables. Add &amp;lt;tt&amp;gt;C:\Python27;C:\Python27\Scripts&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; (or wherever your Python install is).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Under Start, Programs, Microsoft Visual Studio, select the &amp;quot;Visual Studio Tools&amp;quot; folder and run &amp;quot;Visual Studio Command Prompt&amp;quot;. Alternately, open a normal command prompt and run &amp;lt;tt&amp;gt;&amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars.bat&amp;quot;&amp;lt;/tt&amp;gt;. Substitute your Visual Studio version if needed.&amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Git, via either system packages or from the [http://git-scm.com/ Git] distribution.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install either the GNU C Compiler or the Clang compiler.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For GCC, version 4.4 or higher is required for SourceMod 1.6.x and earlier, and version 4.7 or high for SourceMod 1.7.x and later. On Debian/Ubuntu-based systems, the commands below will install GCC (the second set of packages is required for building on 64-bit systems).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc g++&lt;br /&gt;
sudo apt-get install gcc-multilib g++-multilib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For Clang, 3.2 or higher is required. On Debian/Ubuntu-based systems, the packages needed are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install clang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;If building on a 64-bit system, a few additional packages may be required. For example on Debian/Ubuntu they are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install ia32-libs&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Newer versions, for example Debian 7.0+ or Ubuntu 13.04+ require slightly different packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install lib32stdc++-4.8-dev&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''You can find the latest release of Clang in LLVM's apt repositories for Debian and Ubuntu. Information on this is at http://llvm.org/apt/''&lt;br /&gt;
&lt;br /&gt;
==Archlinux==&lt;br /&gt;
&lt;br /&gt;
# Enable multilib repository as described in the [https://wiki.archlinux.org/index.php/multilib Archlinux wiki page].&lt;br /&gt;
# Install the following packages:&lt;br /&gt;
#:&amp;lt;pre&amp;gt;pacman -S git python2 gcc-multilib lib32-glibc lib32-libstdc++5 lib32-zlib&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mac OS X==&lt;br /&gt;
Mac OS X 10.7 or higher is required to build, however, SourceMod will work on 10.5. SourceMod will neither build nor run on older PPC Macs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install the Xcode Command Line Tools.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For OS X 10.9 or higher, run the command below in Terminal and click the Install button in the window that appears.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For earlier versions of OS X, download and install Xcode from the App Store. Launch Xcode and then navigate to Preferences -&amp;gt; Downloads -&amp;gt; Components -&amp;gt; Command Line Tools -&amp;gt; Install. If you have recently upgraded Xcode, you will need to perform this step again. SourceMod cannot build without Xcode's command line tools.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Source and Dependencies=&lt;br /&gt;
&lt;br /&gt;
First, grab the SourceMod source tree. We recommend placing it inside its own folder, since we'll also need to download its dependencies.&lt;br /&gt;
&lt;br /&gt;
'''You should do a recursive checkout of the git repo since the sourcepawn repo is a submodule of sourcemod now, see https://stackoverflow.com/questions/3796927/how-to-git-clone-including-submodules to do that.'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p alliedmodders&lt;br /&gt;
cd alliedmodders&lt;br /&gt;
git clone --recursive https://github.com/alliedmodders/sourcemod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, run the &amp;lt;tt&amp;gt;checkout-deps.sh&amp;lt;/tt&amp;gt; script. This will download all dependencies and attempt to install AMBuild. If you are using Linux or OS X, it may prompt you for your sudo password at the very end. If you want to skip this and install AMBuild manually, just Ctrl+C. (Do not run the checkout script with sudo.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bash sourcemod/tools/checkout-deps.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After it's done, you should see a large number of hl2sdk folders and other assorted dependencies, like MySQL, Metamod:Source, and AMBuild.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, but not using MozillaBuild, then you won't be able to use the checkout-deps script. Instead, you'll have to manually clone the following repositories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone --mirror https://github.com/alliedmodders/hl2sdk hl2sdk-proxy-repo&lt;br /&gt;
# For each SDK you want to build with:&lt;br /&gt;
# git clone hl2sdk-proxy-repo hl2sdk-&amp;lt;SDK&amp;gt; -b &amp;lt;SDK&amp;gt;&lt;br /&gt;
# e.g. git clone hl2sdk-proxy-repo hl2sdk-csgo -b csgo&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/alliedmodders/metamod-source mmsource-1.10 -b 1.10-dev&lt;br /&gt;
&lt;br /&gt;
# If building version 1.10 of SourceMod, use MySQL 5.5&lt;br /&gt;
wget https://cdn.mysql.com/archives/mysql-5.5/mysql-5.5.54-win32.zip mysql-5.5&lt;br /&gt;
&lt;br /&gt;
# If building &amp;lt; version 1.10 of SourceMod, use MySQL 5.0&lt;br /&gt;
wget https://cdn.mysql.com/archives/mysql-5.0/mysql-noinstall-5.0.24a-win32.zip mysql-5.0&lt;br /&gt;
&lt;br /&gt;
# Install AMBuild&lt;br /&gt;
git clone https://github.com/alliedmodders/ambuild&lt;br /&gt;
cd ambuild&lt;br /&gt;
C:\Python27\python.exe setup.py install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can skip MySQL and SDK versions you don't plan to build.&lt;br /&gt;
&lt;br /&gt;
=Configuring=&lt;br /&gt;
&lt;br /&gt;
The first time you are building a SourceMod tree, you must ''configure'' the build. This step initializes some basic information and allows some customization around how things get compiled.&lt;br /&gt;
&lt;br /&gt;
First create a build folder within your sourcemod folder, and then run &amp;lt;tt&amp;gt;configure.py&amp;lt;/tt&amp;gt;. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd sourcemod&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
python ../configure.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.&lt;br /&gt;
&lt;br /&gt;
There are a few extra options you can pass to &amp;lt;tt&amp;gt;configure&amp;lt;/tt&amp;gt;:&lt;br /&gt;
*--enable-debug - Compile with symbols and debug checks/assertions.&lt;br /&gt;
*--enable-optimize - Compile with optimizations.&lt;br /&gt;
*--no-sse - Disable floating point optimizations (if you have a very, very old CPU).&lt;br /&gt;
*--no-mysql - Don't build the MySQL database module.&lt;br /&gt;
*--sdks css - Only build css.&lt;br /&gt;
&lt;br /&gt;
See configure.py for all the options.&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
To build SourceMod, simply type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In your build folder. Alternately, you can specify the path of the build folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild debug-build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full package layout that would be shipped for release is in the &amp;lt;tt&amp;gt;package&amp;lt;/tt&amp;gt; folder of the build.&lt;br /&gt;
&lt;br /&gt;
=Deprecated Tools=&lt;br /&gt;
==Visual Studio Project Files==&lt;br /&gt;
In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.&lt;br /&gt;
&lt;br /&gt;
First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the &amp;lt;tt&amp;gt;checkout-windows-deps.bat&amp;lt;/tt&amp;gt; script. Next,&lt;br /&gt;
#Open the Control Panel (for example, via Start -&amp;gt; Settings).&lt;br /&gt;
#Open the System control.  If you don't see it, you may need to switch to &amp;quot;Classic view&amp;quot; (either via the left-hand pane or by going to Tools -&amp;gt; Folder Options).&lt;br /&gt;
#Click the Advanced tab.&lt;br /&gt;
#Click the Environment Variables button.&lt;br /&gt;
&lt;br /&gt;
Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in &amp;lt;tt&amp;gt;fixed-width font&amp;lt;/tt&amp;gt; and their value descriptions follow.&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE19&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE18&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep1/Original&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOB&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep2/OrangeBox for mods&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOBVALVE&amp;lt;/tt&amp;gt; - Path to HL2SDK Source 2009 (HL2:DM, DoD:S, TF2)&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-SWARM&amp;lt;/tt&amp;gt; - Path to HL2SDK Alien Swarm&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-BGT&amp;lt;/tt&amp;gt; - Path to HL2SDK for Bloody Good Time&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSGO&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:GO&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSS&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:S&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DARKM&amp;lt;/tt&amp;gt; - Path to HL2SDK Dark Messiah&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-EYE&amp;lt;/tt&amp;gt; - Path to HL2SDK E.Y.E.: Divine Cybermancy&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D1&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D2&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D2&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DOTA&amp;lt;/tt&amp;gt; - Path to HL2SDK DOTA 2&lt;br /&gt;
*&amp;lt;tt&amp;gt;MYSQL5&amp;lt;/tt&amp;gt; - Path to the folder that contains MySQL's &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; folders.&lt;br /&gt;
&lt;br /&gt;
==Makefiles==&lt;br /&gt;
Makefiles are deprecated and will be removed from the tree soon.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Documentation]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Castile</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=10570</id>
		<title>Building SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=10570"/>
		<updated>2018-06-10T00:49:15Z</updated>

		<summary type="html">&lt;p&gt;Castile: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Compiling SourceMod is not difficult, but requires a number of prerequisites.  This article details the requirements and steps to being able to build working SourceMod binaries.&lt;br /&gt;
&lt;br /&gt;
Note that specific compiler versions are required to maintain ABI compatibility with Source engine binaries.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
==Windows==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Visual Studio or Visual C++. VS/VC 2010 or above is required for SourceMod 1.6.x and earlier. VS/VC 2013 Update 2 or above is required for SourceMod 1.7.x and later. Express editions should work fine. If you use 2013 or higher, make sure to get the &amp;quot;Desktop&amp;quot; version: [http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Visual Studio Express 2013 for Desktop].&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install [http://git-scm.com/ Git]. Make sure that you select the option that adds Git to PATH.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Next, you will need to start an environment capable of running Python and interacting with the Visual Studio compiler. There are two ways to do this.&lt;br /&gt;
 &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Use [https://wiki.mozilla.org/MozillaBuild MozillaBuild]. MozillaBuild comes with Python, Mercurial, and a unix-like shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install MozillaBuild to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Navigate to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt; and run as administrator the batch file corresponding to your Visual Studio version. For example, &amp;lt;tt&amp;gt;start-msvc10.bat&amp;lt;/tt&amp;gt; for Visual Studio 2010 (10.0). Do not run an x64 version.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Git to MozillaBuild's &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. The easiest way to do this is to enter the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;export PATH=\$PATH:/c/Program\ Files\ \(x86\)/Git/bin&amp;quot; &amp;gt;&amp;gt; ~/.profile&lt;br /&gt;
source ~/.profile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Or, you can manually set up a shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install [http://python.org/ Python] 2.7. It will install to C:\Python27 by default. (Version 3.4 will work, but is not recommended for compatibility with other tools).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Python to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; variable. Go to Control Panel, System, Advanced, Environment Variables. Add &amp;lt;tt&amp;gt;C:\Python27;C:\Python27\Scripts&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; (or wherever your Python install is).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Under Start, Programs, Microsoft Visual Studio, select the &amp;quot;Visual Studio Tools&amp;quot; folder and run &amp;quot;Visual Studio Command Prompt&amp;quot;. Alternately, open a normal command prompt and run &amp;lt;tt&amp;gt;&amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars.bat&amp;quot;&amp;lt;/tt&amp;gt;. Substitute your Visual Studio version if needed.&amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Git, via either system packages or from the [http://git-scm.com/ Git] distribution.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install either the GNU C Compiler or the Clang compiler.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For GCC, version 4.4 or higher is required for SourceMod 1.6.x and earlier, and version 4.7 or high for SourceMod 1.7.x and later. On Debian/Ubuntu-based systems, the commands below will install GCC (the second set of packages is required for building on 64-bit systems).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc g++&lt;br /&gt;
sudo apt-get install gcc-multilib g++-multilib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For Clang, 3.2 or higher is required. On Debian/Ubuntu-based systems, the packages needed are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install clang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;If building on a 64-bit system, a few additional packages may be required. For example on Debian/Ubuntu they are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install ia32-libs&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Newer versions, for example Debian 7.0+ or Ubuntu 13.04+ require slightly different packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install lib32stdc++-4.8-dev&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''You can find the latest release of Clang in LLVM's apt repositories for Debian and Ubuntu. Information on this is at http://llvm.org/apt/''&lt;br /&gt;
&lt;br /&gt;
==Archlinux==&lt;br /&gt;
&lt;br /&gt;
# Enable multilib repository as described in the [https://wiki.archlinux.org/index.php/multilib Archlinux wiki page].&lt;br /&gt;
# Install the following packages:&lt;br /&gt;
#:&amp;lt;pre&amp;gt;pacman -S git python2 gcc-multilib lib32-glibc lib32-libstdc++5 lib32-zlib&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mac OS X==&lt;br /&gt;
Mac OS X 10.7 or higher is required to build, however, SourceMod will work on 10.5. SourceMod will neither build nor run on older PPC Macs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install the Xcode Command Line Tools.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For OS X 10.9 or higher, run the command below in Terminal and click the Install button in the window that appears.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For earlier versions of OS X, download and install Xcode from the App Store. Launch Xcode and then navigate to Preferences -&amp;gt; Downloads -&amp;gt; Components -&amp;gt; Command Line Tools -&amp;gt; Install. If you have recently upgraded Xcode, you will need to perform this step again. SourceMod cannot build without Xcode's command line tools.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Source and Dependencies=&lt;br /&gt;
&lt;br /&gt;
First, grab the SourceMod source tree. We recommend placing it inside its own folder, since we'll also need to download its dependencies.&lt;br /&gt;
&lt;br /&gt;
'''You should do a recursive checkout of the git repo since the sourcepawn repo is a submodule of sourcemod now, see https://stackoverflow.com/questions/3796927/how-to-git-clone-including-submodules to do that.'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p alliedmodders&lt;br /&gt;
cd alliedmodders&lt;br /&gt;
git clone --recursive https://github.com/alliedmodders/sourcemod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, run the &amp;lt;tt&amp;gt;checkout-deps.sh&amp;lt;/tt&amp;gt; script. This will download all dependencies and attempt to install AMBuild. If you are using Linux or OS X, it may prompt you for your sudo password at the very end. If you want to skip this and install AMBuild manually, just Ctrl+C. (Do not run the checkout script with sudo.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bash sourcemod/tools/checkout-deps.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After it's done, you should see a large number of hl2sdk folders and other assorted dependencies, like MySQL, Metamod:Source, and AMBuild.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, but not using MozillaBuild, then you won't be able to use the checkout-deps script. Instead, you'll have to manually clone the following repositories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone --mirror https://github.com/alliedmodders/hl2sdk hl2sdk-proxy-repo&lt;br /&gt;
# For each SDK you want to build with:&lt;br /&gt;
# git clone hl2sdk-proxy-repo hl2sdk-&amp;lt;SDK&amp;gt; -b &amp;lt;SDK&amp;gt;&lt;br /&gt;
# e.g. git clone hl2sdk-proxy-repo hl2sdk-csgo -b csgo&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/alliedmodders/metamod-source mmsource-1.10 -b 1.10-dev&lt;br /&gt;
&lt;br /&gt;
# If building version 1.10 of SourceMod, use MySQL 5.5&lt;br /&gt;
wget https://cdn.mysql.com/archives/mysql-5.5/mysql-5.5.54-win32.zip mysql-5.5&lt;br /&gt;
&lt;br /&gt;
# If building &amp;lt; version 1.10 of SourceMod, use MySQL 5.0&lt;br /&gt;
wget https://cdn.mysql.com/archives/mysql-5.0/mysql-noinstall-5.0.24a-win32.zip mysql-noinstall-5.0.24a-win32&lt;br /&gt;
&lt;br /&gt;
# Install AMBuild&lt;br /&gt;
git clone https://github.com/alliedmodders/ambuild&lt;br /&gt;
cd ambuild&lt;br /&gt;
C:\Python27\python.exe setup.py install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can skip MySQL and SDK versions you don't plan to build.&lt;br /&gt;
&lt;br /&gt;
=Configuring=&lt;br /&gt;
&lt;br /&gt;
The first time you are building a SourceMod tree, you must ''configure'' the build. This step initializes some basic information and allows some customization around how things get compiled.&lt;br /&gt;
&lt;br /&gt;
First create a build folder within your sourcemod folder, and then run &amp;lt;tt&amp;gt;configure.py&amp;lt;/tt&amp;gt;. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd sourcemod&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
python ../configure.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.&lt;br /&gt;
&lt;br /&gt;
There are a few extra options you can pass to &amp;lt;tt&amp;gt;configure&amp;lt;/tt&amp;gt;:&lt;br /&gt;
*--enable-debug - Compile with symbols and debug checks/assertions.&lt;br /&gt;
*--enable-optimize - Compile with optimizations.&lt;br /&gt;
*--no-sse - Disable floating point optimizations (if you have a very, very old CPU).&lt;br /&gt;
*--no-mysql - Don't build the MySQL database module.&lt;br /&gt;
*--sdks css - Only build css.&lt;br /&gt;
&lt;br /&gt;
See configure.py for all the options.&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
To build SourceMod, simply type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In your build folder. Alternately, you can specify the path of the build folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild debug-build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full package layout that would be shipped for release is in the &amp;lt;tt&amp;gt;package&amp;lt;/tt&amp;gt; folder of the build.&lt;br /&gt;
&lt;br /&gt;
=Deprecated Tools=&lt;br /&gt;
==Visual Studio Project Files==&lt;br /&gt;
In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.&lt;br /&gt;
&lt;br /&gt;
First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the &amp;lt;tt&amp;gt;checkout-windows-deps.bat&amp;lt;/tt&amp;gt; script. Next,&lt;br /&gt;
#Open the Control Panel (for example, via Start -&amp;gt; Settings).&lt;br /&gt;
#Open the System control.  If you don't see it, you may need to switch to &amp;quot;Classic view&amp;quot; (either via the left-hand pane or by going to Tools -&amp;gt; Folder Options).&lt;br /&gt;
#Click the Advanced tab.&lt;br /&gt;
#Click the Environment Variables button.&lt;br /&gt;
&lt;br /&gt;
Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in &amp;lt;tt&amp;gt;fixed-width font&amp;lt;/tt&amp;gt; and their value descriptions follow.&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE19&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE18&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep1/Original&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOB&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep2/OrangeBox for mods&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOBVALVE&amp;lt;/tt&amp;gt; - Path to HL2SDK Source 2009 (HL2:DM, DoD:S, TF2)&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-SWARM&amp;lt;/tt&amp;gt; - Path to HL2SDK Alien Swarm&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-BGT&amp;lt;/tt&amp;gt; - Path to HL2SDK for Bloody Good Time&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSGO&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:GO&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSS&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:S&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DARKM&amp;lt;/tt&amp;gt; - Path to HL2SDK Dark Messiah&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-EYE&amp;lt;/tt&amp;gt; - Path to HL2SDK E.Y.E.: Divine Cybermancy&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D1&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D2&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D2&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DOTA&amp;lt;/tt&amp;gt; - Path to HL2SDK DOTA 2&lt;br /&gt;
*&amp;lt;tt&amp;gt;MYSQL5&amp;lt;/tt&amp;gt; - Path to the folder that contains MySQL's &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; folders.&lt;br /&gt;
&lt;br /&gt;
==Makefiles==&lt;br /&gt;
Makefiles are deprecated and will be removed from the tree soon.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Documentation]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Castile</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=10569</id>
		<title>Building SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=10569"/>
		<updated>2018-06-09T22:05:41Z</updated>

		<summary type="html">&lt;p&gt;Castile: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Compiling SourceMod is not difficult, but requires a number of prerequisites.  This article details the requirements and steps to being able to build working SourceMod binaries.&lt;br /&gt;
&lt;br /&gt;
Note that specific compiler versions are required to maintain ABI compatibility with Source engine binaries.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
==Windows==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Visual Studio or Visual C++. VS/VC 2010 or above is required for SourceMod 1.6.x and earlier. VS/VC 2013 Update 2 or above is required for SourceMod 1.7.x and later. Express editions should work fine. If you use 2013 or higher, make sure to get the &amp;quot;Desktop&amp;quot; version: [http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Visual Studio Express 2013 for Desktop].&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install [http://git-scm.com/ Git]. Make sure that you select the option that adds Git to PATH.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Next, you will need to start an environment capable of running Python and interacting with the Visual Studio compiler. There are two ways to do this.&lt;br /&gt;
 &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Use [https://wiki.mozilla.org/MozillaBuild MozillaBuild]. MozillaBuild comes with Python, Mercurial, and a unix-like shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install MozillaBuild to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Navigate to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt; and run as administrator the batch file corresponding to your Visual Studio version. For example, &amp;lt;tt&amp;gt;start-msvc10.bat&amp;lt;/tt&amp;gt; for Visual Studio 2010 (10.0). Do not run an x64 version.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Git to MozillaBuild's &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. The easiest way to do this is to enter the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;export PATH=\$PATH:/c/Program\ Files\ \(x86\)/Git/bin&amp;quot; &amp;gt;&amp;gt; ~/.profile&lt;br /&gt;
source ~/.profile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Or, you can manually set up a shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install [http://python.org/ Python] 2.7. It will install to C:\Python27 by default. (Version 3.4 will work, but is not recommended for compatibility with other tools).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Python to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; variable. Go to Control Panel, System, Advanced, Environment Variables. Add &amp;lt;tt&amp;gt;C:\Python27;C:\Python27\Scripts&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; (or wherever your Python install is).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Under Start, Programs, Microsoft Visual Studio, select the &amp;quot;Visual Studio Tools&amp;quot; folder and run &amp;quot;Visual Studio Command Prompt&amp;quot;. Alternately, open a normal command prompt and run &amp;lt;tt&amp;gt;&amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars.bat&amp;quot;&amp;lt;/tt&amp;gt;. Substitute your Visual Studio version if needed.&amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Git, via either system packages or from the [http://git-scm.com/ Git] distribution.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install either the GNU C Compiler or the Clang compiler.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For GCC, version 4.4 or higher is required for SourceMod 1.6.x and earlier, and version 4.7 or high for SourceMod 1.7.x and later. On Debian/Ubuntu-based systems, the commands below will install GCC (the second set of packages is required for building on 64-bit systems).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc g++&lt;br /&gt;
sudo apt-get install gcc-multilib g++-multilib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For Clang, 3.2 or higher is required. On Debian/Ubuntu-based systems, the packages needed are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install clang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;If building on a 64-bit system, a few additional packages may be required. For example on Debian/Ubuntu they are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install ia32-libs&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Newer versions, for example Debian 7.0+ or Ubuntu 13.04+ require slightly different packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install lib32stdc++-4.8-dev&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''You can find the latest release of Clang in LLVM's apt repositories for Debian and Ubuntu. Information on this is at http://llvm.org/apt/''&lt;br /&gt;
&lt;br /&gt;
==Archlinux==&lt;br /&gt;
&lt;br /&gt;
# Enable multilib repository as described in the [https://wiki.archlinux.org/index.php/multilib Archlinux wiki page].&lt;br /&gt;
# Install the following packages:&lt;br /&gt;
#:&amp;lt;pre&amp;gt;pacman -S git python2 gcc-multilib lib32-glibc lib32-libstdc++5 lib32-zlib&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mac OS X==&lt;br /&gt;
Mac OS X 10.7 or higher is required to build, however, SourceMod will work on 10.5. SourceMod will neither build nor run on older PPC Macs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install the Xcode Command Line Tools.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For OS X 10.9 or higher, run the command below in Terminal and click the Install button in the window that appears.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For earlier versions of OS X, download and install Xcode from the App Store. Launch Xcode and then navigate to Preferences -&amp;gt; Downloads -&amp;gt; Components -&amp;gt; Command Line Tools -&amp;gt; Install. If you have recently upgraded Xcode, you will need to perform this step again. SourceMod cannot build without Xcode's command line tools.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Source and Dependencies=&lt;br /&gt;
&lt;br /&gt;
First, grab the SourceMod source tree. We recommend placing it inside its own folder, since we'll also need to download its dependencies.&lt;br /&gt;
&lt;br /&gt;
'''You should do a recursive checkout of the git repo since the sourcepawn repo is a submodule of sourcemod now, see https://stackoverflow.com/questions/3796927/how-to-git-clone-including-submodules to do that.'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p alliedmodders&lt;br /&gt;
cd alliedmodders&lt;br /&gt;
git clone --recursive https://github.com/alliedmodders/sourcemod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, run the &amp;lt;tt&amp;gt;checkout-deps.sh&amp;lt;/tt&amp;gt; script. This will download all dependencies and attempt to install AMBuild. If you are using Linux or OS X, it may prompt you for your sudo password at the very end. If you want to skip this and install AMBuild manually, just Ctrl+C. (Do not run the checkout script with sudo.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bash sourcemod/tools/checkout-deps.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After it's done, you should see a large number of hl2sdk folders and other assorted dependencies, like MySQL, Metamod:Source, and AMBuild.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, but not using MozillaBuild, then you won't be able to use the checkout-deps script. Instead, you'll have to manually clone the following repositories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone --mirror https://github.com/alliedmodders/hl2sdk hl2sdk-proxy-repo&lt;br /&gt;
# For each SDK you want to build with:&lt;br /&gt;
# git clone hl2sdk-proxy-repo hl2sdk-&amp;lt;SDK&amp;gt; -b &amp;lt;SDK&amp;gt;&lt;br /&gt;
# e.g. git clone hl2sdk-proxy-repo hl2sdk-csgo -b csgo&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/alliedmodders/metamod-source mmsource-1.10 -b 1.10-dev&lt;br /&gt;
wget https://cdn.mysql.com/archives/mysql-5.5/mysql-5.5.54-win32.zip mysql-5.5&lt;br /&gt;
&lt;br /&gt;
# Install AMBuild&lt;br /&gt;
git clone https://github.com/alliedmodders/ambuild&lt;br /&gt;
cd ambuild&lt;br /&gt;
C:\Python27\python.exe setup.py install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can skip MySQL and SDK versions you don't plan to build.&lt;br /&gt;
&lt;br /&gt;
=Configuring=&lt;br /&gt;
&lt;br /&gt;
The first time you are building a SourceMod tree, you must ''configure'' the build. This step initializes some basic information and allows some customization around how things get compiled.&lt;br /&gt;
&lt;br /&gt;
First create a build folder within your sourcemod folder, and then run &amp;lt;tt&amp;gt;configure.py&amp;lt;/tt&amp;gt;. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd sourcemod&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
python ../configure.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.&lt;br /&gt;
&lt;br /&gt;
There are a few extra options you can pass to &amp;lt;tt&amp;gt;configure&amp;lt;/tt&amp;gt;:&lt;br /&gt;
*--enable-debug - Compile with symbols and debug checks/assertions.&lt;br /&gt;
*--enable-optimize - Compile with optimizations.&lt;br /&gt;
*--no-sse - Disable floating point optimizations (if you have a very, very old CPU).&lt;br /&gt;
*--no-mysql - Don't build the MySQL database module.&lt;br /&gt;
*--sdks css - Only build css.&lt;br /&gt;
&lt;br /&gt;
See configure.py for all the options.&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
To build SourceMod, simply type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In your build folder. Alternately, you can specify the path of the build folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild debug-build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full package layout that would be shipped for release is in the &amp;lt;tt&amp;gt;package&amp;lt;/tt&amp;gt; folder of the build.&lt;br /&gt;
&lt;br /&gt;
=Deprecated Tools=&lt;br /&gt;
==Visual Studio Project Files==&lt;br /&gt;
In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.&lt;br /&gt;
&lt;br /&gt;
First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the &amp;lt;tt&amp;gt;checkout-windows-deps.bat&amp;lt;/tt&amp;gt; script. Next,&lt;br /&gt;
#Open the Control Panel (for example, via Start -&amp;gt; Settings).&lt;br /&gt;
#Open the System control.  If you don't see it, you may need to switch to &amp;quot;Classic view&amp;quot; (either via the left-hand pane or by going to Tools -&amp;gt; Folder Options).&lt;br /&gt;
#Click the Advanced tab.&lt;br /&gt;
#Click the Environment Variables button.&lt;br /&gt;
&lt;br /&gt;
Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in &amp;lt;tt&amp;gt;fixed-width font&amp;lt;/tt&amp;gt; and their value descriptions follow.&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE19&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE18&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep1/Original&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOB&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep2/OrangeBox for mods&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOBVALVE&amp;lt;/tt&amp;gt; - Path to HL2SDK Source 2009 (HL2:DM, DoD:S, TF2)&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-SWARM&amp;lt;/tt&amp;gt; - Path to HL2SDK Alien Swarm&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-BGT&amp;lt;/tt&amp;gt; - Path to HL2SDK for Bloody Good Time&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSGO&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:GO&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSS&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:S&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DARKM&amp;lt;/tt&amp;gt; - Path to HL2SDK Dark Messiah&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-EYE&amp;lt;/tt&amp;gt; - Path to HL2SDK E.Y.E.: Divine Cybermancy&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D1&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D2&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D2&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DOTA&amp;lt;/tt&amp;gt; - Path to HL2SDK DOTA 2&lt;br /&gt;
*&amp;lt;tt&amp;gt;MYSQL5&amp;lt;/tt&amp;gt; - Path to the folder that contains MySQL's &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; folders.&lt;br /&gt;
&lt;br /&gt;
==Makefiles==&lt;br /&gt;
Makefiles are deprecated and will be removed from the tree soon.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Documentation]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Castile</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=9583</id>
		<title>Introduction to SourceMod Plugins</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=9583"/>
		<updated>2014-05-28T23:21:14Z</updated>

		<summary type="html">&lt;p&gt;Castile: /* Getting code to run */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide will give you a basic introduction to writing a [[SourceMod]] plugin.  If you are not familiar with the SourcePawn language, it is recommended that you at least briefly read the [[Introduction to SourcePawn]] article.&lt;br /&gt;
&lt;br /&gt;
For information on compiling plugins, see [[Compiling SourceMod Plugins]]. You can use [http://www.crimsoneditor.com/ Crimson Editor], [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], [http://sourceforge.net/projects/pawnstudio/ Pawn Studio] or any other text editor you're comfortable with to write plugins.&lt;br /&gt;
&lt;br /&gt;
=Starting from scratch=&lt;br /&gt;
Open your favorite text editor and create a new empty file. When you have an empty file you can just start writing code using the core language, however, you will not be able to use any of SourceMod features because the compiler does not now about them. This is done deliberately so it is possible to use SourcePawn outside of SourceMod. But since we are writing a SourceMod plugin, it is a good idea to enable access to SourceMod features first. This it done using &amp;lt;tt&amp;gt;#include&amp;lt;/tt&amp;gt; directive. It tells compiler to &amp;quot;paste&amp;quot; the code from another file into yours.&lt;br /&gt;
&amp;lt;pawn&amp;gt;#include &amp;lt;sourcemod&amp;gt;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
How does this work? First of all, note that we enclosed file name into angle brackets. Angle brackets tell the compiler to look in the default include directory. By default, it is '''scripting/include'''. You can open it right now and see a lot of inc files there. Those are SourceMod include files that describe various functions, tags and other features available for SourceMod plugins. The files are plain-text and you are encouraged to read them. You will notice however, that there's not much code in there, certainly not enough to implement all the great features of SourceMod, so where are they? They are implemented inside a SourceMod core which is written in C++ and is compiled into binary files which end up in '''bin''' directory. So how does your SourcePawn code and SM core link together if compiler doesn't know about existence of the latter? SourceMod include files are written specially, so they say that the implementation of functions is ''somewhere else''. Compiler understands that and generate a special code that says that this function call is going outside. When SourceMod loads your plugin, it inspects these bits of code and substitutes it's own internal functions instead. This is called [http://en.wikipedia.org/wiki/Dynamic_linking dynamic linking].&lt;br /&gt;
&lt;br /&gt;
=Setting up plugin info=&lt;br /&gt;
Now that we got access to SourceMod features, it is time to setup the information that will be displayed via &amp;lt;tt&amp;gt;sm plugins list&amp;lt;/tt&amp;gt; command. No one likes unnamed plugins. To do that we are going to look inside '''sourcemod.inc''' file and see the format that information should be declared. It's always helpful to look inside SM include files to find out information you don't know. There is also an [http://docs.sourcemod.net/api/ API documentation] but it can be outdated and it only has SM core files so if your plugin are going to use any third party extension or another plugin, you will have to study inc files. So, open '''sourcemod.inc''' and scroll down a bit until you see this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;/**&lt;br /&gt;
 * Plugin public information.&lt;br /&gt;
 */&lt;br /&gt;
struct Plugin&lt;br /&gt;
{&lt;br /&gt;
   const String:name[],			/**&amp;lt; Plugin Name */&lt;br /&gt;
   const String:description[],	/**&amp;lt; Plugin Description */&lt;br /&gt;
   const String:author[],		/**&amp;lt; Plugin Author */&lt;br /&gt;
   const String:version[],		/**&amp;lt; Plugin Version */&lt;br /&gt;
   const String:url[],			/**&amp;lt; Plugin URL */&lt;br /&gt;
};&amp;lt;/pawn&amp;gt;&lt;br /&gt;
and this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;/**&lt;br /&gt;
 * Declare this as a struct in your plugin to expose its information.&lt;br /&gt;
 * Example:&lt;br /&gt;
 *&lt;br /&gt;
 * public Plugin:myinfo =&lt;br /&gt;
 * {&lt;br /&gt;
 *    name = &amp;quot;My Plugin&amp;quot;,&lt;br /&gt;
 *    //etc&lt;br /&gt;
 * };&lt;br /&gt;
 */&lt;br /&gt;
public Plugin:myinfo;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It tells us that we need to create a global public variable &amp;lt;tt&amp;gt;myinfo&amp;lt;/tt&amp;gt; which must be of type &amp;lt;tt&amp;gt;Plugin&amp;lt;/tt&amp;gt; which is a struct with 5 fields which themselves are strings. It may sound complicated for a beginner but it's easy. Let's go ahead and create one:&lt;br /&gt;
&amp;lt;pawn&amp;gt;public Plugin:myinfo =&lt;br /&gt;
{&lt;br /&gt;
	name = &amp;quot;My First Plugin&amp;quot;,&lt;br /&gt;
	author = &amp;quot;Me&amp;quot;,&lt;br /&gt;
	description = &amp;quot;My first plugin ever&amp;quot;,&lt;br /&gt;
	version = &amp;quot;1.0&amp;quot;,&lt;br /&gt;
	url = &amp;quot;http://www.sourcemod.net/&amp;quot;&lt;br /&gt;
};&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;public&amp;lt;/tt&amp;gt; keyword means that SourceMod will be able to directly access our variable. &amp;lt;tt&amp;gt;Plugin:&amp;lt;/tt&amp;gt; defines a type of our variable. &amp;lt;tt&amp;gt;myinfo&amp;lt;/tt&amp;gt; is, obviously, a name of our variable as required by SourceMod. You see that we initialize it right away. This is preferred way to do when filling out plugin info.&lt;br /&gt;
&lt;br /&gt;
After that the full code of your plugin should look like this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;#include &amp;lt;sourcemod&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public Plugin:myinfo =&lt;br /&gt;
{&lt;br /&gt;
	name = &amp;quot;My First Plugin&amp;quot;,&lt;br /&gt;
	author = &amp;quot;Me&amp;quot;,&lt;br /&gt;
	description = &amp;quot;My first plugin ever&amp;quot;,&lt;br /&gt;
	version = &amp;quot;1.0&amp;quot;,&lt;br /&gt;
	url = &amp;quot;http://www.sourcemod.net/&amp;quot;&lt;br /&gt;
};&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Getting code to run=&lt;br /&gt;
We already include SourceMod features and filled up or plugin info. We now have a perfectly well formed plugin which can be compiled and loaded by SourceMod. However, there is one problem - it does nothing. You might be tempted to just start writing a code after &amp;lt;tt&amp;gt;myinfo&amp;lt;/tt&amp;gt; declaration just to see that it will not compile. SourcePawn, unlike other scripting languages like Lua, does not allow a code to be outside of functions. After reading that, you may probably want to just define some function, name it &amp;lt;tt&amp;gt;main&amp;lt;/tt&amp;gt; probably, compile and load a plugin and see that your code never gets called. So how do we make SourceMod call our code? For this exact reason we have forwards. Forwards are function prototypes declared by one party that can be implemented by another party as a [http://en.wikipedia.org/wiki/Callback_%28computer_programming%29 callback]. When a first party starts a forward call, all parties that have matching callbacks receive the call. SourceMod declares a plenty of interesting forwards that we can implement. As you can see, forwards are the only way to get our code executed, keep that in mind. So let's implement &amp;lt;tt&amp;gt;OnPluginStart&amp;lt;/tt&amp;gt; forward. As you may have guessed, it is called when our plugin starts. To do that, we'll have to look up the declaration of &amp;lt;tt&amp;gt;OnPluginStart&amp;lt;/tt&amp;gt;. It is declared inside '''sourcemod.inc''', a file we are already familiar with, let's find it:&lt;br /&gt;
&amp;lt;pawn&amp;gt;/**&lt;br /&gt;
 * Called when the plugin is fully initialized and all known external references &lt;br /&gt;
 * are resolved. This is only called once in the lifetime of the plugin, and is &lt;br /&gt;
 * paired with OnPluginEnd().&lt;br /&gt;
 *&lt;br /&gt;
 * If any run-time error is thrown during this callback, the plugin will be marked &lt;br /&gt;
 * as failed.&lt;br /&gt;
 *&lt;br /&gt;
 * It is not necessary to close any handles or remove hooks in this function.  &lt;br /&gt;
 * SourceMod guarantees that plugin shutdown automatically and correctly releases &lt;br /&gt;
 * all resources.&lt;br /&gt;
 *&lt;br /&gt;
 * @noreturn&lt;br /&gt;
 */&lt;br /&gt;
forward OnPluginStart();&amp;lt;/pawn&amp;gt;&lt;br /&gt;
Empty parentheses tells us that no arguments are passed inside this forward, &amp;lt;tt&amp;gt;@noreturn&amp;lt;/tt&amp;gt; inside documentation tells us that we don't have to return anything, pretty simple forward. So how to write a correct callback for it? Firstly, our callback must have the same name, so it's &amp;lt;tt&amp;gt;OnPluginStart&amp;lt;/tt&amp;gt;, secondly, our callback should have the same number of arguments, none in this case, and lastly, SourceMod needs to be able to call our callback so it needs to be &amp;lt;tt&amp;gt;public&amp;lt;/tt&amp;gt;. So the implementation looks like this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we can write code inside curly brackets and it will be executed when our plugin starts. Let's output &amp;lt;tt&amp;gt;&amp;quot;Hello world!&amp;quot;&amp;lt;/tt&amp;gt; to server console. To do that we are going to use &amp;lt;tt&amp;gt;PrintToServer&amp;lt;/tt&amp;gt; function. It is declared inside '''console.inc''', however, we don't need to manually include '''console.inc''' because it is included automatically as part of '''sourcemod.inc'''.&lt;br /&gt;
&amp;lt;pawn&amp;gt;/**&lt;br /&gt;
 * Sends a message to the server console.&lt;br /&gt;
 *&lt;br /&gt;
 * @param format		Formatting rules.&lt;br /&gt;
 * @param ...			Variable number of format parameters.&lt;br /&gt;
 * @noreturn&lt;br /&gt;
 */&lt;br /&gt;
native PrintToServer(const String:format[], any:...);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
As you can see, this is a native function. It is implemented inside SM core. Judging by it's arguments, we can see that it is a [[Format_Class_Functions_%28SourceMod_Scripting%29|format class function]]. However, we don't need any formatting right now, so let's just pass &amp;lt;tt&amp;gt;&amp;quot;Hello world!&amp;quot;&amp;lt;/tt&amp;gt; string as an only argument:&lt;br /&gt;
&amp;lt;pawn&amp;gt;public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
	PrintToServer(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
That's it! The full code of your plugin should look like this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;#include &amp;lt;sourcemod&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public Plugin:myinfo =&lt;br /&gt;
{&lt;br /&gt;
	name = &amp;quot;My First Plugin&amp;quot;,&lt;br /&gt;
	author = &amp;quot;Me&amp;quot;,&lt;br /&gt;
	description = &amp;quot;My first plugin ever&amp;quot;,&lt;br /&gt;
	version = &amp;quot;1.0&amp;quot;,&lt;br /&gt;
	url = &amp;quot;http://www.sourcemod.net/&amp;quot;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
	PrintToServer(&amp;quot;Hello world!&amp;quot;);&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
Compile and load your plugin on your server and see for yourself that the message is displayed in server console.&lt;br /&gt;
&lt;br /&gt;
=Includes=&lt;br /&gt;
Pawn requires '''include files''', much like C requires header files.  Include files list all of the structures, functions, callbacks, and tags that are available.  There are three types of include files:&lt;br /&gt;
*'''Core''' - &amp;lt;tt&amp;gt;sourcemod.inc&amp;lt;/tt&amp;gt; and anything it includes.  These are all provided by SourceMod's Core.&lt;br /&gt;
*'''Extension''' - adds a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' - adds a dependency against a certain plugin.&lt;br /&gt;
&lt;br /&gt;
Include files are loaded using the &amp;lt;tt&amp;gt;#include&amp;lt;/tt&amp;gt; compiler directive.&lt;br /&gt;
&lt;br /&gt;
=Commands=&lt;br /&gt;
Our first example will be writing a simple admin command to slap a player.  We'll continue to extend this example with more features until we have a final, complete result.&lt;br /&gt;
&lt;br /&gt;
==Declaration==&lt;br /&gt;
First, let's look at what an admin command requires.  Admin commands are registered using the [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=471&amp;amp; RegAdminCmd] function.  They require a '''name''', a '''callback function''', and '''default admin flags'''.  &lt;br /&gt;
&lt;br /&gt;
The callback function is what's invoked every time the command is used.  [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=771&amp;amp; Click here] to see its prototype.  Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
	RegAdminCmd(&amp;quot;sm_myslap&amp;quot;, Command_MySlap, ADMFLAG_SLAY);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public Action:Command_MySlap(client, args)&lt;br /&gt;
{&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we've successfully implemented a command -- though it doesn't do anything yet.  In fact, it will say &amp;quot;Unknown command&amp;quot; if you use it!  The reason is because of the &amp;lt;tt&amp;gt;Action&amp;lt;/tt&amp;gt; tag.  Any command that you type in the console, even if it's registered by SourceMod, will be sent to the engine to be processed. Because we have not had SourceMod block this functionality yet, the engine replies with &amp;quot;Unknown command&amp;quot; because it is not a valid engine command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;public Action:Command_MySlap(client, args)&lt;br /&gt;
{&lt;br /&gt;
	return Plugin_Handled;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the command will report no error, but it still won't do anything. This is because returning &amp;quot;Plugin_Handled&amp;quot; in a command callback will prevent the engine from processing the command. The engine will never even see that the command was run. This is what you will want to do if you are registering a completely new command through SourceMod.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
Let's decide what the command will look like.  Let's have it act like the default &amp;lt;tt&amp;gt;sm_slap&amp;lt;/tt&amp;gt; command:&lt;br /&gt;
&amp;lt;pre&amp;gt;sm_myslap &amp;lt;name|#userid&amp;gt; [damage]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To implement this, we'll need a few steps:&lt;br /&gt;
*Get the input from the console.  For this we use [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=473&amp;amp; GetCmdArg()].&lt;br /&gt;
*Find a matching player.  For this we use [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=144&amp;amp; FindTarget()].&lt;br /&gt;
*Slap them.  For this we use [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=42&amp;amp; SlapPlayer()], which requires including &amp;lt;tt&amp;gt;sdktools&amp;lt;/tt&amp;gt;, an extension bundled with SourceMod.&lt;br /&gt;
*Respond to the admin.  For this we use [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=462&amp;amp; ReplyToCommand()].&lt;br /&gt;
&lt;br /&gt;
Full example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
#include &amp;lt;sourcemod&amp;gt;&lt;br /&gt;
#include &amp;lt;sdktools&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public Plugin:myinfo =&lt;br /&gt;
{&lt;br /&gt;
	name = &amp;quot;My First Plugin&amp;quot;,&lt;br /&gt;
	author = &amp;quot;Me&amp;quot;,&lt;br /&gt;
	description = &amp;quot;My first plugin ever&amp;quot;,&lt;br /&gt;
	version = &amp;quot;1.0.0.0&amp;quot;,&lt;br /&gt;
	url = &amp;quot;http://www.sourcemod.net/&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
	RegAdminCmd(&amp;quot;sm_myslap&amp;quot;, Command_MySlap, ADMFLAG_SLAY);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public Action:Command_MySlap(client, args)&lt;br /&gt;
{&lt;br /&gt;
	new String:arg1[32], String:arg2[32];&lt;br /&gt;
	new damage;&lt;br /&gt;
&lt;br /&gt;
	/* Get the first argument */&lt;br /&gt;
	GetCmdArg(1, arg1, sizeof(arg1));&lt;br /&gt;
&lt;br /&gt;
	/* If there are 2 or more arguments, and the second argument fetch &lt;br /&gt;
	 * is successful, convert it to an integer.&lt;br /&gt;
	 */&lt;br /&gt;
	if (args &amp;gt;= 2 &amp;amp;&amp;amp; GetCmdArg(2, arg2, sizeof(arg2)))&lt;br /&gt;
	{&lt;br /&gt;
		damage = StringToInt(arg2);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/* Try and find a matching player */&lt;br /&gt;
	new target = FindTarget(client, arg1);&lt;br /&gt;
	if (target == -1)&lt;br /&gt;
	{&lt;br /&gt;
		/* FindTarget() automatically replies with the &lt;br /&gt;
		 * failure reason.&lt;br /&gt;
		 */&lt;br /&gt;
		return Plugin_Handled;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	SlapPlayer(target, damage);&lt;br /&gt;
&lt;br /&gt;
	new String:name[MAX_NAME_LENGTH];&lt;br /&gt;
	&lt;br /&gt;
	GetClientName(target, name, sizeof(name));&lt;br /&gt;
	ReplyToCommand(client, &amp;quot;[SM] You slapped %s for %d damage!&amp;quot;, name, damage);&lt;br /&gt;
&lt;br /&gt;
	return Plugin_Handled;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information on what %s and %d are, see [[Format Class Functions (SourceMod Scripting)|Format Class Functions]].  Note that you never need to unregister or remove your admin command.  When a plugin is unloaded, SourceMod cleans it up for you.&lt;br /&gt;
&lt;br /&gt;
=ConVars=&lt;br /&gt;
ConVars, also known as cvars, are global console variables in the Source engine.  They can have integer, float, or string values.  ConVar accessing is done through [[Handles (SourceMod Scripting)|Handles]].  Since ConVars are global, you do not need to close ConVar Handles (in fact, you cannot).&lt;br /&gt;
&lt;br /&gt;
The handy feature of ConVars is that they are easy for users to configure.  They can be placed in any .cfg file, such as &amp;lt;tt&amp;gt;server.cfg&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;sourcemod.cfg&amp;lt;/tt&amp;gt;.  To make this easier, SourceMod has an [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=607&amp;amp; AutoExecConfig()] function.  This function will automatically build a default .cfg file containing all of your cvars, annotated with comments, for users.  It is highly recommend that you call this if you have customizable ConVars.&lt;br /&gt;
&lt;br /&gt;
Let's extend your example from earlier with a new ConVar.  Our ConVar will be &amp;lt;tt&amp;gt;sm_myslap_damage&amp;lt;/tt&amp;gt; and will specify the default damage someone is slapped for if no damage is specified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;new Handle:sm_myslap_damage = INVALID_HANDLE&lt;br /&gt;
&lt;br /&gt;
public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
	RegAdminCmd(&amp;quot;sm_myslap&amp;quot;, Command_MySlap, ADMFLAG_SLAY);&lt;br /&gt;
&lt;br /&gt;
	sm_myslap_damage = CreateConVar(&amp;quot;sm_myslap_damage&amp;quot;, &amp;quot;5&amp;quot;, &amp;quot;Default slap damage&amp;quot;);&lt;br /&gt;
	AutoExecConfig(true, &amp;quot;plugin_myslap&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public Action:Command_MySlap(client, args)&lt;br /&gt;
{&lt;br /&gt;
	new String:arg1[32], String:arg2[32];&lt;br /&gt;
	new damage = GetConVarInt(sm_myslap_damage);&lt;br /&gt;
&lt;br /&gt;
	/* The rest remains unchanged! */&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Showing Activity, Logging=&lt;br /&gt;
Almost all admin commands should log their activity, and some admin commands should show their activity to in-game clients.  This can be done via the [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=599&amp;amp; LogAction()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=466&amp;amp; ShowActivity2()] functions.  The exact functionality of ShowActivity2() is determined by the &amp;lt;tt&amp;gt;sm_show_activity&amp;lt;/tt&amp;gt; cvar.&lt;br /&gt;
&lt;br /&gt;
For example, let's rewrite the last few lines of our slap command:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
	SlapPlayer(target, damage);&lt;br /&gt;
&lt;br /&gt;
	new String:name[MAX_NAME_LENGTH];&lt;br /&gt;
	&lt;br /&gt;
	GetClientName(target, name, sizeof(name));&lt;br /&gt;
&lt;br /&gt;
	ShowActivity2(client, &amp;quot;[SM] &amp;quot;, &amp;quot;Slapped %s for %d damage!&amp;quot;, name, damage);&lt;br /&gt;
	LogAction(client, target, &amp;quot;\&amp;quot;%L\&amp;quot; slapped \&amp;quot;%L\&amp;quot; (damage %d)&amp;quot;, client, target, damage);&lt;br /&gt;
&lt;br /&gt;
	return Plugin_Handled;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Multiple Targets=&lt;br /&gt;
To fully complete our slap demonstration, let's make it support multiple targets.  SourceMod's [[Admin_Commands_%28SourceMod%29#How_to_Target|targeting system]] is quite advanced, so using it may seem complicated at first.  &lt;br /&gt;
&lt;br /&gt;
The function we use is [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=703&amp;amp; ProcessTargetString()].  It takes in input from the console, and returns a list of matching clients.  It also returns a noun that will identify either a single client or describe a list of clients.  The idea is that each client is then processed, but the activity shown to all players is only processed once.  This reduces screen spam.&lt;br /&gt;
&lt;br /&gt;
This method of target processing is used for almost every admin command in SourceMod, and in fact FindTarget() is just a simplified version.&lt;br /&gt;
&lt;br /&gt;
Full, final example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
#include &amp;lt;sourcemod&amp;gt;&lt;br /&gt;
#include &amp;lt;sdktools&amp;gt;&lt;br /&gt;
&lt;br /&gt;
new Handle:sm_myslap_damage = INVALID_HANDLE&lt;br /&gt;
&lt;br /&gt;
public Plugin:myinfo =&lt;br /&gt;
{&lt;br /&gt;
	name = &amp;quot;My First Plugin&amp;quot;,&lt;br /&gt;
	author = &amp;quot;Me&amp;quot;,&lt;br /&gt;
	description = &amp;quot;My first plugin ever&amp;quot;,&lt;br /&gt;
	version = &amp;quot;1.0.0.0&amp;quot;,&lt;br /&gt;
	url = &amp;quot;http://www.sourcemod.net/&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
	LoadTranslations(&amp;quot;common.phrases&amp;quot;);&lt;br /&gt;
	RegAdminCmd(&amp;quot;sm_myslap&amp;quot;, Command_MySlap, ADMFLAG_SLAY);&lt;br /&gt;
&lt;br /&gt;
	sm_myslap_damage = CreateConVar(&amp;quot;sm_myslap_damage&amp;quot;, &amp;quot;5&amp;quot;, &amp;quot;Default slap damage&amp;quot;);&lt;br /&gt;
	AutoExecConfig(true, &amp;quot;plugin_myslap&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public Action:Command_MySlap(client, args)&lt;br /&gt;
{&lt;br /&gt;
	new String:arg1[32], String:arg2[32];&lt;br /&gt;
	new damage = GetConVarInt(sm_myslap_damage);&lt;br /&gt;
&lt;br /&gt;
	/* Get the first argument */&lt;br /&gt;
	GetCmdArg(1, arg1, sizeof(arg1));&lt;br /&gt;
&lt;br /&gt;
	/* If there are 2 or more arguments, and the second argument fetch &lt;br /&gt;
	 * is successful, convert it to an integer.&lt;br /&gt;
	 */&lt;br /&gt;
	if (args &amp;gt;= 2 &amp;amp;&amp;amp; GetCmdArg(2, arg2, sizeof(arg2)))&lt;br /&gt;
	{&lt;br /&gt;
		damage = StringToInt(arg2);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * target_name - stores the noun identifying the target(s)&lt;br /&gt;
	 * target_list - array to store clients&lt;br /&gt;
	 * target_count - variable to store number of clients&lt;br /&gt;
	 * tn_is_ml - stores whether the noun must be translated&lt;br /&gt;
	 */&lt;br /&gt;
	new String:target_name[MAX_TARGET_LENGTH];&lt;br /&gt;
	new target_list[MAXPLAYERS], target_count;&lt;br /&gt;
	new bool:tn_is_ml;&lt;br /&gt;
&lt;br /&gt;
	if ((target_count = ProcessTargetString(&lt;br /&gt;
			arg1,&lt;br /&gt;
			client,&lt;br /&gt;
			target_list,&lt;br /&gt;
			MAXPLAYERS,&lt;br /&gt;
			COMMAND_FILTER_ALIVE, /* Only allow alive players */&lt;br /&gt;
			target_name,&lt;br /&gt;
			sizeof(target_name),&lt;br /&gt;
			tn_is_ml)) &amp;lt;= 0)&lt;br /&gt;
	{&lt;br /&gt;
		/* This function replies to the admin with a failure message */&lt;br /&gt;
		ReplyToTargetError(client, target_count);&lt;br /&gt;
		return Plugin_Handled;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	for (new i = 0; i &amp;lt; target_count; i++)&lt;br /&gt;
	{&lt;br /&gt;
		SlapPlayer(target_list[i], damage);&lt;br /&gt;
		LogAction(client, target_list[i], &amp;quot;\&amp;quot;%L\&amp;quot; slapped \&amp;quot;%L\&amp;quot; (damage %d)&amp;quot;, client, target_list[i], damage);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	if (tn_is_ml)&lt;br /&gt;
	{&lt;br /&gt;
		ShowActivity2(client, &amp;quot;[SM] &amp;quot;, &amp;quot;Slapped %t for %d damage!&amp;quot;, target_name, damage);&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		ShowActivity2(client, &amp;quot;[SM] &amp;quot;, &amp;quot;Slapped %s for %d damage!&amp;quot;, target_name, damage);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return Plugin_Handled;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Client and Entity Indexes=&lt;br /&gt;
One major point of confusion with Half-Life 2 is the difference between the following things:&lt;br /&gt;
*Client index&lt;br /&gt;
*Entity index&lt;br /&gt;
*Userid&lt;br /&gt;
&lt;br /&gt;
The first answer is that clients are entities.  Thus, a client index and an entity index are the same thing.  When a SourceMod function asks for an entity index, a client index can be specified.  When a SourceMod function asks for a client index, usually it means only a client index can be specified.&lt;br /&gt;
&lt;br /&gt;
A fast way to check if an entity index is a client is checking whether it's between 1 and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=397&amp;amp; GetMaxClients()] (inclusive).  If a server has N client slots maximum, then entities 1 through N are always reserved for clients.  Note that 0 is a valid entity index; it is the world entity (worldspawn).&lt;br /&gt;
&lt;br /&gt;
A userid, on the other hand, is completely different.  The server maintains a global &amp;quot;connection count&amp;quot; number, and it starts at 1.  Each time a client connects, the connection count is incremented, and the client receives that new number as their userid.&lt;br /&gt;
&lt;br /&gt;
For example, the first client to connect has a userid of 2.  If he exits and rejoins, his userid will be 3 (unless another client joins in-between).  Although SourceMod fires the OnClientConnected and OnClientDisconnected callbacks every map change, the server tracks players across map changes and does not change their userids or client indexes.  To see if a client really connected or disconnected, hook the  [[Generic Source Server Events#player_connect|player_connect]] and [[Generic Source Server Events#player_disconnect|player_disconnect]] events instead.&lt;br /&gt;
&lt;br /&gt;
SourceMod provides two functions for userids: [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=442&amp;amp; GetClientOfUserId()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=402&amp;amp; GetClientUserId()].&lt;br /&gt;
&lt;br /&gt;
=Events=&lt;br /&gt;
Events are informational notification messages passed between objects in the server.  Many are also passed from the server to the client.  They are defined in .res files under the &amp;lt;tt&amp;gt;hl2/resource&amp;lt;/tt&amp;gt; folder and &amp;lt;tt&amp;gt;resource&amp;lt;/tt&amp;gt; folders of specific mods.  For a basic listing, see [[Game Events (Source)|Source Game Events]].&lt;br /&gt;
&lt;br /&gt;
It is important to note a few concepts about events:&lt;br /&gt;
*They are almost always informational.  That is, blocking &amp;lt;tt&amp;gt;player_death&amp;lt;/tt&amp;gt; will not stop a player from dying.  It may block a HUD or console message or something else minor.&lt;br /&gt;
*They almost always use userids instead of client indexes.&lt;br /&gt;
*Just because it is in a resource file does not mean it is ever called, or works the way you expect it to.  Mods are notorious at not properly documenting their event functionality.&lt;br /&gt;
&lt;br /&gt;
An example of finding when a player dies:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
   HookEvent(&amp;quot;player_death&amp;quot;, Event_PlayerDeath);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)&lt;br /&gt;
{&lt;br /&gt;
   new victim_id = GetEventInt(event, &amp;quot;userid&amp;quot;);&lt;br /&gt;
   new attacker_id = GetEventInt(event, &amp;quot;attacker&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
   new victim = GetClientOfUserId(victim_id);&lt;br /&gt;
   new attacker = GetClientOfUserId(attacker_id);&lt;br /&gt;
&lt;br /&gt;
   /* CODE */&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Callback Orders and Pairing=&lt;br /&gt;
SourceMod has a number of builtin callbacks about the state of the server and plugin.  Some of these are paired in special ways which is confusing to users.&lt;br /&gt;
&lt;br /&gt;
==Pairing==&lt;br /&gt;
'''Pairing''' is SourceMod terminology.  Examples of it are:&lt;br /&gt;
*OnMapEnd() cannot be called without an OnMapStart(), and if OnMapStart() is called, it cannot be called again without an OnMapEnd().&lt;br /&gt;
*OnClientConnected(N) for a given client N will only be called once, until an OnClientDisconnected(N) for the same client N is called (which is guaranteed to happen).&lt;br /&gt;
&lt;br /&gt;
There is a formal definition of SourceMod's pairing.  For two functions X and Y, both with input A, the following conditions hold:&lt;br /&gt;
*If X is invoked with input A, it cannot be invoked again with the same input unless Y is called with input A.&lt;br /&gt;
*If X is invoked with input A, it is guaranteed that Y will, at some point, be called with input A.&lt;br /&gt;
*Y cannot be invoked with any input A unless X was called first with input A.&lt;br /&gt;
*The relationship is described as, &amp;quot;X is paired with Y,&amp;quot; and &amp;quot;Y is paired to X.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==General Callbacks==&lt;br /&gt;
These callbacks are listed in the order they are called, in the lifetime of a plugin and the server.&lt;br /&gt;
&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=940&amp;amp; AskPluginLoad2()] - Called once, immediately after the plugin is loaded from the disk.  This function can be used to stop a plugin from loading and return a custom error message; return APLRes_Failure and use strcopy on to replace the error string.  All CreateNative and RegPluginLibrary calls should be done here.  &lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=575&amp;amp; OnPluginStart()] - Called once, after the plugin has been fully initialized and can proceed to load.  Any run-time errors in this function will cause the plugin to fail to load.  '''This is paired with OnPluginEnd()'''.&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=583&amp;amp; OnAllPluginsLoaded()] - Called once, after all non-late loaded plugins have called OnPluginStart.  &lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=580&amp;amp; OnMapStart()] - Called every time the map loads.  If the plugin is loaded late, and the map has already started, this function is called anyway after load, in order to preserve pairing.  '''This function is paired with OnMapEnd().'''&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=582&amp;amp; OnConfigsExecuted()] - Called once per map-change after  &amp;lt;tt&amp;gt;servercfgfile&amp;lt;/tt&amp;gt; (usually &amp;lt;tt&amp;gt;server.cfg&amp;lt;/tt&amp;gt;), &amp;lt;tt&amp;gt;sourcemod.cfg&amp;lt;/tt&amp;gt;, and all plugin config files have finished executing.  If a plugin is loaded after this has happened, the callback is called anyway, in order to preserve pairing.  '''This function is paired with OnMapEnd().'''&lt;br /&gt;
*At this point, most game callbacks can occur, such as events and callbacks involving clients (or other things, like OnGameFrame).&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=581&amp;amp; OnMapEnd()] - Called when the map is about to end.  At this point, all clients are disconnected, but &amp;lt;tt&amp;gt;TIMER_NO_MAPCHANGE&amp;lt;/tt&amp;gt; timers are not yet destroyed.  '''This function is paired to OnMapStart().'''&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=577&amp;amp; OnPluginEnd()] - Called once, immediately before the plugin is unloaded.  '''This function is paired to OnPluginStart().'''&lt;br /&gt;
&lt;br /&gt;
==Client Callbacks==&lt;br /&gt;
These callbacks are listed in no specific order, however, their documentation holds for both fake and real clients.&lt;br /&gt;
&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=388&amp;amp; OnClientConnect()] - Called when a player initiates a connection.  You can block a player from connecting by returning Plugin_Stop and setting rejectmsg to an error message.&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=916&amp;amp; OnClientConnected()] - Called after a player connects. Signifies that the player is in-game and IsClientConnected() will return true. '''This is paired with OnClientDisconnect() for successful connections only.'''&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=394&amp;amp; OnClientAuthorized()] - Called when a player gets a Steam ID.  It is important to note that this may never be called.  It may occur any time in between OnClientConnected and OnClientPreAdminCheck/OnClientDisconnect.  Do not rely on it unless you are writing something that needs Steam IDs, and even then you should use OnClientPostAdminCheck().&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=389&amp;amp; OnClientPutInServer()] - Signifies that the player is in-game and IsClientInGame() will return true.&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=396&amp;amp; OnClientPostAdminCheck()] - Called after the player is '''both authorized and in-game'''.  This is the best callback for checking administrative access after connect.&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=390&amp;amp; OnClientDisconnect()] - Called when a player's disconnection starts.  '''This is paired to OnClientConnected().'''&lt;br /&gt;
*[http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=391&amp;amp; OnClientDisconnect_Post()] - Called when a player's disconnection ends.  '''This is paired to OnClientConnected().'''&lt;br /&gt;
&lt;br /&gt;
=Frequently Asked Questions=&lt;br /&gt;
==Are plugins reloaded every mapchange?==&lt;br /&gt;
Plugins, by default, are not reloaded on mapchange unless their timestamp changes.  This is a feature so plugin authors have more flexibility with the state of their plugins.  &lt;br /&gt;
&lt;br /&gt;
==Do I need to call CloseHandle in OnPluginEnd?==&lt;br /&gt;
No.  SourceMod automatically closes your Handles when your plugin is unloaded, in order to prevent memory errors.&lt;br /&gt;
&lt;br /&gt;
==Do I need to #include every individual .inc?==&lt;br /&gt;
No.  &amp;lt;tt&amp;gt;#include &amp;lt;sourcemod&amp;gt;&amp;lt;/tt&amp;gt; will give you 95% of the .incs.  Similarly, &amp;lt;tt&amp;gt;#include &amp;lt;sdktools&amp;gt;&amp;lt;/tt&amp;gt; includes everything starting with &amp;lt;sdktools&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Why don't some events fire?==&lt;br /&gt;
There is no guarantee that events will fire.  The event listing is not a specification, it is a list of the events that a game is capable of firing.  Whether the game actually fires them is up to Valve or the developer.&lt;br /&gt;
&lt;br /&gt;
==Do I need to CloseHandle timers?==&lt;br /&gt;
No.  In fact, doing so may cause errors.  Timers naturally die on their own unless they are infinite timers, in which case you can use KillTimer() or die gracefully by returning &amp;lt;tt&amp;gt;Plugin_Stop&amp;lt;/tt&amp;gt; in the callback.&lt;br /&gt;
&lt;br /&gt;
==Are clients disconnected on mapchange?==&lt;br /&gt;
All clients are fully disconnected before the map changes.  They are all reconnected after the next map starts.&lt;br /&gt;
&lt;br /&gt;
If you only want to detect when a client initially connects or leaves your server, hook the [[Generic Source Server Events#player_connect|player_connect]] or [[Generic Source Server Events#player_disconnect|player_disconnect]] events respectively.&lt;br /&gt;
&lt;br /&gt;
=Further Reading=&lt;br /&gt;
For further reading, see the &amp;quot;Scripting&amp;quot; section at the [http://docs.sourcemod.net/ SourceMod Documentation].&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;br /&gt;
&lt;br /&gt;
{{LanguageSwitch}}&lt;/div&gt;</summary>
		<author><name>Castile</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=9581</id>
		<title>Building SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=9581"/>
		<updated>2014-05-27T04:49:32Z</updated>

		<summary type="html">&lt;p&gt;Castile: /* Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Compiling SourceMod is not difficult, but requires a number of prerequisites.  This article details the requirements and steps to being able to build working SourceMod binaries.&lt;br /&gt;
&lt;br /&gt;
Note that specific compiler versions are required to maintain ABI compatibility with Source engine binaries.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
==Windows==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Visual Studio or Visual C++ 2010 or higher. Express editions should work fine. If you use 2013 or higher, make sure to get the &amp;quot;Desktop&amp;quot; version: [http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Visual Studio Express 2013 for Desktop].&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install [http://git-scm.com/ Git]. Make sure that you select the option that adds Git to PATH.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Next, you will need to start an environment capable of running Python and interacting with the Visual Studio compiler. There are two ways to do this.&lt;br /&gt;
 &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Use [https://wiki.mozilla.org/MozillaBuild MozillaBuild]. MozillaBuild comes with Python, Mercurial, and a unix-like shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install MozillaBuild to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Navigate to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt; and run the batch file corresponding to your Visual Studio version. For example, &amp;lt;tt&amp;gt;start-msvc10.bat&amp;lt;/tt&amp;gt; for Visual Studio 2010 (10.0). Do not run an x64 version.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Git to MozillaBuild's &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. The easiest way to do this is to enter the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;export PATH=\$PATH:/c/Program\ Files\ \(x86\)/Git/bin&amp;quot; &amp;gt;&amp;gt; ~/.profile&lt;br /&gt;
source ~/.profile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Or, you can manually set up a shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install [http://python.org/ Python] 2.7. It will install to C:\Python27 by default. (Version 3.4 will work, but is not recommended for compatibility with other tools).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Python to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; variable. Go to Control Panel, System, Advanced, Environment Variables. Add &amp;lt;tt&amp;gt;C:\Python27;C:\Python27\Scripts&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; (or wherever your Python install is).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Under Start, Programs, Microsoft Visual Studio, select the &amp;quot;Visual Studio Tools&amp;quot; folder and run &amp;quot;Visual Studio Command Prompt&amp;quot;. Alternately, open a normal command prompt and run &amp;lt;tt&amp;gt;&amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars.bat&amp;quot;&amp;lt;/tt&amp;gt;. Substitute your Visual Studio version if needed.&amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Git, via either system packages or from the [http://git-scm.com/ Git] distribution.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install either the GNU C Compiler or the Clang compiler.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For GCC, 4.4 or higher is required. On Debian/Ubuntu-based systems, the commands below will install GCC (the second set of packages is required for building on 64-bit systems).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc g++&lt;br /&gt;
sudo apt-get install gcc-multilib g++-multilib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For Clang, 3.2 or higher is required. On Debian/Ubuntu-based systems, the packages needed are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install clang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;If building on a 64-bit system, a few additional packages may be required. For example on Debian/Ubuntu they are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install ia32-libs&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mac OS X==&lt;br /&gt;
Mac OS X 10.7 or higher is required to build, however, SourceMod will work on 10.5. SourceMod will neither build nor run on older PPC Macs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install the Xcode Command Line Tools.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For OS X 10.9 or higher, run the command below in Terminal and click the Install button in the window that appears.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For earlier versions of OS X, download and install Xcode from the App Store. Launch Xcode and then navigate to Preferences -&amp;gt; Downloads -&amp;gt; Components -&amp;gt; Command Line Tools -&amp;gt; Install. If you have recently upgraded Xcode, you will need to perform this step again. SourceMod cannot build without Xcode's command line tools.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Source and Dependencies=&lt;br /&gt;
&lt;br /&gt;
First, grab the SourceMod source tree. We recommend placing it inside its own folder, since we'll also need to download its dependencies.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p alliedmodders&lt;br /&gt;
cd alliedmodders&lt;br /&gt;
git clone https://github.com/alliedmodders/sourcemod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, run the &amp;lt;tt&amp;gt;checkout-deps.sh&amp;lt;/tt&amp;gt; script. This will download all dependencies and attempt to install AMBuild. If you are using Linux or OS X, it may prompt you for your sudo password at the very end. If you want to skip this and install AMBuild manually, just Ctrl+C. (Do not run the checkout script with sudo.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bash sourcemod/tools/checkout-deps.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After it's done, you should see a large number of hl2sdk folders and other assorted dependencies, like MySQL, Metamod:Source, and AMBuild.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, but not using MozillaBuild, then you won't be able to use the checkout-deps script. Instead, you'll have to manually clone the following repositories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/alliedmodders/hl2sdk hl2sdk-repo-proxy&lt;br /&gt;
# For each SDK you want to build with:&lt;br /&gt;
# git clone hl2sdk-repo-proxy hl2sdk-&amp;lt;SDK&amp;gt; -b &amp;lt;SDK&amp;gt;&lt;br /&gt;
# e.g. git clone hl2sdk-repo-proxy hl2sdk-csgo -b csgo&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/alliedmodders/metamod-source mmsource-1.10 -b 1.10-dev&lt;br /&gt;
wget http://cdn.mysql.com/archives/mysql-5.0/mysql-noinstall-5.0.24a-win32.zip mysql-noinstall-5.0.24a-win32&lt;br /&gt;
&lt;br /&gt;
# Install AMBuild&lt;br /&gt;
git clone https://github.com/alliedmodders/ambuild&lt;br /&gt;
cd ambuild&lt;br /&gt;
C:\Python27\python.exe setup.py install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can skip MySQL and SDK versions you don't plan to build.&lt;br /&gt;
&lt;br /&gt;
=Configuring=&lt;br /&gt;
&lt;br /&gt;
The first time you are building a SourceMod tree, you must ''configure'' the build. This step initializes some basic information and allows some customization around how things get compiled.&lt;br /&gt;
&lt;br /&gt;
First create a build folder within your sourcemod folder, and then run &amp;lt;tt&amp;gt;configure.py&amp;lt;/tt&amp;gt;. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd sourcemod&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
python ../configure.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.&lt;br /&gt;
&lt;br /&gt;
There are a few extra options you can pass to &amp;lt;tt&amp;gt;configure&amp;lt;/tt&amp;gt;:&lt;br /&gt;
*--enable-debug - Compile with symbols and debug checks/assertions.&lt;br /&gt;
*--enable-optimize - Compile with optimizations.&lt;br /&gt;
*--no-sse - Disable floating point optimizations (if you have a very, very old CPU).&lt;br /&gt;
*--no-mysql - Don't build the MySQL database module.&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
To build SourceMod, simply type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In your build folder. Alternately, you can specify the path of the build folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild debug-build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full package layout that would be shipped for release is in the &amp;lt;tt&amp;gt;package&amp;lt;/tt&amp;gt; folder of the build.&lt;br /&gt;
&lt;br /&gt;
=Deprecated Tools=&lt;br /&gt;
==Visual Studio Project Files==&lt;br /&gt;
In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.&lt;br /&gt;
&lt;br /&gt;
First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the &amp;lt;tt&amp;gt;checkout-windows-deps.bat&amp;lt;/tt&amp;gt; script. Next,&lt;br /&gt;
#Open the Control Panel (for example, via Start -&amp;gt; Settings).&lt;br /&gt;
#Open the System control.  If you don't see it, you may need to switch to &amp;quot;Classic view&amp;quot; (either via the left-hand pane or by going to Tools -&amp;gt; Folder Options).&lt;br /&gt;
#Click the Advanced tab.&lt;br /&gt;
#Click the Environment Variables button.&lt;br /&gt;
&lt;br /&gt;
Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in &amp;lt;tt&amp;gt;fixed-width font&amp;lt;/tt&amp;gt; and their value descriptions follow.&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE19&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE18&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep1/Original&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOB&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep2/OrangeBox for mods&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOBVALVE&amp;lt;/tt&amp;gt; - Path to HL2SDK Source 2009 (HL2:DM, DoD:S, TF2)&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-SWARM&amp;lt;/tt&amp;gt; - Path to HL2SDK Alien Swarm&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-BGT&amp;lt;/tt&amp;gt; - Path to HL2SDK for Bloody Good Time&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSGO&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:GO&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSS&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:S&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DARKM&amp;lt;/tt&amp;gt; - Path to HL2SDK Dark Messiah&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-EYE&amp;lt;/tt&amp;gt; - Path to HL2SDK E.Y.E.: Divine Cybermancy&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D1&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D2&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D2&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DOTA&amp;lt;/tt&amp;gt; - Path to HL2SDK DOTA 2&lt;br /&gt;
*&amp;lt;tt&amp;gt;MYSQL5&amp;lt;/tt&amp;gt; - Path to the folder that contains MySQL's &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; folders.&lt;br /&gt;
&lt;br /&gt;
==Makefiles==&lt;br /&gt;
Makefiles are deprecated and will be removed from the tree soon.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Documentation]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Castile</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=9580</id>
		<title>Building SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=9580"/>
		<updated>2014-05-27T04:48:33Z</updated>

		<summary type="html">&lt;p&gt;Castile: /* Configuring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Compiling SourceMod is not difficult, but requires a number of prerequisites.  This article details the requirements and steps to being able to build working SourceMod binaries.&lt;br /&gt;
&lt;br /&gt;
Note that specific compiler versions are required to maintain ABI compatibility with Source engine binaries.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
==Windows==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Visual Studio or Visual C++ 2010 or higher. Express editions should work fine. If you use 2013 or higher, make sure to get the &amp;quot;Desktop&amp;quot; version: [http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Visual Studio Express 2013 for Desktop].&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install [http://git-scm.com/ Git]. Make sure that you select the option that adds Git to PATH.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Next, you will need to start an environment capable of running Python and interacting with the Visual Studio compiler. There are two ways to do this.&lt;br /&gt;
 &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Use [https://wiki.mozilla.org/MozillaBuild MozillaBuild]. MozillaBuild comes with Python, Mercurial, and a unix-like shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install MozillaBuild.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Navigate to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt; and run the batch file corresponding to your Visual Studio version. For example, &amp;lt;tt&amp;gt;start-msvc10.bat&amp;lt;/tt&amp;gt; for Visual Studio 2010 (10.0). Do not run an x64 version.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Git to MozillaBuild's &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. The easiest way to do this is to enter the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;export PATH=\$PATH:/c/Program\ Files\ \(x86\)/Git/bin&amp;quot; &amp;gt;&amp;gt; ~/.profile&lt;br /&gt;
source ~/.profile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Or, you can manually set up a shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install [http://python.org/ Python] 2.7. It will install to C:\Python27 by default. (Version 3.4 will work, but is not recommended for compatibility with other tools).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Python to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; variable. Go to Control Panel, System, Advanced, Environment Variables. Add &amp;lt;tt&amp;gt;C:\Python27;C:\Python27\Scripts&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; (or wherever your Python install is).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Under Start, Programs, Microsoft Visual Studio, select the &amp;quot;Visual Studio Tools&amp;quot; folder and run &amp;quot;Visual Studio Command Prompt&amp;quot;. Alternately, open a normal command prompt and run &amp;lt;tt&amp;gt;&amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars.bat&amp;quot;&amp;lt;/tt&amp;gt;. Substitute your Visual Studio version if needed.&amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Git, via either system packages or from the [http://git-scm.com/ Git] distribution.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install either the GNU C Compiler or the Clang compiler.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For GCC, 4.4 or higher is required. On Debian/Ubuntu-based systems, the commands below will install GCC (the second set of packages is required for building on 64-bit systems).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc g++&lt;br /&gt;
sudo apt-get install gcc-multilib g++-multilib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For Clang, 3.2 or higher is required. On Debian/Ubuntu-based systems, the packages needed are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install clang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;If building on a 64-bit system, a few additional packages may be required. For example on Debian/Ubuntu they are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install ia32-libs&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mac OS X==&lt;br /&gt;
Mac OS X 10.7 or higher is required to build, however, SourceMod will work on 10.5. SourceMod will neither build nor run on older PPC Macs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install the Xcode Command Line Tools.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For OS X 10.9 or higher, run the command below in Terminal and click the Install button in the window that appears.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For earlier versions of OS X, download and install Xcode from the App Store. Launch Xcode and then navigate to Preferences -&amp;gt; Downloads -&amp;gt; Components -&amp;gt; Command Line Tools -&amp;gt; Install. If you have recently upgraded Xcode, you will need to perform this step again. SourceMod cannot build without Xcode's command line tools.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Source and Dependencies=&lt;br /&gt;
&lt;br /&gt;
First, grab the SourceMod source tree. We recommend placing it inside its own folder, since we'll also need to download its dependencies.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p alliedmodders&lt;br /&gt;
cd alliedmodders&lt;br /&gt;
git clone https://github.com/alliedmodders/sourcemod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, run the &amp;lt;tt&amp;gt;checkout-deps.sh&amp;lt;/tt&amp;gt; script. This will download all dependencies and attempt to install AMBuild. If you are using Linux or OS X, it may prompt you for your sudo password at the very end. If you want to skip this and install AMBuild manually, just Ctrl+C. (Do not run the checkout script with sudo.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bash sourcemod/tools/checkout-deps.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After it's done, you should see a large number of hl2sdk folders and other assorted dependencies, like MySQL, Metamod:Source, and AMBuild.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, but not using MozillaBuild, then you won't be able to use the checkout-deps script. Instead, you'll have to manually clone the following repositories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/alliedmodders/hl2sdk hl2sdk-repo-proxy&lt;br /&gt;
# For each SDK you want to build with:&lt;br /&gt;
# git clone hl2sdk-repo-proxy hl2sdk-&amp;lt;SDK&amp;gt; -b &amp;lt;SDK&amp;gt;&lt;br /&gt;
# e.g. git clone hl2sdk-repo-proxy hl2sdk-csgo -b csgo&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/alliedmodders/metamod-source mmsource-1.10 -b 1.10-dev&lt;br /&gt;
wget http://cdn.mysql.com/archives/mysql-5.0/mysql-noinstall-5.0.24a-win32.zip mysql-noinstall-5.0.24a-win32&lt;br /&gt;
&lt;br /&gt;
# Install AMBuild&lt;br /&gt;
git clone https://github.com/alliedmodders/ambuild&lt;br /&gt;
cd ambuild&lt;br /&gt;
C:\Python27\python.exe setup.py install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can skip MySQL and SDK versions you don't plan to build.&lt;br /&gt;
&lt;br /&gt;
=Configuring=&lt;br /&gt;
&lt;br /&gt;
The first time you are building a SourceMod tree, you must ''configure'' the build. This step initializes some basic information and allows some customization around how things get compiled.&lt;br /&gt;
&lt;br /&gt;
First create a build folder within your sourcemod folder, and then run &amp;lt;tt&amp;gt;configure.py&amp;lt;/tt&amp;gt;. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd sourcemod&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
python ../configure.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.&lt;br /&gt;
&lt;br /&gt;
There are a few extra options you can pass to &amp;lt;tt&amp;gt;configure&amp;lt;/tt&amp;gt;:&lt;br /&gt;
*--enable-debug - Compile with symbols and debug checks/assertions.&lt;br /&gt;
*--enable-optimize - Compile with optimizations.&lt;br /&gt;
*--no-sse - Disable floating point optimizations (if you have a very, very old CPU).&lt;br /&gt;
*--no-mysql - Don't build the MySQL database module.&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
To build SourceMod, simply type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In your build folder. Alternately, you can specify the path of the build folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild debug-build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full package layout that would be shipped for release is in the &amp;lt;tt&amp;gt;package&amp;lt;/tt&amp;gt; folder of the build.&lt;br /&gt;
&lt;br /&gt;
=Deprecated Tools=&lt;br /&gt;
==Visual Studio Project Files==&lt;br /&gt;
In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.&lt;br /&gt;
&lt;br /&gt;
First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the &amp;lt;tt&amp;gt;checkout-windows-deps.bat&amp;lt;/tt&amp;gt; script. Next,&lt;br /&gt;
#Open the Control Panel (for example, via Start -&amp;gt; Settings).&lt;br /&gt;
#Open the System control.  If you don't see it, you may need to switch to &amp;quot;Classic view&amp;quot; (either via the left-hand pane or by going to Tools -&amp;gt; Folder Options).&lt;br /&gt;
#Click the Advanced tab.&lt;br /&gt;
#Click the Environment Variables button.&lt;br /&gt;
&lt;br /&gt;
Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in &amp;lt;tt&amp;gt;fixed-width font&amp;lt;/tt&amp;gt; and their value descriptions follow.&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE19&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE18&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep1/Original&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOB&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep2/OrangeBox for mods&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOBVALVE&amp;lt;/tt&amp;gt; - Path to HL2SDK Source 2009 (HL2:DM, DoD:S, TF2)&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-SWARM&amp;lt;/tt&amp;gt; - Path to HL2SDK Alien Swarm&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-BGT&amp;lt;/tt&amp;gt; - Path to HL2SDK for Bloody Good Time&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSGO&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:GO&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSS&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:S&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DARKM&amp;lt;/tt&amp;gt; - Path to HL2SDK Dark Messiah&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-EYE&amp;lt;/tt&amp;gt; - Path to HL2SDK E.Y.E.: Divine Cybermancy&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D1&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D2&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D2&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DOTA&amp;lt;/tt&amp;gt; - Path to HL2SDK DOTA 2&lt;br /&gt;
*&amp;lt;tt&amp;gt;MYSQL5&amp;lt;/tt&amp;gt; - Path to the folder that contains MySQL's &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; folders.&lt;br /&gt;
&lt;br /&gt;
==Makefiles==&lt;br /&gt;
Makefiles are deprecated and will be removed from the tree soon.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Documentation]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Castile</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=9579</id>
		<title>Building SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Building_SourceMod&amp;diff=9579"/>
		<updated>2014-05-27T04:44:54Z</updated>

		<summary type="html">&lt;p&gt;Castile: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Compiling SourceMod is not difficult, but requires a number of prerequisites.  This article details the requirements and steps to being able to build working SourceMod binaries.&lt;br /&gt;
&lt;br /&gt;
Note that specific compiler versions are required to maintain ABI compatibility with Source engine binaries.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
==Windows==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Visual Studio or Visual C++ 2010 or higher. Express editions should work fine. If you use 2013 or higher, make sure to get the &amp;quot;Desktop&amp;quot; version: [http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop Visual Studio Express 2013 for Desktop].&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install [http://git-scm.com/ Git]. Make sure that you select the option that adds Git to PATH.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Next, you will need to start an environment capable of running Python and interacting with the Visual Studio compiler. There are two ways to do this.&lt;br /&gt;
 &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Use [https://wiki.mozilla.org/MozillaBuild MozillaBuild]. MozillaBuild comes with Python, Mercurial, and a unix-like shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install MozillaBuild.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Navigate to &amp;lt;tt&amp;gt;C:\mozilla-build&amp;lt;/tt&amp;gt; and run the batch file corresponding to your Visual Studio version. For example, &amp;lt;tt&amp;gt;start-msvc10.bat&amp;lt;/tt&amp;gt; for Visual Studio 2010 (10.0). Do not run an x64 version.&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Git to MozillaBuild's &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. The easiest way to do this is to enter the following commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;export PATH=\$PATH:/c/Program\ Files\ \(x86\)/Git/bin&amp;quot; &amp;gt;&amp;gt; ~/.profile&lt;br /&gt;
source ~/.profile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Or, you can manually set up a shell.&lt;br /&gt;
   &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Install [http://python.org/ Python] 2.7. It will install to C:\Python27 by default. (Version 3.4 will work, but is not recommended for compatibility with other tools).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Add Python to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; variable. Go to Control Panel, System, Advanced, Environment Variables. Add &amp;lt;tt&amp;gt;C:\Python27;C:\Python27\Scripts&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; (or wherever your Python install is).&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Under Start, Programs, Microsoft Visual Studio, select the &amp;quot;Visual Studio Tools&amp;quot; folder and run &amp;quot;Visual Studio Command Prompt&amp;quot;. Alternately, open a normal command prompt and run &amp;lt;tt&amp;gt;&amp;quot;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars.bat&amp;quot;&amp;lt;/tt&amp;gt;. Substitute your Visual Studio version if needed.&amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install Git, via either system packages or from the [http://git-scm.com/ Git] distribution.&amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install either the GNU C Compiler or the Clang compiler.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For GCC, 4.4 or higher is required. On Debian/Ubuntu-based systems, the commands below will install GCC (the second set of packages is required for building on 64-bit systems).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install gcc g++&lt;br /&gt;
sudo apt-get install gcc-multilib g++-multilib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
   &amp;lt;li&amp;gt;For Clang, 3.2 or higher is required. On Debian/Ubuntu-based systems, the packages needed are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install clang&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
   &amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;If building on a 64-bit system, a few additional packages may be required. For example on Debian/Ubuntu they are:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install ia32-libs&lt;br /&gt;
sudo apt-get install lib32z1 lib32z1-dev&lt;br /&gt;
sudo apt-get install libc6-dev-i386 libc6-i386&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mac OS X==&lt;br /&gt;
Mac OS X 10.7 or higher is required to build, however, SourceMod will work on 10.5. SourceMod will neither build nor run on older PPC Macs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
 &amp;lt;li&amp;gt;Install the Xcode Command Line Tools.&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For OS X 10.9 or higher, run the command below in Terminal and click the Install button in the window that appears.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;For earlier versions of OS X, download and install Xcode from the App Store. Launch Xcode and then navigate to Preferences -&amp;gt; Downloads -&amp;gt; Components -&amp;gt; Command Line Tools -&amp;gt; Install. If you have recently upgraded Xcode, you will need to perform this step again. SourceMod cannot build without Xcode's command line tools.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Source and Dependencies=&lt;br /&gt;
&lt;br /&gt;
First, grab the SourceMod source tree. We recommend placing it inside its own folder, since we'll also need to download its dependencies.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p alliedmodders&lt;br /&gt;
cd alliedmodders&lt;br /&gt;
git clone https://github.com/alliedmodders/sourcemod&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, run the &amp;lt;tt&amp;gt;checkout-deps.sh&amp;lt;/tt&amp;gt; script. This will download all dependencies and attempt to install AMBuild. If you are using Linux or OS X, it may prompt you for your sudo password at the very end. If you want to skip this and install AMBuild manually, just Ctrl+C. (Do not run the checkout script with sudo.)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bash sourcemod/tools/checkout-deps.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After it's done, you should see a large number of hl2sdk folders and other assorted dependencies, like MySQL, Metamod:Source, and AMBuild.&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, but not using MozillaBuild, then you won't be able to use the checkout-deps script. Instead, you'll have to manually clone the following repositories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git clone https://github.com/alliedmodders/hl2sdk hl2sdk-repo-proxy&lt;br /&gt;
# For each SDK you want to build with:&lt;br /&gt;
# git clone hl2sdk-repo-proxy hl2sdk-&amp;lt;SDK&amp;gt; -b &amp;lt;SDK&amp;gt;&lt;br /&gt;
# e.g. git clone hl2sdk-repo-proxy hl2sdk-csgo -b csgo&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/alliedmodders/metamod-source mmsource-1.10 -b 1.10-dev&lt;br /&gt;
wget http://cdn.mysql.com/archives/mysql-5.0/mysql-noinstall-5.0.24a-win32.zip mysql-noinstall-5.0.24a-win32&lt;br /&gt;
&lt;br /&gt;
# Install AMBuild&lt;br /&gt;
git clone https://github.com/alliedmodders/ambuild&lt;br /&gt;
cd ambuild&lt;br /&gt;
C:\Python27\python.exe setup.py install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that you can skip MySQL and SDK versions you don't plan to build.&lt;br /&gt;
&lt;br /&gt;
=Configuring=&lt;br /&gt;
&lt;br /&gt;
The first time you are building a SourceMod tree, you must ''configure'' the build. This step initializes some basic information and allows some customization around how things get compiled.&lt;br /&gt;
&lt;br /&gt;
First create a build folder, and then run &amp;lt;tt&amp;gt;configure.py&amp;lt;/tt&amp;gt;. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
python ../configure.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.&lt;br /&gt;
&lt;br /&gt;
There are a few extra options you can pass to &amp;lt;tt&amp;gt;configure&amp;lt;/tt&amp;gt;:&lt;br /&gt;
*--enable-debug - Compile with symbols and debug checks/assertions.&lt;br /&gt;
*--enable-optimize - Compile with optimizations.&lt;br /&gt;
*--no-sse - Disable floating point optimizations (if you have a very, very old CPU).&lt;br /&gt;
*--no-mysql - Don't build the MySQL database module.&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
To build SourceMod, simply type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In your build folder. Alternately, you can specify the path of the build folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ambuild debug-build&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full package layout that would be shipped for release is in the &amp;lt;tt&amp;gt;package&amp;lt;/tt&amp;gt; folder of the build.&lt;br /&gt;
&lt;br /&gt;
=Deprecated Tools=&lt;br /&gt;
==Visual Studio Project Files==&lt;br /&gt;
In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.&lt;br /&gt;
&lt;br /&gt;
First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the &amp;lt;tt&amp;gt;checkout-windows-deps.bat&amp;lt;/tt&amp;gt; script. Next,&lt;br /&gt;
#Open the Control Panel (for example, via Start -&amp;gt; Settings).&lt;br /&gt;
#Open the System control.  If you don't see it, you may need to switch to &amp;quot;Classic view&amp;quot; (either via the left-hand pane or by going to Tools -&amp;gt; Folder Options).&lt;br /&gt;
#Click the Advanced tab.&lt;br /&gt;
#Click the Environment Variables button.&lt;br /&gt;
&lt;br /&gt;
Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in &amp;lt;tt&amp;gt;fixed-width font&amp;lt;/tt&amp;gt; and their value descriptions follow.&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE19&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;MMSOURCE18&amp;lt;/tt&amp;gt; - Path to Metamod:Source 1.10+&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep1/Original&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOB&amp;lt;/tt&amp;gt; - Path to HL2SDK Ep2/OrangeBox for mods&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKOBVALVE&amp;lt;/tt&amp;gt; - Path to HL2SDK Source 2009 (HL2:DM, DoD:S, TF2)&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-SWARM&amp;lt;/tt&amp;gt; - Path to HL2SDK Alien Swarm&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-BGT&amp;lt;/tt&amp;gt; - Path to HL2SDK for Bloody Good Time&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSGO&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:GO&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKCSS&amp;lt;/tt&amp;gt; - Path to HL2SDK CS:S&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DARKM&amp;lt;/tt&amp;gt; - Path to HL2SDK Dark Messiah&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-EYE&amp;lt;/tt&amp;gt; - Path to HL2SDK E.Y.E.: Divine Cybermancy&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D1&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDKL4D2&amp;lt;/tt&amp;gt; - Path to HL2SDK L4D2&lt;br /&gt;
*&amp;lt;tt&amp;gt;HL2SDK-DOTA&amp;lt;/tt&amp;gt; - Path to HL2SDK DOTA 2&lt;br /&gt;
*&amp;lt;tt&amp;gt;MYSQL5&amp;lt;/tt&amp;gt; - Path to the folder that contains MySQL's &amp;lt;tt&amp;gt;include&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;lib&amp;lt;/tt&amp;gt; folders.&lt;br /&gt;
&lt;br /&gt;
==Makefiles==&lt;br /&gt;
Makefiles are deprecated and will be removed from the tree soon.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Documentation]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Castile</name></author>
		
	</entry>
</feed>