<?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=Bl4nk</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=Bl4nk"/>
	<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/Special:Contributions/Bl4nk"/>
	<updated>2026-04-18T06:50:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.6</generator>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourcePawn_(legacy_syntax)&amp;diff=7412</id>
		<title>Introduction to SourcePawn (legacy syntax)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Introduction_to_SourcePawn_(legacy_syntax)&amp;diff=7412"/>
		<updated>2009-09-08T01:16:44Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide is designed to give you a very basic overview to fundamentals of scripting in SourcePawn.  [[Pawn]] is a &amp;quot;scripting&amp;quot; language used to embed functionality in other programs.  That means it is not a standalone language, like C++ or Java, and its details will differ based on the application.  SourcePawn is the version of Pawn used in [[SourceMod]].&lt;br /&gt;
&lt;br /&gt;
This guide does not tell you how to write SourceMod plugins; it is intended as an overview of the syntax and semantics of the language instead.  Read the separate article, [[Introduction to SourceMod Plugins]] for SourceMod API specifics.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Non-Programmer Intro=&lt;br /&gt;
This section is intended for non-programmers.  If you're still confused, you may want to pick up a book on another language, such as PHP, Python, or Java, to get a better idea of what programming is like.&lt;br /&gt;
&lt;br /&gt;
==Symbols/Keywords==&lt;br /&gt;
A symbol is a series of letters, numbers, and/or underscores, that uniquely represents something.  Symbols are case-sensitive (unlike PHP, where sometimes they are not).  Symbols do not start with any special character, though they must start with a letter.  &lt;br /&gt;
&lt;br /&gt;
There are a few reserved symbols that have special meaning.  For example, &amp;lt;tt&amp;gt;if&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;return&amp;lt;/tt&amp;gt; are special constructs in the language that will explained later.  They cannot be used as symbol names.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
There a few important constructs you should know before you begin to script.  The first is a '''variable'''.  A variable is a symbol, or name, that holds data. For example, the variable &amp;quot;a&amp;quot; could hold the number &amp;quot;2&amp;quot;, &amp;quot;16&amp;quot;, &amp;quot;0&amp;quot;, et cetera.  Variables are created for storage space throughout a program.  Variables must be declared before being used, using the &amp;quot;new&amp;quot; keyword.  Data is assigned to variables using the equal sign (=).  Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;new a, b, c, d;&lt;br /&gt;
&lt;br /&gt;
a = 5;&lt;br /&gt;
b = 16;&lt;br /&gt;
c = 0;&lt;br /&gt;
d = 500;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In SourcePawn, variables have two types, which will be explained in more detail further on.&lt;br /&gt;
*Cells (arbitrary numerical data), as shown above.&lt;br /&gt;
*Strings (a series of text characters)&lt;br /&gt;
&lt;br /&gt;
==Functions==&lt;br /&gt;
The next important concept is '''functions'''. Functions are symbols or names that perform an action.  That means when you activate them, they carry out a specific sequence of code.  There are a few types of functions, but every function is activated the same way.  &amp;quot;Calling a function&amp;quot; is the term for invoking a function's action.  Function calls are constructed like this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;function(&amp;lt;parameters&amp;gt;)&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;show(56);   //Activates &amp;quot;show&amp;quot; function, and gives the number 56 to it&lt;br /&gt;
show();     //Activates &amp;quot;show&amp;quot; function with no data, blank&lt;br /&gt;
show(a);    //Activates &amp;quot;show&amp;quot; function, gives a variable's contents as data&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every piece of data passed to a function is called a '''parameter'''.  A function can have any number of parameters (there is a &amp;quot;reasonable&amp;quot; limit of 32 in SourceMod).  Parameters will be explained further in the article.&lt;br /&gt;
&lt;br /&gt;
==Comments==&lt;br /&gt;
Note any text that appears after a &amp;quot;//&amp;quot; is considered a &amp;quot;comment&amp;quot; and is not actual code.  There are two comment styles:&lt;br /&gt;
*&amp;lt;tt&amp;gt;//&amp;lt;/tt&amp;gt; - Double slash, everything following on that line is ignored.&lt;br /&gt;
*&amp;lt;tt&amp;gt;/* */&amp;lt;/tt&amp;gt; - Multi-line comment, everything in between the asterisks is ignored.  You cannot nest these.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Block Coding==&lt;br /&gt;
The next concept is block coding. You can group code into &amp;quot;blocks&amp;quot; separated by { and }. This effectively makes one large block of code act as one statement. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;{&lt;br /&gt;
   here;&lt;br /&gt;
   is;&lt;br /&gt;
   some;&lt;br /&gt;
   code;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Block coding using braces is used everywhere in programming.  Blocks of code can be nested within each other.  It is a good idea to adapt a consistent and readable indentation style early on to prevent spaghetti-looking code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Language Paradigms=&lt;br /&gt;
Pawn may seem similar to other languages, like C, but it has fundamental differences.  It is not important that you immediately understand these differences, but they may be helpful if you're familiar with another language already.&lt;br /&gt;
*'''Pawn is not typed.'''  Pawn only has one data type, the '''cell'''.  This will be explained in detail later.  [Below it says that there are two types: cell and string.]&lt;br /&gt;
*'''Pawn is not garbage collected.''' Pawn, as a language, has no built-in memory allocation, and thus has no garbage.  If a function allocates memory, you may be responsible for freeing it.&lt;br /&gt;
*'''Pawn is not object oriented.''' Pawn is procedural, and relies on subroutines.  It also does not have C structs.&lt;br /&gt;
*'''Pawn is not functional.''' Pawn is procedural, and does not support lambda functions or late binding or anything else you might find in a very high-level language, like Python or Ruby.&lt;br /&gt;
*'''Pawn is single-threaded.''' As of this writing, Pawn is not thread safe.  &lt;br /&gt;
*'''Pawn is not interpreted.''' Well, it &amp;quot;sort of&amp;quot; is.  It gets interpreted at a very low level.  You must run your code through a compiler, which produces a binary.  This binary will work on any platform that the host application uses.  This speeds up loading time and lets you check errors easier.&lt;br /&gt;
&lt;br /&gt;
These language design decisions were made by ITB CompuPhase.  It is designed for low-level embedded devices and is thus very small and very fast.&lt;br /&gt;
&lt;br /&gt;
=Variables=&lt;br /&gt;
In Pawn there are two variable types: the '''cell''' and the '''String'''.  A cell can store 32 bits of numerical data.  A String is a sequential/flat list of UTF-8 text characters.&lt;br /&gt;
&lt;br /&gt;
A '''cell''' has no inherent type, however, cells can be '''tagged'''.  A tag lets you enforce where certain cells can be used.  The default tags are:&lt;br /&gt;
*(nothing), or '''_''' - No tag.  Usually used for whole numbers ([http://en.wikipedia.org/wiki/Integer Integers]).&lt;br /&gt;
*'''Float''' - Used for floating point (fractional) numbers.&lt;br /&gt;
*'''bool''' - Used for storing either '''true''' or '''false'''.&lt;br /&gt;
&lt;br /&gt;
Strings are different and will be explained in the next sections.&lt;br /&gt;
&lt;br /&gt;
==Declaration==&lt;br /&gt;
Examples of different valid variable declarations:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new a = 5;&lt;br /&gt;
new Float:b = 5.0;&lt;br /&gt;
new bool:c = true;&lt;br /&gt;
new bool:d = 0;      //Works because 0 is false&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Invalid variable usage:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new a = 5.0;         //Tag mismatch.  5.0 is tagged as Float&lt;br /&gt;
new Float:b = 5;     //Tag mismatch.  5 is not tagged.&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a variable is not assigned upon declaration, it will be set to 0.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new a;        //Set to 0&lt;br /&gt;
new Float:b;  //Set to 0.0&lt;br /&gt;
new bool:c;   //Set to false&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Assignment==&lt;br /&gt;
Variables can be re-assigned data after they are created.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new a, Float:b, bool:c;&lt;br /&gt;
&lt;br /&gt;
a = 5;&lt;br /&gt;
b = 5.0;&lt;br /&gt;
c = true;&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Arrays=&lt;br /&gt;
An array is a sequence of data in a sequential list.  Arrays are useful for storing multiple pieces of data in one variable, and often greatly simplify many tasks.  &lt;br /&gt;
&lt;br /&gt;
==Declaration==&lt;br /&gt;
An array is declared using brackets.  Some examples of arrays:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new players[32];     //Stores 32 cells (numbers)&lt;br /&gt;
new Float:origin[3]; //Stores 3 floating point numbers&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, arrays are initialized to 0.  You can assign them different default values, however:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new numbers[5] = {1, 2, 3, 4, 5};       //Stores 1, 2, 3, 4, 5 in the cells.&lt;br /&gt;
new Float:origin[3] = {1.0, 2.0, 3.0};  //Stores 1.0, 2.0, 3.0 in the cells.&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can leave out the array size if you're going to pre-assign data to it.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new numbers[] = {1, 3, 5, 7, 9};&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The compiler will automatically deduce that you intended an array of size 5.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Using an array is just like using a normal variable.  The only difference is the array must be '''indexed'''.  Indexing an array means choosing the element which you wish to use.&lt;br /&gt;
&lt;br /&gt;
For example, here is an example of the above code using indexes:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new numbers[5], Float:origin[3];&lt;br /&gt;
&lt;br /&gt;
numbers[0] = 1;&lt;br /&gt;
numbers[1] = 2;&lt;br /&gt;
numbers[2] = 3;&lt;br /&gt;
numbers[3] = 4;&lt;br /&gt;
numbers[4] = 5;&lt;br /&gt;
origin[0] = 1.0;&lt;br /&gt;
origin[1] = 2.0;&lt;br /&gt;
origin[2] = 3.0;&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the '''index''' is what's in between the brackets.  The index always starts from 0.  That is, if an array has N elements, its valid indexes are from 0 to N-1.  Accessing the data at these indexes works like a normal variable.&lt;br /&gt;
&lt;br /&gt;
To use an incorrect index will cause an error.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new numbers[5];&lt;br /&gt;
&lt;br /&gt;
numbers[5] = 20;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This may look correct, but 5 is not a valid index.  The highest valid index is 4.&lt;br /&gt;
&lt;br /&gt;
You can use any expression as an index.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new a, numbers[5];&lt;br /&gt;
&lt;br /&gt;
a = 1;                   //Set a = 1&lt;br /&gt;
numbers[a] = 4;          //Set numbers[1] = 4&lt;br /&gt;
numbers[numbers[a]] = 2; //Set numbers[4] = 2&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expressions will be discussed in depth later in the article.&lt;br /&gt;
&lt;br /&gt;
=Strings=&lt;br /&gt;
Strings are a convenient method of storing text.  The characters are stored in an array.  The string is terminated by a '''null terminator''', or a 0.  Without a null terminator, Pawn would not know where to stop reading the string.  All strings are UTF-8 in SourcePawn.&lt;br /&gt;
&lt;br /&gt;
Notice that Strings are a combination of arrays and cells.  Unlike other languages, this means you must know how much space a string will use in advance.  That is, strings are not dynamic.  They can only grow to the space you allocate for them.&lt;br /&gt;
&lt;br /&gt;
''Note for experts:  They're not actually cells.  SourcePawn uses 8-bit storage for String arrays as an optimization.  This is what makes String a type and not a tag.''&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Strings are declared almost equivalently to arrays.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new String:message[] = &amp;quot;Hello!&amp;quot;;&lt;br /&gt;
new String:clams[6] = &amp;quot;Clams&amp;quot;;&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are equivalent to doing:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new String:message[7], String:clams[6];&lt;br /&gt;
&lt;br /&gt;
message[0] = 'H';&lt;br /&gt;
message[1] = 'e';&lt;br /&gt;
message[2] = 'l';&lt;br /&gt;
message[3] = 'l';&lt;br /&gt;
message[4] = 'o';&lt;br /&gt;
message[5] = '!';&lt;br /&gt;
message[6] = 0;&lt;br /&gt;
clams[0] = 'C';&lt;br /&gt;
clams[1] = 'l';&lt;br /&gt;
clams[2] = 'a';&lt;br /&gt;
clams[3] = 'm';&lt;br /&gt;
clams[4] = 's';&lt;br /&gt;
clams[5] = 0;&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although strings are rarely initialized in this manner, it is very important to remember the concept of the null terminator, which signals the end of a string.  The compiler, and most SourceMod functions will automatically null-terminate for you, so it is mainly important when manipulating strings directly.&lt;br /&gt;
&lt;br /&gt;
Note that a string is enclosed in double-quotes, but a character is enclosed in single quotes.&lt;br /&gt;
&lt;br /&gt;
==Characters==&lt;br /&gt;
A character of text can be used in either a String or a cell.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new String:text[] = &amp;quot;Crab&amp;quot;;&lt;br /&gt;
new clam;&lt;br /&gt;
&lt;br /&gt;
clam = 'D';         //Set clam to 'D'&lt;br /&gt;
text[0] = 'A';      //Change the 'C' to 'A', it is now 'Arab'&lt;br /&gt;
clam = text[0];     //Set clam to 'A'&lt;br /&gt;
text[1] = clam;     //Change the 'r' to 'A', is is now 'AAab'&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you can't do is mix character arrays with strings.  The internal storage is different.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new clams[] = &amp;quot;Clams&amp;quot;;                       //Invalid, needs String: type&lt;br /&gt;
new clams[] = {'C', 'l', 'a', 'm', 's', 0};  //Valid, but NOT A STRING.&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Functions=&lt;br /&gt;
Functions, as stated before, are isolated blocks of code that perform an action.  They can be invoked, or '''called''', with '''parameters''' that give specific options.&lt;br /&gt;
&lt;br /&gt;
There are two types of ways functions are called:&lt;br /&gt;
*'''direct call''' - You specifically call a function in your code.&lt;br /&gt;
*'''callback''' - The application calls a function in your code, as if it were an event trigger.&lt;br /&gt;
&lt;br /&gt;
There are five types of functions:&lt;br /&gt;
*'''native''': A direct, internal function provided by the application.&lt;br /&gt;
*'''public''': A callback function that is visible to the application and other scripts.&lt;br /&gt;
*'''normal''': A normal function that only you can call.&lt;br /&gt;
*'''stock''': A normal function provided by an include file.  If unused, it won't be compiled.&lt;br /&gt;
*'''forward''': This function is a global event provided by the application.  If you implement it, it will be a callback.&lt;br /&gt;
&lt;br /&gt;
All code in Pawn must exist in functions.  This is in contrast to languages like PHP, Perl, and Python which let you write global code.  That is because Pawn is a callback-based language: it responds to actions from a parent application, and functions must be written to handle those actions.  Although our examples often contain free-floating code, this is purely for demonstration purposes.  Free-floating code in our examples implies the code is part of some function.&lt;br /&gt;
&lt;br /&gt;
==Declaration==&lt;br /&gt;
Unlike variables, functions do not need to be declared before you use them.  Functions have two pieces, the '''prototype''' and the '''body'''.  The prototype contains the name of your function and the parameters it will accept.  The body is the contents of its code.&lt;br /&gt;
&lt;br /&gt;
Example of a function:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
AddTwoNumbers(first, second)&lt;br /&gt;
{&lt;br /&gt;
  new sum = first + second;&lt;br /&gt;
&lt;br /&gt;
  return sum;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple function.  The prototype is this line:&lt;br /&gt;
&amp;lt;pawn&amp;gt;AddTwoNumbers(first, second)&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Broken down, it means:&lt;br /&gt;
*&amp;lt;tt&amp;gt;AddTwoNumbers&amp;lt;/tt&amp;gt; - Name of the function.&lt;br /&gt;
*&amp;lt;tt&amp;gt;first&amp;lt;/tt&amp;gt; - Name of the first parameter, which is a simple cell.&lt;br /&gt;
*&amp;lt;tt&amp;gt;second&amp;lt;/tt&amp;gt; - Name of the second parameter, which is a simple cell.&lt;br /&gt;
&lt;br /&gt;
The body is a simple block of code.  It creates a new variable, called &amp;lt;tt&amp;gt;sum&amp;lt;/tt&amp;gt;, and assigns it the value of the two parameters added together (more on expressions later).  The important thing to notice is the &amp;lt;tt&amp;gt;return&amp;lt;/tt&amp;gt; statement, which tells the function to end and return a value to the caller of the function.  All functions ''return a cell'' upon completion.  That means, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;new sum = AddTwoNumbers(4, 5);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code will assign the number 9 to sum.  The function adds the two inputs, and the sum is given as the '''return value'''.  If a function has no return statement or does not place a value in the return statement, it returns 0 by default.&lt;br /&gt;
&lt;br /&gt;
A function can accept any type of input.  It can return any cell, but not arrays or strings.  Example:  &lt;br /&gt;
&amp;lt;pawn&amp;gt;Float:AddTwoFloats(Float:a, Float:b)&lt;br /&gt;
{&lt;br /&gt;
   new Float:sum = a + b;&lt;br /&gt;
 &lt;br /&gt;
   return sum;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Note that if in the above function, you returned a non-Float, you would get a tag mismatch.''&lt;br /&gt;
&lt;br /&gt;
You can, of course, pass variables to functions:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new numbers[3] = {1, 2, 0};&lt;br /&gt;
&lt;br /&gt;
numbers[2] = AddTwoNumbers(numbers[0], numbers[1]);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that cells are passed '''by value'''.  That is, their value cannot be changed by the function.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new a = 5;&lt;br /&gt;
&lt;br /&gt;
ChangeValue(a);&lt;br /&gt;
&lt;br /&gt;
ChangeValue(b)&lt;br /&gt;
{&lt;br /&gt;
   b = 5;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code would not change the value of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;.  That is because a copy of the value in &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is passed instead of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; itself.  &lt;br /&gt;
&lt;br /&gt;
More examples of functions will be provided throughout the article.&lt;br /&gt;
&lt;br /&gt;
==Publics==&lt;br /&gt;
Public functions are used to implement callbacks.  You should not create a public function unless it is specifically implementing a callback.  For example, here are two callbacks from &amp;lt;tt&amp;gt;sourcemod.inc&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;forward OnPluginStart();&lt;br /&gt;
forward OnClientDisconnected(client);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To implement and receive these two events, you would write functions as such:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;public OnPluginStart()&lt;br /&gt;
{&lt;br /&gt;
   /* Code here */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public OnClientDisconnected(client)&lt;br /&gt;
{&lt;br /&gt;
   /* Code here */&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The '''public''' keyword exposes the function publicly, and allows the parent application to directly call the function.&lt;br /&gt;
&lt;br /&gt;
==Natives==&lt;br /&gt;
Natives are builtin functions provided by the application.  You can call them as if they were a normal function.  For example, SourceMod has the following function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;native FloatRound(Float:num);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be called like so:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new num = FloatRound(5.2);     //Results in num = 5&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Array Parameters==&lt;br /&gt;
You can pass arrays or Strings as parameters.  It is important to note that these are passed '''by reference'''.  That is, rather than making a copy of the data, the data is referenced directly.  There is a simple way of explaining this more concretely.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new example[] = {1, 2, 3, 4, 5};&lt;br /&gt;
&lt;br /&gt;
ChangeArray(example, 2, 29);&lt;br /&gt;
&lt;br /&gt;
ChangeArray(array[], index, value)&lt;br /&gt;
{&lt;br /&gt;
   array[index] = value;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function sets the given index in the array to a given value.  When it is run on our example array, it changes index 2 to from the value 3 to 29.  I.e.:&lt;br /&gt;
&amp;lt;pawn&amp;gt;example[2] = 29;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is only possible because the array can be directly modified.  To prevent an array from being modified, you can mark it as &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt;.  This will raise an error on code that attempts to modify it.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;CantChangeArray(const array[], index, value)&lt;br /&gt;
{&lt;br /&gt;
   array[index] = value;    //Won't compile&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is a good idea to use &amp;lt;tt&amp;gt;const&amp;lt;/tt&amp;gt; in array parameters if you know the array won't be modified; this can prevent coding mistakes.&lt;br /&gt;
&lt;br /&gt;
=Expressions=&lt;br /&gt;
Expressions are exactly the same as they are in mathematics.  They are groups of operators/symbols which evaluate to one piece of data.  They are often parenthetical (comprised of parenthesis).  They contain a strict &amp;quot;order of operations.&amp;quot;  They can contain variables, functions, numbers, and expressions themselves can be nested inside other expressions, or even passed as parameters.&lt;br /&gt;
&lt;br /&gt;
The simplest expression is a single number.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
0;   //Returns the number 0&lt;br /&gt;
(0); //Returns the number 0 as well&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although expressions can return any value, they are also said to either return ''zero or non-zero''.  In that sense, ''zero'' is ''false'', and ''non-zero'' is ''true''.  For example, -1 is '''true''' in Pawn, since it is non-zero.  Do not assume negative numbers are false.&lt;br /&gt;
&lt;br /&gt;
The order of operations for expressions is similar to C.  PMDAS: Parenthesis, Multiplication, Division, Addition, Subtraction.  Here are some example expressions:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
5 + 6;                   //Evaluates to 11&lt;br /&gt;
5 * 6 + 3;               //Evaluates to 33&lt;br /&gt;
5 * (6 + 3);             //Evaluates to 45&lt;br /&gt;
5.0 + 2.3;               //Evaluates to 7.3&lt;br /&gt;
(5 * 6) % 7;             //Modulo operator, evaluates to 2&lt;br /&gt;
(5 + 3) / 2 * 4 - 9;     //Evaluates to 7&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted, expressions can contain variables, or even functions:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new a = 5 * 6;&lt;br /&gt;
new b = a * 3;      //Evaluates to 90&lt;br /&gt;
new c = AddTwoNumbers(a, b) + (a * b);&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:  String manipulation routines may be found in the string.inc file located in the include subdirectory.  They may be browsed through the [http://docs.sourcemod.net/api/ API Reference] as well.&lt;br /&gt;
&lt;br /&gt;
==Operators==&lt;br /&gt;
There are a few extra helpful operators in Pawn.  The first set simplifies self-aggregation expressions.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new a = 5;&lt;br /&gt;
&lt;br /&gt;
a = a + 5;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Can be rewritten as:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new a = 5;&lt;br /&gt;
a += 5;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is true of the following operators in Pawn:&lt;br /&gt;
*Four-function: *, /, -, +&lt;br /&gt;
*Bit-wise: |, &amp;amp;, ^, ~, &amp;lt;&amp;lt;, &amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, there are increment/decrement operators:&lt;br /&gt;
&amp;lt;pawn&amp;gt;a = a + 1;&lt;br /&gt;
a = a - 1;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Can be simplified as:&lt;br /&gt;
&amp;lt;pawn&amp;gt;a++;&lt;br /&gt;
a--;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an advanced note, the ++ or -- can come before the variable (pre-increment, pre-decrement) or after the variable (post-increment, post-decrement).  The difference is in how the rest of the expression containing them sees their result.&lt;br /&gt;
&lt;br /&gt;
* ''Pre:'' The variable is incremented before evaluation, and the rest of the expression sees the new value.&lt;br /&gt;
* ''Post:'' The variable is incremented after evaluation, and the rest of the expression sees the old value.&lt;br /&gt;
&lt;br /&gt;
In other words, &amp;lt;tt&amp;gt;a++&amp;lt;/tt&amp;gt; evaluates to the value of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; while &amp;lt;tt&amp;gt;++a&amp;lt;/tt&amp;gt; evaluates to the value of &amp;lt;tt&amp;gt;a + 1&amp;lt;/tt&amp;gt;.  In both cases &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is incremented by &amp;lt;tt&amp;gt;1&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;new a = 5;&lt;br /&gt;
new b = a++;   // b = 5, a = 6  (1)&lt;br /&gt;
new c = ++a;   // a = 7, c = 7  (2)&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In (1) &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; is assigned &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;'s ''old'' value ''before'' it is incremented to &amp;lt;tt&amp;gt;6&amp;lt;/tt&amp;gt;, but in (2) &amp;lt;tt&amp;gt;c&amp;lt;/tt&amp;gt; is assigned &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;'s ''new'' value ''after'' it is incremented to &amp;lt;tt&amp;gt;7&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Comparison Operators==&lt;br /&gt;
There are six operators for comparing two values numerically, and the result is either true (non-zero) or false (zero):&lt;br /&gt;
*&amp;lt;tt&amp;gt;a == b&amp;lt;/tt&amp;gt; - True if a and b have the same value.&lt;br /&gt;
*&amp;lt;tt&amp;gt;a != b&amp;lt;/tt&amp;gt; - True if a and b have different values.&lt;br /&gt;
*&amp;lt;tt&amp;gt;a &amp;amp;gt; b&amp;lt;/tt&amp;gt; - True if a is greater than b&lt;br /&gt;
*&amp;lt;tt&amp;gt;a &amp;amp;gt;= b&amp;lt;/tt&amp;gt; - True if a is greater than or equal to b&lt;br /&gt;
*&amp;lt;tt&amp;gt;a &amp;amp;lt; b&amp;lt;/tt&amp;gt; - True if a is less than b&lt;br /&gt;
*&amp;lt;tt&amp;gt;a &amp;amp;lt;= b&amp;lt;/tt&amp;gt; - True if a is less than or equal to b&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
(1 != 3);         //Evaluates to true because 1 is not equal to 3.&lt;br /&gt;
(3 + 3 == 6);     //Evaluates to true because 3+3 is 6.&lt;br /&gt;
(5 - 2 &amp;gt;= 4);     //Evaluates to false because 3 is less than 4.&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that these operators do not work on arrays or strings.  That is, you cannot compare either using &amp;lt;tt&amp;gt;==&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Truth Operators==&lt;br /&gt;
These truth values can be combined using three boolean operators:&lt;br /&gt;
*&amp;lt;tt&amp;gt;a &amp;amp;&amp;amp; b&amp;lt;/tt&amp;gt; - True if both a and b are true. False if a or b (or both) is false.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! &amp;lt;tt&amp;gt;&amp;amp;&amp;amp;&amp;lt;/tt&amp;gt; !! 0 !! 1&lt;br /&gt;
|-&lt;br /&gt;
! 0&lt;br /&gt;
| 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
! 1&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|}&lt;br /&gt;
*&amp;lt;tt&amp;gt;a || b&amp;lt;/tt&amp;gt; - True if a or b (or both) is true. False if both a and b are false.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; !! 0 !! 1&lt;br /&gt;
|-&lt;br /&gt;
! 0&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
! 1&lt;br /&gt;
| 1 || 1&lt;br /&gt;
|}&lt;br /&gt;
*&amp;lt;tt&amp;gt;!a&amp;lt;/tt&amp;gt; - True if a is false. False if a is true.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! &amp;lt;tt&amp;gt;!&amp;lt;/tt&amp;gt; !! 0 !! 1&lt;br /&gt;
|- &lt;br /&gt;
!&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
(1 || 0);         //Evaluates to true because the expression 1 is true&lt;br /&gt;
(1 &amp;amp;&amp;amp; 0);         //Evaluates to false because the expression 0 is false&lt;br /&gt;
(!1 || 0);        //Evaluates to false because !1 is false.&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Left/Right Values==&lt;br /&gt;
Two important concepts are left-hand and right-hand values, or l-values and r-values.  An l-value is what appears on the left-hand side of a variable assignment, and an r-value is what appears on the right side of a variable assignment.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new a = 5;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is an l-value and &amp;lt;tt&amp;gt;5&amp;lt;/tt&amp;gt; is an r-value.&lt;br /&gt;
&lt;br /&gt;
The rules:&lt;br /&gt;
*'''Expressions are never l-values'''.&lt;br /&gt;
*'''Variables are both l-values and r-values'''.&lt;br /&gt;
&lt;br /&gt;
=Conditionals=&lt;br /&gt;
Conditional statements let you only run code if a certain condition is matched.&lt;br /&gt;
&lt;br /&gt;
==If Statements==&lt;br /&gt;
If statements test one or more conditions.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
if (a == 5)&lt;br /&gt;
{&lt;br /&gt;
   /* Code that will run if the expression was true */&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They can be extended to handle more cases as well:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
if (a == 5)&lt;br /&gt;
{&lt;br /&gt;
   /* Code */&lt;br /&gt;
}&lt;br /&gt;
else if (a == 6)&lt;br /&gt;
{&lt;br /&gt;
   /* Code  */&lt;br /&gt;
}&lt;br /&gt;
else if (a == 7)&lt;br /&gt;
{&lt;br /&gt;
   /* Code */&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also handle the case of no expression being matched.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
if (a == 5)&lt;br /&gt;
{&lt;br /&gt;
   /* Code */&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
   /* Code that will run if no expressions were true */&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Switch Statements==&lt;br /&gt;
Switch statements are restricted if statements.  They test one expression for a series of possible values.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
switch (a)&lt;br /&gt;
{&lt;br /&gt;
   case 5:&lt;br /&gt;
   {&lt;br /&gt;
      /* code */&lt;br /&gt;
   }&lt;br /&gt;
   case 6:&lt;br /&gt;
   {&lt;br /&gt;
      /* code */&lt;br /&gt;
   }&lt;br /&gt;
   case 7:&lt;br /&gt;
   {&lt;br /&gt;
      /* code */&lt;br /&gt;
   }&lt;br /&gt;
   case 8, 9, 10:&lt;br /&gt;
   {&lt;br /&gt;
      /* Code */&lt;br /&gt;
   }&lt;br /&gt;
   default:&lt;br /&gt;
   {&lt;br /&gt;
      /* will run if no case matched */&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike some other languages, switches are not fall-through.  That is, multiple cases will never be run.  When a case matches its code is executed, and the switch is then immediately terminated.&lt;br /&gt;
&lt;br /&gt;
=Loops=&lt;br /&gt;
Loops allow you to conveniently repeat a block of code while a given condition remains true.  &lt;br /&gt;
&lt;br /&gt;
==For Loops==&lt;br /&gt;
For loops are loops which have four parts:&lt;br /&gt;
*The '''initialization''' statement - run once before the first loop.&lt;br /&gt;
*The '''condition''' statement - checks whether the next loop should run, including the first one.  The loop terminates when this expression evaluates to false.&lt;br /&gt;
*The '''iteration''' statement - run after each loop.&lt;br /&gt;
*The '''body''' block - run each time the '''condition''' statement evaluates to true.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
for ( /* initialization */ ; /* condition */ ; /* iteration */ )&lt;br /&gt;
{&lt;br /&gt;
   /* body */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A simple example is a function to sum an array:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};&lt;br /&gt;
new sum = SumArray(array, 10);&lt;br /&gt;
&lt;br /&gt;
SumArray(const array[], count)&lt;br /&gt;
{&lt;br /&gt;
   new total;&lt;br /&gt;
&lt;br /&gt;
   for (new i = 0; i &amp;lt; count; i++)&lt;br /&gt;
   {&lt;br /&gt;
      total += array[i];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   return total;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Broken down:&lt;br /&gt;
*&amp;lt;tt&amp;gt;new i = 0&amp;lt;/tt&amp;gt; - Creates a new variable for the loop, sets it to 0.&lt;br /&gt;
*&amp;lt;tt&amp;gt;i &amp;lt; count&amp;lt;/tt&amp;gt; - Only runs the loop if &amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; is less than &amp;lt;tt&amp;gt;count&amp;lt;/tt&amp;gt;.  This ensures that the loop stops reading at a certain point.  In this case, we don't want to read invalid indexes in the array.&lt;br /&gt;
*&amp;lt;tt&amp;gt;i++&amp;lt;/tt&amp;gt; - Increments &amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; by one after each loop.  This ensures that the loop doesn't run forever; eventually &amp;lt;tt&amp;gt;i&amp;lt;/tt&amp;gt; will become too big and the loop will end.&lt;br /&gt;
&lt;br /&gt;
Thus, the &amp;lt;tt&amp;gt;SumArray&amp;lt;/tt&amp;gt; function will loop through each valid index of the array, each time adding that value of the array into a sum.  For loops are very common for processing arrays like this.&lt;br /&gt;
&lt;br /&gt;
==While Loops==&lt;br /&gt;
While loops are less common than for loops but are actually the simplest possible loop.  They have only two parts:&lt;br /&gt;
*The '''condition''' statement - checked before each loop.  The loop terminates when it evaluates to false.&lt;br /&gt;
*The '''body''' block - run each time through the loop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
while ( /* condition */ )&lt;br /&gt;
{&lt;br /&gt;
   /* body */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As long as the condition expression remains true, the loop will continue.  Every for loop can be rewritten as a while loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
/* initialization */&lt;br /&gt;
while ( /* condition */ )&lt;br /&gt;
{&lt;br /&gt;
   /* body */&lt;br /&gt;
   /* iteration */&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is the previous for loop rewritten as a while loop:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
SumArray(const array[], count)&lt;br /&gt;
{&lt;br /&gt;
   new total, i;&lt;br /&gt;
&lt;br /&gt;
   while (i &amp;lt; count)&lt;br /&gt;
   {&lt;br /&gt;
      total += array[i];&lt;br /&gt;
      i++;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   return total;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are also '''do...while''' loops which are even less common.  These are the same as while loops except the condition check is AFTER each loop, rather than before.  This means the loop is always run at least once.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
do&lt;br /&gt;
{&lt;br /&gt;
   /* body */&lt;br /&gt;
}&lt;br /&gt;
while ( /* condition */ );&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Loop Control==&lt;br /&gt;
There are two cases in which you want to selectively control a loop:&lt;br /&gt;
*'''skipping''' one iteration of the loop but continuing as normal, or;&lt;br /&gt;
*'''breaking''' the loop entirely before it's finished.&lt;br /&gt;
&lt;br /&gt;
Let's say you have a function which takes in an array and searches for a matching number.  You want it to stop once the number is found:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the array index where the value is, or -1 if not found.&lt;br /&gt;
 */&lt;br /&gt;
SearchInArray(const array[], count, value)&lt;br /&gt;
{&lt;br /&gt;
   new index = -1;&lt;br /&gt;
 &lt;br /&gt;
   for (new i = 0; i &amp;lt; count; i++)&lt;br /&gt;
   {&lt;br /&gt;
      if (array[i] == value)&lt;br /&gt;
      {&lt;br /&gt;
         index = i;&lt;br /&gt;
         break;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   return index;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Certainly, this function could simply &amp;lt;tt&amp;gt;return i&amp;lt;/tt&amp;gt; instead, but the example shows how &amp;lt;tt&amp;gt;break&amp;lt;/tt&amp;gt; will terminate the loop.&lt;br /&gt;
&lt;br /&gt;
Similarly, the &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt; keyword skips an iteration of a loop.  For example, let's say we wanted to sum all even numbers:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
SumEvenNumbers(const array[], count)&lt;br /&gt;
{&lt;br /&gt;
   new sum;&lt;br /&gt;
 &lt;br /&gt;
   for (new i = 0; i &amp;lt; count; i++)&lt;br /&gt;
   {&lt;br /&gt;
      /* If divisibility by 2 is 1, we know it's odd */&lt;br /&gt;
      if (array[i] % 2 == 1)&lt;br /&gt;
      {&lt;br /&gt;
         /* Skip the rest of this loop iteration */&lt;br /&gt;
         continue;&lt;br /&gt;
      }&lt;br /&gt;
      sum += array[i];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   return sum;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Scope=&lt;br /&gt;
Scope refers to the '''visibility''' of code.  That is, code at one level may not be &amp;quot;visible&amp;quot; to code at another level.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new A, B, C;&lt;br /&gt;
&lt;br /&gt;
Function1()&lt;br /&gt;
{&lt;br /&gt;
   new B;&lt;br /&gt;
&lt;br /&gt;
   Function2();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Function2()&lt;br /&gt;
{&lt;br /&gt;
   new C;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; exist at '''global scope'''.  They can be seen by any function.  However, the &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;Function1&amp;lt;/tt&amp;gt; is not the same variable as the &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; at the global level.  Instead, it is at '''local scope''', and is thus a '''local variable'''.&lt;br /&gt;
&lt;br /&gt;
Similarly, &amp;lt;tt&amp;gt;Function1&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Function2&amp;lt;/tt&amp;gt; know nothing about each other's variables.&lt;br /&gt;
&lt;br /&gt;
Not only is the variable private to &amp;lt;tt&amp;gt;Function1&amp;lt;/tt&amp;gt;, but it is re-created each time the function is invoked.  Imagine this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
Function1()&lt;br /&gt;
{&lt;br /&gt;
   new B;&lt;br /&gt;
&lt;br /&gt;
   Function1();&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, &amp;lt;tt&amp;gt;Function1&amp;lt;/tt&amp;gt; calls itself.  Of course, this is infinite recursion (a bad thing), but the idea is that each time the function runs, there is a new copy of &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt;.  When the function ends, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; is destroyed, and the value is lost.&lt;br /&gt;
&lt;br /&gt;
This property can be simplified by saying that a variable's scope is equal to the nesting level it is in.  That is, a variable at global scope is visible globally to all functions.  A variable at local scope is visible to all code blocks &amp;quot;beneath&amp;quot; its nesting level.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;Function1()&lt;br /&gt;
{&lt;br /&gt;
   new A;&lt;br /&gt;
&lt;br /&gt;
   if (A)&lt;br /&gt;
   {&lt;br /&gt;
      A = 5;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code is valid since A's scope extends throughout the function.  The following code, however, is not valid:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
Function1()&lt;br /&gt;
{&lt;br /&gt;
   new A;&lt;br /&gt;
&lt;br /&gt;
   if (A)&lt;br /&gt;
   {&lt;br /&gt;
      new B = 5;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   B = 5;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; is declared in a new code block.  That means &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; is only accessible to that code block (and all sub-blocks nested within).  As soon as the code block terminates, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; is no longer valid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Dynamic Arrays=&lt;br /&gt;
Dynamic arrays are arrays which don't have a hardcoded size.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;Function1(size)&lt;br /&gt;
{&lt;br /&gt;
   new array[size];&lt;br /&gt;
&lt;br /&gt;
   /* Code */&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dynamic arrays can have any expression as their size as long as the expression evaluates to a number larger than 0.  Like normal arrays, SourcePawn does not know the array size after it is created; you have to save it if you want it later.&lt;br /&gt;
&lt;br /&gt;
Dynamic arrays are only valid at the local scope level, since code cannot exist globally.&lt;br /&gt;
&lt;br /&gt;
=Extended Variable Declarations=&lt;br /&gt;
Variables can be declared in more ways than simply &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==decl==&lt;br /&gt;
===Purpose===&lt;br /&gt;
By default, all variables in Pawn are initialized to zero.  If there is an explicit initializer, the variable is initialized to the expression after the &amp;lt;tt&amp;gt;=&amp;lt;/tt&amp;gt; token.  At a local scope, this can be a run-time expense.  The &amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt; keyword (which is only valid at local scope) was introduced to let users decide if they want variables initialized or not.&lt;br /&gt;
&lt;br /&gt;
Note: &amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt; should not be used on single cell variables.  There is almost never any benefit.&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new c = 5;&lt;br /&gt;
new d;&lt;br /&gt;
new String:blah[512];&lt;br /&gt;
&lt;br /&gt;
Format(blah, sizeof(blah), &amp;quot;%d %d&amp;quot;, c, d);&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this code, &amp;lt;tt&amp;gt;c&amp;lt;/tt&amp;gt; is equal to 5 and &amp;lt;tt&amp;gt;d&amp;lt;/tt&amp;gt; is equal to 0.  The run-time expense of this initialization is negligible.  However, &amp;lt;tt&amp;gt;blah&amp;lt;/tt&amp;gt; is a large array, and the expense of initializing the entire array to 0s could be detrimental in certain situations.  &lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;tt&amp;gt;blah&amp;lt;/tt&amp;gt; does not need to be zeroed.  In between being declared with &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; and stored with &amp;lt;tt&amp;gt;Format()&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;blah&amp;lt;/tt&amp;gt; is never loaded or read.  Thus this code would be more efficiently written as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new c = 5;&lt;br /&gt;
new d;&lt;br /&gt;
decl String:blah[512];&lt;br /&gt;
&lt;br /&gt;
Format(blah, sizeof(blah), &amp;quot;%d %d&amp;quot;, c, d);&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Caveats===&lt;br /&gt;
The downside to &amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt; is that it means its variables will start with &amp;quot;garbage&amp;quot; contents.  For example, if we were to use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new c = 5;&lt;br /&gt;
new d;&lt;br /&gt;
decl String:blah[512];&lt;br /&gt;
&lt;br /&gt;
PrintToServer(&amp;quot;%s&amp;quot;, blah);&lt;br /&gt;
&lt;br /&gt;
Format(blah, sizeof(blah), &amp;quot;%d %d&amp;quot;, c, d);&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code may crash the server, because &amp;lt;tt&amp;gt;blah&amp;lt;/tt&amp;gt; may be completely corrupt (strings require a terminator, and that may not be present).  Similarly, if we did:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new c = 5;&lt;br /&gt;
decl d;&lt;br /&gt;
decl String:blah[512];&lt;br /&gt;
&lt;br /&gt;
Format(blah, sizeof(blah), &amp;quot;%d %d&amp;quot;, c, d);&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The value of &amp;lt;tt&amp;gt;d&amp;lt;/tt&amp;gt; is now undefined.  It could be any value, negative or positive.  &lt;br /&gt;
&lt;br /&gt;
Note that it is easy to efficiently make strings safe.  The example below shows how to terminate a garbage string:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
decl String:blah[512];&lt;br /&gt;
&lt;br /&gt;
blah[0] = '\0';&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Golden Rules===&lt;br /&gt;
*'''Only use decl if in between declaring and loading/reading the value, you are absolutely sure there is at least one store/set operation that gives the variable valid data.'''&lt;br /&gt;
*'''Do not prematurely optimize.'''  Likewise, there is no need to use &amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt; on non-arrays, because there is no added expense for initializing a single cell value.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
This example is NOT as efficient as a &amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
new String:blah[512] = &amp;quot;a&amp;quot;;&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the string is only one character, the &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; operator guarantees the rest of the array will be zeroed as well.&lt;br /&gt;
&lt;br /&gt;
Also note, it is invalid to explicitly initialize a &amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pawn&amp;gt;decl String:blah[512] = &amp;quot;a&amp;quot;;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code will not compile, because the purpose of &amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt; is to avoid any initialization.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==static==&lt;br /&gt;
The &amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; keyword is available at global and local scope.  It has different meanings in each.&lt;br /&gt;
&lt;br /&gt;
===Global static===&lt;br /&gt;
A global static variable can only be accessed from within the same file.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;//file1.inc&lt;br /&gt;
static Float:g_value1 = 0.15f;&lt;br /&gt;
&lt;br /&gt;
//file2.inc&lt;br /&gt;
static Float:g_value2 = 0.15f;&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a plugin includes both of these files, it will not be able to use either &amp;lt;tt&amp;gt;g_value1&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;g_value2&amp;lt;/tt&amp;gt;.  This is a simple information hiding mechanism, and is similar to declaring member variables as &amp;lt;tt&amp;gt;private&amp;lt;/tt&amp;gt; in languages like C++, Java, or C#.&lt;br /&gt;
&lt;br /&gt;
===Local static===&lt;br /&gt;
A local static variable is a global variable that is only visible from its local lexical scope.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
MyFunction(inc)&lt;br /&gt;
{&lt;br /&gt;
   static counter = -1;&lt;br /&gt;
&lt;br /&gt;
   counter += inc;&lt;br /&gt;
&lt;br /&gt;
   return counter;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, &amp;lt;tt&amp;gt;counter&amp;lt;/tt&amp;gt; is technically a global variable -- it is initialized once to -1 and is never initialized again.  It does not exist on the stack.  That means each time &amp;lt;tt&amp;gt;MyFunction&amp;lt;/tt&amp;gt; runs, the &amp;lt;tt&amp;gt;counter&amp;lt;/tt&amp;gt; variable and its storage in memory is the same.&lt;br /&gt;
&lt;br /&gt;
Take this example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;MyFunction(5);&lt;br /&gt;
MyFunction(6);&lt;br /&gt;
MyFunction(10);&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, &amp;lt;tt&amp;gt;counter&amp;lt;/tt&amp;gt; will be &amp;lt;tt&amp;gt;-1 + 5 + 6 + 10&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;20&amp;lt;/tt&amp;gt;, because it persists beyond the frame of the function.  Note this may pose problems for recursive functions: if your function may be recursive, then &amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; is usually not a good idea unless your code is re-entrant.  &lt;br /&gt;
&lt;br /&gt;
The benefit of a local static variable is that you don't have to clutter your script with global variables.  As long as the variable doesn't need to be read by another function, you can squirrel it inside the function and its persistence will be guaranteed.&lt;br /&gt;
&lt;br /&gt;
Note that statics can exist in any local scope:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&gt;
MyFunction(inc)&lt;br /&gt;
{&lt;br /&gt;
   if (inc &amp;gt; 0)&lt;br /&gt;
   {&lt;br /&gt;
      static counter;&lt;br /&gt;
      return (counter += inc);&lt;br /&gt;
   }&lt;br /&gt;
   return -1;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;br /&gt;
&lt;br /&gt;
{{LanguageSwitch}}&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Generic_Source_Events&amp;diff=7225</id>
		<title>Generic Source Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Generic_Source_Events&amp;diff=7225"/>
		<updated>2009-04-24T17:37:40Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:''Refer back to [[Game Events (Source)]] for more events.''&lt;br /&gt;
&lt;br /&gt;
These '''should''' apply to all Source engine games&lt;br /&gt;
=== team_info ===&lt;br /&gt;
{{qnotice|Info about team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|team_info|string}}&lt;br /&gt;
{{hl2msg|byte|teamid|unique team id}}&lt;br /&gt;
{{hl2msg|string|teamname|team name eg &amp;quot;Team Blue&amp;quot;}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== team_score ===&lt;br /&gt;
{{qnotice|Team score changed}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|team_info|string}}&lt;br /&gt;
{{hl2msg|byte|teamid|team id}}&lt;br /&gt;
{{hl2msg|short|score|total team score}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_team ===&lt;br /&gt;
{{qnotice|Player change his team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_team|string}}&lt;br /&gt;
{{hl2msg|short|userid|user ID on the server}}&lt;br /&gt;
{{hl2msg|byte|team|team id}}&lt;br /&gt;
{{hl2msg|byte|oldteam|old team id}}&lt;br /&gt;
{{hl2msg|bool|disconnect|team change because player disconnects}}&lt;br /&gt;
{{hl2msg|bool|autoteam|true if the player was auto assigned to the team (OB only)}}&lt;br /&gt;
{{hl2msg|bool|silent|if true wont print the team join messages (OB only)}}&lt;br /&gt;
{{hl2msg|string|name|player's name (OB only)}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_class ===&lt;br /&gt;
{{qnotice|A player changed his class}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_class|string}}&lt;br /&gt;
{{hl2msg|short|userid|user ID on server}}&lt;br /&gt;
{{hl2msg|string|class|new player class / model}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_death ===&lt;br /&gt;
{{qnotice|A player has died}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_death|string}}&lt;br /&gt;
{{hl2msg|short|userid|user ID who died}}&lt;br /&gt;
{{hl2msg|short|attacker|user ID who killed}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_hurt ===&lt;br /&gt;
{{qnotice|A player was hurt}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_hurt|string}}&lt;br /&gt;
{{hl2msg|short|userid|player index who was hurt}}&lt;br /&gt;
{{hl2msg|short|attacker|player index who attacked}}&lt;br /&gt;
{{hl2msg|byte|health|remaining health points}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_chat ===&lt;br /&gt;
{{qnotice|A public player chat}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_chat|string}}&lt;br /&gt;
{{hl2msg|bool|teamonly|true if team only chat}}&lt;br /&gt;
{{hl2msg|short|userid|chatting player}}&lt;br /&gt;
{{hl2msg|string|text|chat text}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_score ===&lt;br /&gt;
{{qnotice|Player's scores changed}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_score|string}}&lt;br /&gt;
{{hl2msg|short|userid|user ID on server}}&lt;br /&gt;
{{hl2msg|short|kills|# of kills}}&lt;br /&gt;
{{hl2msg|short|deaths|# of deaths}}&lt;br /&gt;
{{hl2msg|short|score|total game score}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_spawn ===&lt;br /&gt;
{{qnotice|Player spawned in game}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_spawn|string}}&lt;br /&gt;
{{hl2msg|short|userid|user ID on server}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_shoot ===&lt;br /&gt;
{{qnotice|Player shot his weapon}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_shoot|string}}&lt;br /&gt;
{{hl2msg|short|userid|user ID on server}}&lt;br /&gt;
{{hl2msg|byte|weapon|weapon ID}}&lt;br /&gt;
{{hl2msg|byte|mode|weapon mode}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_use ===&lt;br /&gt;
{{qnotice|When a player uses an option}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_use|string}}&lt;br /&gt;
{{hl2msg|short|userid|user ID on server}}&lt;br /&gt;
{{hl2msg|short|entity|entity used by player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_changename ===&lt;br /&gt;
{{qnotice|Player changed name}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_changename|string}}&lt;br /&gt;
{{hl2msg|string|userid|user ID on server}}&lt;br /&gt;
{{hl2msg|string|oldname|players old (current) name}}&lt;br /&gt;
{{hl2msg|string|newname|players new name}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== game_init ===&lt;br /&gt;
{{qnotice|Sent when a new game is started (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== game_newmap ===&lt;br /&gt;
{{qnotice|Sent when new map is completely loaded}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|game_newmap|string}}&lt;br /&gt;
{{hl2msg|string|mapname|map name}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== game_start ===&lt;br /&gt;
{{qnotice|A new game starts}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|game_start|string}}&lt;br /&gt;
{{hl2msg|long|roundslimit|max round}}&lt;br /&gt;
{{hl2msg|long|timelimit|time limit}}&lt;br /&gt;
{{hl2msg|long|fraglimit|frag limit}}&lt;br /&gt;
{{hl2msg|string|objective|round objective}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== game_end ===&lt;br /&gt;
{{qnotice|A game ended}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|game_end|string}}&lt;br /&gt;
{{hl2msg|byte|winner|winner team/user id}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== round_start ===&lt;br /&gt;
{{qnotice|The round started}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|round_start|string}}&lt;br /&gt;
{{hl2msg|long|timelimit|round time limit in seconds}}&lt;br /&gt;
{{hl2msg|long|fraglimit|frag limit}}&lt;br /&gt;
{{hl2msg|string|objective|round objective}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== round_end ===&lt;br /&gt;
{{qnotice|The round ended}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|round_end|string}}&lt;br /&gt;
{{hl2msg|byte|winner|winner team/user id}}&lt;br /&gt;
{{hl2msg|byte|reason|reason why the team won}}&lt;br /&gt;
{{hl2msg|string|message|end round message}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== game_message ===&lt;br /&gt;
{{qnotice|A message sent by game logic to everyone}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|game_message|string}}&lt;br /&gt;
{{hl2msg|byte|target|0 console, 1 HUD}}&lt;br /&gt;
{{hl2msg|string|text|the message text}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== break_breakable ===&lt;br /&gt;
{{qnotice|A breakable (func_break) is broken.}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|break_breakable|string}}&lt;br /&gt;
{{hl2msg|long|entindex|index of the entity}}&lt;br /&gt;
{{hl2msg|short|userid|userid who broke the entity}}&lt;br /&gt;
{{hl2msg|byte|material|BREAK_GLASS, BREAK_WOOD, etc}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== break_prop ===&lt;br /&gt;
{{qnotice|A breakable prop is broken.}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|break_prop|string}}&lt;br /&gt;
{{hl2msg|long|entindex|index of the entity}}&lt;br /&gt;
{{hl2msg|short|userid|userid who broke the entity}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== entity_killed ===&lt;br /&gt;
{{qnotice|An entity has been killed (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|entity_killed|string}}&lt;br /&gt;
{{hl2msg|long|entindex_killed|index of the killed entity}}&lt;br /&gt;
{{hl2msg|long|entindex_attacker|index of the attacker}}&lt;br /&gt;
{{hl2msg|long|entindex_inflictor|index of the inflictor (weapon id, etc)}}&lt;br /&gt;
{{hl2msg|long|damagebits|the damagebits of the attack}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== bonus_updated ===&lt;br /&gt;
{{qnotice|??? (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|bonus_updated|string}}&lt;br /&gt;
{{hl2msg|short|numadvanced|}}&lt;br /&gt;
{{hl2msg|short|numbronze|}}&lt;br /&gt;
{{hl2msg|short|numsilver|}}&lt;br /&gt;
{{hl2msg|short|numgold|}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== achievement_event ===&lt;br /&gt;
{{qnotice|A player has received an achievement (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|achievement_earned|string}}&lt;br /&gt;
{{hl2msg|string|achievement_name|non-localized name of achievement}}&lt;br /&gt;
{{hl2msg|short|cur_val|# of steps toward achievement}}&lt;br /&gt;
{{hl2msg|short|max_val|total # of steps in achievement}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== achievement_increment ===&lt;br /&gt;
{{qnotice|Sent whenever an achievement that's tracked on the HUD increases (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|achievement_increment|string}}&lt;br /&gt;
{{hl2msg|long|achievement_id|ID of achievement that went up}}&lt;br /&gt;
{{hl2msg|short|cur_val|# of steps toward achievement}}&lt;br /&gt;
{{hl2msg|short|max_val|total # of steps in achievement}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== physgun_pickup ===&lt;br /&gt;
{{qnotice|Player picked up a physgun (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|physgun_pickup|string}}&lt;br /&gt;
{{hl2msg|long|entindex|entity picked up}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== flare_ignite_npc ===&lt;br /&gt;
{{qnotice|A flare has ignited a NPC (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|flare_ignite_npc|string}}&lt;br /&gt;
{{hl2msg|long|entindex|entity ignited}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== helicopter_grenade_punt_miss ===&lt;br /&gt;
{{qnotice|??? (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== user_data_downloaded ===&lt;br /&gt;
{{qnotice|Fired when achievements/stats are downloaded from Steam or XBOX Live (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ragdoll_dissolved ===&lt;br /&gt;
{{qnotice|A ragdoll has dissolved (OB only)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|ragdoll_dissolved|string}}&lt;br /&gt;
{{hl2msg|long|entindex|index of the dissolved entity}}&lt;br /&gt;
{{end-hl2msg}}&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5648</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5648"/>
		<updated>2008-03-05T23:10:30Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Counter-Strike Source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this category you can find resources for specific mods.&lt;br /&gt;
&lt;br /&gt;
==Team Fortress 2==&lt;br /&gt;
[[Team_Fortress_2_Events|Events]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Classnames|Classnames]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Virtual_Functions|Virtual Functions]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Offsets|Offsets]]&lt;br /&gt;
&lt;br /&gt;
==Counter-Strike Source==&lt;br /&gt;
[[Counter-Strike:_Source_Events|Events]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Counter-Strike:_Source_Classnames|Classnames]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Counter-Strike:_Source_Virtual_Functions|Virtual Functions]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Counter-Strike:_Source_Offsets|Offsets]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5647</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5647"/>
		<updated>2008-03-05T23:09:38Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Team Fortress 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this category you can find resources for specific mods.&lt;br /&gt;
&lt;br /&gt;
==Team Fortress 2==&lt;br /&gt;
[[Team_Fortress_2_Events|Events]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Classnames|Classnames]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Virtual_Functions|Virtual Functions]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Offsets|Offsets]]&lt;br /&gt;
&lt;br /&gt;
==Counter-Strike Source==&lt;br /&gt;
[[Counter-Strike:_Source_Events|Events]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5646</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5646"/>
		<updated>2008-03-05T23:09:31Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Team Fortress 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this category you can find resources for specific mods.&lt;br /&gt;
&lt;br /&gt;
==Team Fortress 2==&lt;br /&gt;
[[Team_Fortress_2_Events|Events]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Classnames|Classnames]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Virtual_Functions|Virtual Functions]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Offsets||Offsets]]&lt;br /&gt;
&lt;br /&gt;
==Counter-Strike Source==&lt;br /&gt;
[[Counter-Strike:_Source_Events|Events]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5645</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5645"/>
		<updated>2008-03-05T23:08:39Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Team Fortress 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this category you can find resources for specific mods.&lt;br /&gt;
&lt;br /&gt;
==Team Fortress 2==&lt;br /&gt;
[[Team_Fortress_2_Events|Events]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Team_Fortress_2_Classnames|Classnames]]&lt;br /&gt;
&lt;br /&gt;
==Counter-Strike Source==&lt;br /&gt;
[[Counter-Strike:_Source_Events|Events]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5644</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5644"/>
		<updated>2008-03-05T23:08:31Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Team Fortress 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this category you can find resources for specific mods.&lt;br /&gt;
&lt;br /&gt;
==Team Fortress 2==&lt;br /&gt;
[[Team_Fortress_2_Events|Events]]&lt;br /&gt;
[[Team_Fortress_2_Classnames|Classnames]]&lt;br /&gt;
&lt;br /&gt;
==Counter-Strike Source==&lt;br /&gt;
[[Counter-Strike:_Source_Events|Events]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5643</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5643"/>
		<updated>2008-03-05T23:07:24Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this category you can find resources for specific mods.&lt;br /&gt;
&lt;br /&gt;
==Team Fortress 2==&lt;br /&gt;
[[Team_Fortress_2_Events|Events]]&lt;br /&gt;
&lt;br /&gt;
==Counter-Strike Source==&lt;br /&gt;
[[Counter-Strike:_Source_Events|Events]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5642</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5642"/>
		<updated>2008-03-05T23:06:23Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Team Fortress 2==&lt;br /&gt;
[[Team_Fortress_2_Events|Events]]&lt;br /&gt;
&lt;br /&gt;
==Counter-Strike Source==&lt;br /&gt;
[[Counter-Strike:_Source_Events|Events]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5641</id>
		<title>Category:Game Resources</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:Game_Resources&amp;diff=5641"/>
		<updated>2008-03-05T23:02:06Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: New page: Reserved  Category:Game_Resources&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Reserved&lt;br /&gt;
&lt;br /&gt;
[[Category:Game_Resources]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5628</id>
		<title>Team Fortress 2 Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5628"/>
		<updated>2008-03-01T18:03:57Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== intro_finish ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_finish|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== intro_nextcamera ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_nextcamera|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_changeclass ===&lt;br /&gt;
{{qnotice|When a player changes their class}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_changeclass|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|class}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_death ===&lt;br /&gt;
{{qnotice|When a player dies}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_death|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|long|damagebits}}&lt;br /&gt;
{{hl2msg|short|customkill}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|short|dominated}}&lt;br /&gt;
{{hl2msg|short|assister_dominated}}&lt;br /&gt;
{{hl2msg|short|revenge}}&lt;br /&gt;
{{hl2msg|short|assister_revenge}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== object_destroyed ===&lt;br /&gt;
{{qnotice|When a player destroys an object}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|object_destroyed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|short|objecttype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|long|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_game_over ===&lt;br /&gt;
{{qnotice|When a tf game ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== ctf_flag_captured ===&lt;br /&gt;
{{qnotice|When a flag is captured by a player}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|ctf_flag_captured|string}}&lt;br /&gt;
{{hl2msg|short|capping_team}}&lt;br /&gt;
{{hl2msg|short|capping_team_score}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_initialized ===&lt;br /&gt;
{{qnotice|When a player begins to capture a control point}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_initialized|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateimages ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateimages|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatelayout ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatelayout|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatecapping ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatecapping|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateowner ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateowner|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_starttouch ===&lt;br /&gt;
{{qnotice|When a player enters a capture point zone}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_starttouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_endtouch ===&lt;br /&gt;
{{qnotice|When a player leaves a capture point zone}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_endtouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_pulse_element ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_pulse_element|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture_mult ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture_mult|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_start ===&lt;br /&gt;
{{qnotice|When a round restarts}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_start|string}}&lt;br /&gt;
{{hl2msg|bool|full_reset}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_active ===&lt;br /&gt;
{{qnotice|When the round is active and players can move}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_begins ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_begins|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_ends ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_ends|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_abouttoend ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round is about to end}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_abouttoend|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_restart_round ===&lt;br /&gt;
{{qnotice|When a round is restarted}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_restart_round|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_ready_restart ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_ready_restart|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_restart_seconds ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_restart_seconds|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_team_ready ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_team_ready|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_win ===&lt;br /&gt;
{{qnotice|When a team wins a round}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_win|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|full_round}}&lt;br /&gt;
{{hl2msg|float|round_time}}&lt;br /&gt;
{{hl2msg|short|losing_team_num_caps}}&lt;br /&gt;
{{hl2msg|byte|was_sudden_death}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_update_timer ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_update_timer|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_stalemate ===&lt;br /&gt;
{{qnotice|When a game ends in a stalemate}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_stalemate|string}}&lt;br /&gt;
{{hl2msg|byte|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_begin ===&lt;br /&gt;
{{qnotice|When an overtime round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_end ===&lt;br /&gt;
{{qnotice|When an overtime round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_begin ===&lt;br /&gt;
{{qnotice|When a sudden death round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_end ===&lt;br /&gt;
{{qnotice|When a sudden death round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_game_over ===&lt;br /&gt;
{{qnotice|When a teamplay game ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_broadcast_audio ===&lt;br /&gt;
{{qnotice|Broadcast an audio file. (0 for team = all)}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_broadcast_audio|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|sound}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_timer_flash ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_timer_flash|string}}&lt;br /&gt;
{{hl2msg|short|time_remaining}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_time_time_added ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_time_time_added|string}}&lt;br /&gt;
{{hl2msg|short|timer}}&lt;br /&gt;
{{hl2msg|short|seconds_added}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_startcapture ===&lt;br /&gt;
{{qnotice|When a point is beginning to be captured}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_startcapture|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_captured ===&lt;br /&gt;
{{qnotice|When a control point is captured by a team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_captured|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_capture_blocked ===&lt;br /&gt;
{{qnotice|When a player blocks the capture of a control point}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_capture_blocked|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|blocker}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_flag_event ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_flag_event|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|eventtype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_win_panel ===&lt;br /&gt;
{{qnotice|When the win-game panel is displayed}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_win_panel|string}}&lt;br /&gt;
{{hl2msg|byte|panel_style}}&lt;br /&gt;
{{hl2msg|byte|winning_team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|blue_score}}&lt;br /&gt;
{{hl2msg|short|red_score}}&lt;br /&gt;
{{hl2msg|short|blue_score_prev}}&lt;br /&gt;
{{hl2msg|short|red_score_prev}}&lt;br /&gt;
{{hl2msg|short|round_complete}}&lt;br /&gt;
{{hl2msg|short|round_remaining}}&lt;br /&gt;
{{hl2msg|short|player_1}}&lt;br /&gt;
{{hl2msg|short|player_1_points}}&lt;br /&gt;
{{hl2msg|short|player_2}}&lt;br /&gt;
{{hl2msg|short|player_2_points}}&lt;br /&gt;
{{hl2msg|short|player_3}}&lt;br /&gt;
{{hl2msg|short|player_3_points}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_teambalanced_player ===&lt;br /&gt;
{{qnotice|When a player is balanced to another team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_balanced_player|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== show_freezepanel ===&lt;br /&gt;
{{qnotice|When the death-snapshot panel is shown}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|show_freezepanel|string}}&lt;br /&gt;
{{hl2msg|short|killer}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== hide_freezepanel ===&lt;br /&gt;
{{qnotice|When the death-snapshot panel is hidden}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|hide_freezepanel|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== freezecam_started ===&lt;br /&gt;
{{qnotice|When a player enters the death-snapshot view}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|freezecam_started|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeteam ===&lt;br /&gt;
{{qnotice|When a LAN player changes team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changeteam|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeclass ===&lt;br /&gt;
{{qnotice|When a LAN player changes class}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changeclass|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== building_info_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|building_info_changed|string}}&lt;br /&gt;
{{hl2msg|byte|building_type}}&lt;br /&gt;
{{hl2msg|byte|remove}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changedisguise ===&lt;br /&gt;
{{qnotice|Whena LAN player changes their disguise as a spy}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changedisguise|string}}&lt;br /&gt;
{{hl2msg|bool|disguised}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_account_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_account_changed|string}}&lt;br /&gt;
{{hl2msg|short|old_value}}&lt;br /&gt;
{{hl2msg|short|new_value}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spy_pda_reset ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spy_pda_reset|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== flagstatus_update ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|flagstatus_update|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_stats_updated ===&lt;br /&gt;
{{qnotice|When a players stats are updated}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_stats_updated|string}}&lt;br /&gt;
{{hl2msg|bool|forceupload}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== playing_commentary ===&lt;br /&gt;
{{qnotice|When a commentary is being played}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|playing_commentary|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_chargedeployed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_chargedeployed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_builtobject ===&lt;br /&gt;
{{qnotice|When a player builds an object}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_builtobject|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|byte|object}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== achievement_earned ===&lt;br /&gt;
{{qnotice|When a player earns an achievement}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg||string}}&lt;br /&gt;
{{hl2msg|byte|player}}&lt;br /&gt;
{{hl2msg|short|achievement}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spec_target_updated ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spec_target_updated|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tournament_stateupdate ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tournament_stateupdate|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5559</id>
		<title>Team Fortress 2 Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5559"/>
		<updated>2008-02-01T19:22:36Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* localplayer_changeteam */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== intro_finish ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_finish|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== intro_nextcamera ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_nextcamera|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_changeclass ===&lt;br /&gt;
{{qnotice|When a player changes their class}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_changeclass|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|class}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_death ===&lt;br /&gt;
{{qnotice|When a player dies}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_death|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|long|damagebits}}&lt;br /&gt;
{{hl2msg|short|customkill}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|short|dominated}}&lt;br /&gt;
{{hl2msg|short|assister_dominated}}&lt;br /&gt;
{{hl2msg|short|revenge}}&lt;br /&gt;
{{hl2msg|short|assister_revenge}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== object_destroyed ===&lt;br /&gt;
{{qnotice|When a player destroys an object}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|object_destroyed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|short|objecttype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|long|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_game_over ===&lt;br /&gt;
{{qnotice|When a tf game ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== ctf_flag_captured ===&lt;br /&gt;
{{qnotice|When a flag is captured by a player}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|ctf_flag_captured|string}}&lt;br /&gt;
{{hl2msg|short|capping_team}}&lt;br /&gt;
{{hl2msg|short|capping_team_score}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_initialized ===&lt;br /&gt;
{{qnotice|When a player begins to capture a control point}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_initialized|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateimages ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateimages|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatelayout ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatelayout|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatecapping ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatecapping|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateowner ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateowner|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_starttouch ===&lt;br /&gt;
{{qnotice|When a player enters a capture point zone}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_starttouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_endtouch ===&lt;br /&gt;
{{qnotice|When a player leaves a capture point zone}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_endtouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_pulse_element ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_pulse_element|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture_mult ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture_mult|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_start ===&lt;br /&gt;
{{qnotice|When a round starts}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_start|string}}&lt;br /&gt;
{{hl2msg|bool|full_reset}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_active ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_begins ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_begins|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_ends ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_ends|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_abouttoend ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round is about to end}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_abouttoend|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_restart_round ===&lt;br /&gt;
{{qnotice|When a round is restarted}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_restart_round|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_ready_restart ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_ready_restart|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_restart_seconds ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_restart_seconds|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_team_ready ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_team_ready|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_win ===&lt;br /&gt;
{{qnotice|When a team wins a round}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_win|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|full_round}}&lt;br /&gt;
{{hl2msg|float|round_time}}&lt;br /&gt;
{{hl2msg|short|losing_team_num_caps}}&lt;br /&gt;
{{hl2msg|byte|was_sudden_death}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_update_timer ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_update_timer|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_stalemate ===&lt;br /&gt;
{{qnotice|When a game ends in a stalemate}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_stalemate|string}}&lt;br /&gt;
{{hl2msg|byte|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_begin ===&lt;br /&gt;
{{qnotice|When an overtime round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_end ===&lt;br /&gt;
{{qnotice|When an overtime round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_begin ===&lt;br /&gt;
{{qnotice|When a sudden death round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_end ===&lt;br /&gt;
{{qnotice|When a sudden death round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_game_over ===&lt;br /&gt;
{{qnotice|When a teamplay game ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_broadcast_audio ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_broadcast_audio|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|sound}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_timer_flash ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_timer_flash|string}}&lt;br /&gt;
{{hl2msg|short|time_remaining}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_time_time_added ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_time_time_added|string}}&lt;br /&gt;
{{hl2msg|short|timer}}&lt;br /&gt;
{{hl2msg|short|seconds_added}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_startcapture ===&lt;br /&gt;
{{qnotice|When a point is beginning to be captured}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_startcapture|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_captured ===&lt;br /&gt;
{{qnotice|When a control point is captured by a team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_captured|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_capture_blocked ===&lt;br /&gt;
{{qnotice|When a player blocks the capture of a control point}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_capture_blocked|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|blocker}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_flag_event ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_flag_event|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|eventtype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_win_panel ===&lt;br /&gt;
{{qnotice|When the win-game panel is displayed}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_win_panel|string}}&lt;br /&gt;
{{hl2msg|byte|panel_style}}&lt;br /&gt;
{{hl2msg|byte|winning_team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|blue_score}}&lt;br /&gt;
{{hl2msg|short|red_score}}&lt;br /&gt;
{{hl2msg|short|blue_score_prev}}&lt;br /&gt;
{{hl2msg|short|red_score_prev}}&lt;br /&gt;
{{hl2msg|short|round_complete}}&lt;br /&gt;
{{hl2msg|short|round_remaining}}&lt;br /&gt;
{{hl2msg|short|player_1}}&lt;br /&gt;
{{hl2msg|short|player_1_points}}&lt;br /&gt;
{{hl2msg|short|player_2}}&lt;br /&gt;
{{hl2msg|short|player_2_points}}&lt;br /&gt;
{{hl2msg|short|player_3}}&lt;br /&gt;
{{hl2msg|short|player_3_points}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_balanced_player ===&lt;br /&gt;
{{qnotice|When a player is balanced to another team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_balanced_player|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== show_freezepanel ===&lt;br /&gt;
{{qnotice|When the death-snapshot panel is shown}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|show_freezepanel|string}}&lt;br /&gt;
{{hl2msg|short|killer}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== hide_freezepanel ===&lt;br /&gt;
{{qnotice|When the death-snapshot panel is hidden}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|hide_freezepanel|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== freezecam_started ===&lt;br /&gt;
{{qnotice|When a player enters the death-snapshot view}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|freezecam_started|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeteam ===&lt;br /&gt;
{{qnotice|When a LAN player changes team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changeteam|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeclass ===&lt;br /&gt;
{{qnotice|When a LAN player changes class}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changeclass|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== building_info_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|building_info_changed|string}}&lt;br /&gt;
{{hl2msg|byte|building_type}}&lt;br /&gt;
{{hl2msg|byte|remove}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changedisguise ===&lt;br /&gt;
{{qnotice|Whena LAN player changes their disguise as a spy}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changedisguise|string}}&lt;br /&gt;
{{hl2msg|bool|disguised}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_account_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_account_changed|string}}&lt;br /&gt;
{{hl2msg|short|old_value}}&lt;br /&gt;
{{hl2msg|short|new_value}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spy_pda_reset ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spy_pda_reset|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== flagstatus_update ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|flagstatus_update|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_stats_updated ===&lt;br /&gt;
{{qnotice|When a players stats are updated}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_stats_updated|string}}&lt;br /&gt;
{{hl2msg|bool|forceupload}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== playing_commentary ===&lt;br /&gt;
{{qnotice|When a commentary is being played}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|playing_commentary|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_chargedeployed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_chargedeployed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_builtobject ===&lt;br /&gt;
{{qnotice|When a player builds an object}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_builtobject|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|byte|object}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== achievement_earned ===&lt;br /&gt;
{{qnotice|When a player earns an achievement}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg||string}}&lt;br /&gt;
{{hl2msg|byte|player}}&lt;br /&gt;
{{hl2msg|short|achievement}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spec_target_updated ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spec_target_updated|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5541</id>
		<title>Team Fortress 2 Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5541"/>
		<updated>2008-01-23T20:39:45Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== intro_finish ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_finish|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== intro_nextcamera ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_nextcamera|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_changeclass ===&lt;br /&gt;
{{qnotice|When a player changes their class}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_changeclass|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|class}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_death ===&lt;br /&gt;
{{qnotice|When a player dies}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_death|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|long|damagebits}}&lt;br /&gt;
{{hl2msg|short|customkill}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|short|dominated}}&lt;br /&gt;
{{hl2msg|short|assister_dominated}}&lt;br /&gt;
{{hl2msg|short|revenge}}&lt;br /&gt;
{{hl2msg|short|assister_revenge}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== object_destroyed ===&lt;br /&gt;
{{qnotice|When a player destroys an object}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|object_destroyed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|short|objecttype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|long|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_game_over ===&lt;br /&gt;
{{qnotice|When a tf game ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== ctf_flag_captured ===&lt;br /&gt;
{{qnotice|When a flag is captured by a player}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|ctf_flag_captured|string}}&lt;br /&gt;
{{hl2msg|short|capping_team}}&lt;br /&gt;
{{hl2msg|short|capping_team_score}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_initialized ===&lt;br /&gt;
{{qnotice|When a player begins to capture a control point}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_initialized|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateimages ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateimages|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatelayout ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatelayout|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatecapping ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatecapping|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateowner ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateowner|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_starttouch ===&lt;br /&gt;
{{qnotice|When a player enters a capture point zone}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_starttouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_endtouch ===&lt;br /&gt;
{{qnotice|When a player leaves a capture point zone}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_endtouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_pulse_element ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_pulse_element|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture_mult ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture_mult|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_start ===&lt;br /&gt;
{{qnotice|When a round starts}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_start|string}}&lt;br /&gt;
{{hl2msg|bool|full_reset}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_active ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_begins ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_begins|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_ends ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_ends|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_abouttoend ===&lt;br /&gt;
{{qnotice|When the &amp;quot;waiting for players&amp;quot; pre-round is about to end}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_abouttoend|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_restart_round ===&lt;br /&gt;
{{qnotice|When a round is restarted}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_restart_round|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_ready_restart ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_ready_restart|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_restart_seconds ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_restart_seconds|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_team_ready ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_team_ready|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_win ===&lt;br /&gt;
{{qnotice|When a team wins a round}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_win|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|full_round}}&lt;br /&gt;
{{hl2msg|float|round_time}}&lt;br /&gt;
{{hl2msg|short|losing_team_num_caps}}&lt;br /&gt;
{{hl2msg|byte|was_sudden_death}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_update_timer ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_update_timer|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_stalemate ===&lt;br /&gt;
{{qnotice|When a game ends in a stalemate}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_stalemate|string}}&lt;br /&gt;
{{hl2msg|byte|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_begin ===&lt;br /&gt;
{{qnotice|When an overtime round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_end ===&lt;br /&gt;
{{qnotice|When an overtime round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_begin ===&lt;br /&gt;
{{qnotice|When a sudden death round begins}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_end ===&lt;br /&gt;
{{qnotice|When a sudden death round ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_game_over ===&lt;br /&gt;
{{qnotice|When a teamplay game ends}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_broadcast_audio ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_broadcast_audio|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|sound}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_timer_flash ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_timer_flash|string}}&lt;br /&gt;
{{hl2msg|short|time_remaining}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_time_time_added ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_time_time_added|string}}&lt;br /&gt;
{{hl2msg|short|timer}}&lt;br /&gt;
{{hl2msg|short|seconds_added}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_startcapture ===&lt;br /&gt;
{{qnotice|When a point is beginning to be captured}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_startcapture|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_captured ===&lt;br /&gt;
{{qnotice|When a control point is captured by a team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_captured|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_capture_blocked ===&lt;br /&gt;
{{qnotice|When a player blocks the capture of a control point}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_capture_blocked|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|blocker}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_flag_event ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_flag_event|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|eventtype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_win_panel ===&lt;br /&gt;
{{qnotice|When the win-game panel is displayed}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_win_panel|string}}&lt;br /&gt;
{{hl2msg|byte|panel_style}}&lt;br /&gt;
{{hl2msg|byte|winning_team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|blue_score}}&lt;br /&gt;
{{hl2msg|short|red_score}}&lt;br /&gt;
{{hl2msg|short|blue_score_prev}}&lt;br /&gt;
{{hl2msg|short|red_score_prev}}&lt;br /&gt;
{{hl2msg|short|round_complete}}&lt;br /&gt;
{{hl2msg|short|round_remaining}}&lt;br /&gt;
{{hl2msg|short|player_1}}&lt;br /&gt;
{{hl2msg|short|player_1_points}}&lt;br /&gt;
{{hl2msg|short|player_2}}&lt;br /&gt;
{{hl2msg|short|player_2_points}}&lt;br /&gt;
{{hl2msg|short|player_3}}&lt;br /&gt;
{{hl2msg|short|player_3_points}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_balanced_player ===&lt;br /&gt;
{{qnotice|When a player is balanced to another team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_balanced_player|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== show_freezepanel ===&lt;br /&gt;
{{qnotice|When the death-snapshot panel is shown}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|show_freezepanel|string}}&lt;br /&gt;
{{hl2msg|short|killer}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== hide_freezepanel ===&lt;br /&gt;
{{qnotice|When the death-snapshot panel is hidden}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|hide_freezepanel|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== freezecam_started ===&lt;br /&gt;
{{qnotice|When a player enters the death-snapshot view}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|freezecam_started|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeteam ===&lt;br /&gt;
{{qnotice|When a LAN player changes team}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_cahangeteam|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeclass ===&lt;br /&gt;
{{qnotice|When a LAN player changes class}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changeclass|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== building_info_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|building_info_changed|string}}&lt;br /&gt;
{{hl2msg|byte|building_type}}&lt;br /&gt;
{{hl2msg|byte|remove}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changedisguise ===&lt;br /&gt;
{{qnotice|Whena LAN player changes their disguise as a spy}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changedisguise|string}}&lt;br /&gt;
{{hl2msg|bool|disguised}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_account_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_account_changed|string}}&lt;br /&gt;
{{hl2msg|short|old_value}}&lt;br /&gt;
{{hl2msg|short|new_value}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spy_pda_reset ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spy_pda_reset|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== flagstatus_update ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|flagstatus_update|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_stats_updated ===&lt;br /&gt;
{{qnotice|When a players stats are updated}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_stats_updated|string}}&lt;br /&gt;
{{hl2msg|bool|forceupload}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== playing_commentary ===&lt;br /&gt;
{{qnotice|When a commentary is being played}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|playing_commentary|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_chargedeployed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_chargedeployed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_builtobject ===&lt;br /&gt;
{{qnotice|When a player builds an object}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_builtobject|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|byte|object}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== achievement_earned ===&lt;br /&gt;
{{qnotice|When a player earns an achievement}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg||string}}&lt;br /&gt;
{{hl2msg|byte|player}}&lt;br /&gt;
{{hl2msg|short|achievement}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spec_target_updated ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spec_target_updated|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Game_Events_(Source)&amp;diff=5535</id>
		<title>Game Events (Source)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Game_Events_(Source)&amp;diff=5535"/>
		<updated>2008-01-21T19:45:44Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are all the games that the Source engine covers (that we could find).&lt;br /&gt;
* [[Generic Source Events]]&lt;br /&gt;
* [[Generic Source Server Events]]&lt;br /&gt;
* [[Counter-Strike: Source Events]]&lt;br /&gt;
* [[Day of Defeat: Source Events]]&lt;br /&gt;
* [[Half-Life 2: Deathmatch Events]]&lt;br /&gt;
* [[Half-Life 2: Capture the Flag Events]]&lt;br /&gt;
* [[Dystopia Events]]&lt;br /&gt;
* [[Pirates, Vikings, Knights II Events]]&lt;br /&gt;
* [[SourceForts Events]]&lt;br /&gt;
* [[Hidden: Source Events]]&lt;br /&gt;
* [[Perfect Dark: Source Events]]&lt;br /&gt;
* [[Iron Grip: Source  Events]]&lt;br /&gt;
* [[Insurgency: Source  Events]]&lt;br /&gt;
* [[Garry's Mod Events]]&lt;br /&gt;
* [[Team Fortress 2 Events]]&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
[[User:Shane|Shane]] - Writing some of the events pages and organization and general wikiknowhow&amp;lt;br /&amp;gt;&lt;br /&gt;
[[User:FlyingMongoose|FlyingMongoose]] - Writing a lot of the events pages&amp;lt;br /&amp;gt;&lt;br /&gt;
[[User:sslice|sslice]] - For creating a wikitizer application for these events&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Metamod:Source Development]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5533</id>
		<title>Team Fortress 2 Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5533"/>
		<updated>2008-01-21T19:42:31Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* achievement_earned */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== intro_finish ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_finish|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== intro_nextcamera ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_nextcamera|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_changeclass ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_changeclass|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|class}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_death ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_death|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|long|damagebits}}&lt;br /&gt;
{{hl2msg|short|customkill}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|short|dominated}}&lt;br /&gt;
{{hl2msg|short|assister_dominated}}&lt;br /&gt;
{{hl2msg|short|revenge}}&lt;br /&gt;
{{hl2msg|short|assister_revenge}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== object_destroyed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|object_destroyed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|short|objecttype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|long|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_game_over ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== ctf_flag_captured ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|ctf_flag_captured|string}}&lt;br /&gt;
{{hl2msg|short|capping_team}}&lt;br /&gt;
{{hl2msg|short|capping_team_score}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_initialized ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_initialized|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateimages ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateimages|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatelayout ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatelayout|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatecapping ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatecapping|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateowner ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateowner|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_starttouch ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_starttouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_endtouch ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_endtouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_pulse_element ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_pulse_element|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture_mult ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture_mult|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_start ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_start|string}}&lt;br /&gt;
{{hl2msg|bool|full_reset}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_active ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_begins ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_begins|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_ends ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_ends|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_abouttoend ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_abouttoend|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_restart_round ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_restart_round|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_ready_restart ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_ready_restart|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_restart_seconds ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_restart_seconds|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_team_ready ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_team_ready|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_win ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_win|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|full_round}}&lt;br /&gt;
{{hl2msg|float|round_time}}&lt;br /&gt;
{{hl2msg|short|losing_team_num_caps}}&lt;br /&gt;
{{hl2msg|byte|was_sudden_death}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_update_timer ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_update_timer|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_stalemate ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_stalemate|string}}&lt;br /&gt;
{{hl2msg|byte|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_begin ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_end ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_begin ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_end ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_game_over ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_broadcast_audio ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_broadcast_audio|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|sound}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_timer_flash ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_timer_flash|string}}&lt;br /&gt;
{{hl2msg|short|time_remaining}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_time_time_added ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_time_time_added|string}}&lt;br /&gt;
{{hl2msg|short|timer}}&lt;br /&gt;
{{hl2msg|short|seconds_added}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_startcapture ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_startcapture|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_captured ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_captured|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_capture_blocked ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_capture_blocked|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|blocker}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_flag_event ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_flag_event|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|eventtype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_win_panel ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_win_panel|string}}&lt;br /&gt;
{{hl2msg|byte|panel_style}}&lt;br /&gt;
{{hl2msg|byte|winning_team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|blue_score}}&lt;br /&gt;
{{hl2msg|short|red_score}}&lt;br /&gt;
{{hl2msg|short|blue_score_prev}}&lt;br /&gt;
{{hl2msg|short|red_score_prev}}&lt;br /&gt;
{{hl2msg|short|round_complete}}&lt;br /&gt;
{{hl2msg|short|round_remaining}}&lt;br /&gt;
{{hl2msg|short|player_1}}&lt;br /&gt;
{{hl2msg|short|player_1_points}}&lt;br /&gt;
{{hl2msg|short|player_2}}&lt;br /&gt;
{{hl2msg|short|player_2_points}}&lt;br /&gt;
{{hl2msg|short|player_3}}&lt;br /&gt;
{{hl2msg|short|player_3_points}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_balanced_player ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_balanced_player|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== show_freezepanel ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|show_freezepanel|string}}&lt;br /&gt;
{{hl2msg|short|killer}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== hide_freezepanel ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|hide_freezepanel|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== freezecam_started ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|freezecam_started|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_cahangeteam ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_cahangeteam|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeclass ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changeclass|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== building_info_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|building_info_changed|string}}&lt;br /&gt;
{{hl2msg|byte|building_type}}&lt;br /&gt;
{{hl2msg|byte|remove}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changedisguise ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changedisguise|string}}&lt;br /&gt;
{{hl2msg|bool|disguised}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_account_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_account_changed|string}}&lt;br /&gt;
{{hl2msg|short|old_value}}&lt;br /&gt;
{{hl2msg|short|new_value}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spy_pda_reset ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spy_pda_reset|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== flagstatus_update ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|flagstatus_update|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_stats_updated ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_stats_updated|string}}&lt;br /&gt;
{{hl2msg|bool|forceupload}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== playing_commentary ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|playing_commentary|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_chargedeployed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_chargedeployed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_builtobject ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_builtobject|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|byte|object}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== achievement_earned ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg||string}}&lt;br /&gt;
{{hl2msg|byte|player}}&lt;br /&gt;
{{hl2msg|short|achievement}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spec_target_updated ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spec_target_updated|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5532</id>
		<title>Team Fortress 2 Events</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Team_Fortress_2_Events&amp;diff=5532"/>
		<updated>2008-01-21T19:39:35Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: New page: === intro_finish === {{qnotice|None}}&amp;lt;br&amp;gt; {{begin-hl2msg|intro_finish|string}} {{hl2msg|short|player}} {{end-hl2msg}}  === intro_nextcamera === {{qnotice|None}}&amp;lt;br&amp;gt; {{begin-hl2msg|intro_ne...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== intro_finish ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_finish|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== intro_nextcamera ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|intro_nextcamera|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_changeclass ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_changeclass|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|class}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_death ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_death|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|long|damagebits}}&lt;br /&gt;
{{hl2msg|short|customkill}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|short|dominated}}&lt;br /&gt;
{{hl2msg|short|assister_dominated}}&lt;br /&gt;
{{hl2msg|short|revenge}}&lt;br /&gt;
{{hl2msg|short|assister_revenge}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== object_destroyed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|object_destroyed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|short|attacker}}&lt;br /&gt;
{{hl2msg|short|assister}}&lt;br /&gt;
{{hl2msg|string|weapon}}&lt;br /&gt;
{{hl2msg|short|objecttype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|long|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== tf_game_over ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|tf_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== ctf_flag_captured ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|ctf_flag_captured|string}}&lt;br /&gt;
{{hl2msg|short|capping_team}}&lt;br /&gt;
{{hl2msg|short|capping_team_score}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_initialized ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_initialized|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateimages ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateimages|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatelayout ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatelayout|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updatecapping ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updatecapping|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_updateowner ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_updateowner|string}}&lt;br /&gt;
{{hl2msg|short|index}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_starttouch ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_starttouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_endtouch ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_endtouch|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|area}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_pulse_element ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_pulse_element|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== controlpoint_fake_capture_mult ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|controlpoint_fake_capture_mult|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|int_data}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_start ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_start|string}}&lt;br /&gt;
{{hl2msg|bool|full_reset}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_active ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_begins ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_begins|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_ends ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_ends|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_waiting_abouttoend ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_waiting_abouttoend|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_restart_round ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_restart_round|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_ready_restart ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_ready_restart|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_restart_seconds ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_restart_seconds|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_team_ready ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_team_ready|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_win ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_win|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|full_round}}&lt;br /&gt;
{{hl2msg|float|round_time}}&lt;br /&gt;
{{hl2msg|short|losing_team_num_caps}}&lt;br /&gt;
{{hl2msg|byte|was_sudden_death}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_update_timer ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_update_timer|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_round_stalemate ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_round_stalemate|string}}&lt;br /&gt;
{{hl2msg|byte|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_begin ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_overtime_end ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_overtime_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_begin ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_begin|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_suddendeath_end ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_suddendeath_end|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_game_over ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_game_over|string}}&lt;br /&gt;
{{hl2msg|string|reason}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_map_time_remaining ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_map_time_remaining|string}}&lt;br /&gt;
{{hl2msg|short|seconds}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_broadcast_audio ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_broadcast_audio|string}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|sound}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_timer_flash ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_timer_flash|string}}&lt;br /&gt;
{{hl2msg|short|time_remaining}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_time_time_added ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_time_time_added|string}}&lt;br /&gt;
{{hl2msg|short|timer}}&lt;br /&gt;
{{hl2msg|short|seconds_added}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_startcapture ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_startcapture|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_point_captured ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_point_captured|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_capture_blocked ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_capture_blocked|string}}&lt;br /&gt;
{{hl2msg|byte|cp}}&lt;br /&gt;
{{hl2msg|string|cpname}}&lt;br /&gt;
{{hl2msg|byte|blocker}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_flag_event ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_flag_event|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|short|eventtype}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_win_panel ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_win_panel|string}}&lt;br /&gt;
{{hl2msg|byte|panel_style}}&lt;br /&gt;
{{hl2msg|byte|winning_team}}&lt;br /&gt;
{{hl2msg|byte|winreason}}&lt;br /&gt;
{{hl2msg|string|cappers}}&lt;br /&gt;
{{hl2msg|short|flagcaplimit}}&lt;br /&gt;
{{hl2msg|short|blue_score}}&lt;br /&gt;
{{hl2msg|short|red_score}}&lt;br /&gt;
{{hl2msg|short|blue_score_prev}}&lt;br /&gt;
{{hl2msg|short|red_score_prev}}&lt;br /&gt;
{{hl2msg|short|round_complete}}&lt;br /&gt;
{{hl2msg|short|round_remaining}}&lt;br /&gt;
{{hl2msg|short|player_1}}&lt;br /&gt;
{{hl2msg|short|player_1_points}}&lt;br /&gt;
{{hl2msg|short|player_2}}&lt;br /&gt;
{{hl2msg|short|player_2_points}}&lt;br /&gt;
{{hl2msg|short|player_3}}&lt;br /&gt;
{{hl2msg|short|player_3_points}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== teamplay_balanced_player ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|teamplay_balanced_player|string}}&lt;br /&gt;
{{hl2msg|short|player}}&lt;br /&gt;
{{hl2msg|byte|team}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== show_freezepanel ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|show_freezepanel|string}}&lt;br /&gt;
{{hl2msg|short|killer}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== hide_freezepanel ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|hide_freezepanel|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== freezecam_started ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|freezecam_started|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_cahangeteam ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_cahangeteam|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changeclass ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changeclass|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== building_info_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|building_info_changed|string}}&lt;br /&gt;
{{hl2msg|byte|building_type}}&lt;br /&gt;
{{hl2msg|byte|remove}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== localplayer_changedisguise ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|localplayer_changedisguise|string}}&lt;br /&gt;
{{hl2msg|bool|disguised}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_account_changed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_account_changed|string}}&lt;br /&gt;
{{hl2msg|short|old_value}}&lt;br /&gt;
{{hl2msg|short|new_value}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spy_pda_reset ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spy_pda_reset|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== flagstatus_update ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|flagstatus_update|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_stats_updated ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_stats_updated|string}}&lt;br /&gt;
{{hl2msg|bool|forceupload}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== playing_commentary ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|playing_commentary|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_chargedeployed ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_chargedeployed|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== player_builtobject ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|player_builtobject|string}}&lt;br /&gt;
{{hl2msg|short|userid}}&lt;br /&gt;
{{hl2msg|byte|object}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== achievement_earned ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg||string}}&lt;br /&gt;
{{hl2msg||}}&lt;br /&gt;
{{end-hl2msg}}&lt;br /&gt;
&lt;br /&gt;
=== spec_target_updated ===&lt;br /&gt;
{{qnotice|None}}&amp;lt;br&amp;gt;&lt;br /&gt;
{{begin-hl2msg|spec_target_updated|string}}&lt;br /&gt;
{{end-hl2msg}}&lt;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=5437</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=5437"/>
		<updated>2007-11-26T04:11:44Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Declaration */&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]].  The author of this article uses [http://www.crimsoneditor.com/ Crimson Editor] to write plugins.  Other possibilities are [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], or any other text editor you're comfortable with.&lt;br /&gt;
&lt;br /&gt;
=Plugin Structure=&lt;br /&gt;
Almost all plugins follow have the same three elements:&lt;br /&gt;
*'''Includes''' - Allows you to access the SourceMod API, and if you desire, API from external SourceMod extensions/plugins.&lt;br /&gt;
*'''Info''' - Public information about your plugin.&lt;br /&gt;
*'''Startup''' - A function which performs start-up routines in your plugin.&lt;br /&gt;
&lt;br /&gt;
A skeletal plugin structure looks like:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&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.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;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The information portion is a special syntax construct.  You cannot change any of the keywords, or the &amp;lt;tt&amp;gt;public Plugin:myinfo&amp;lt;/tt&amp;gt; declaration.  The best idea is to copy and paste this skeletal structure and modify the strings to get started.&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''' include files, which is &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''' include files, which if used, will add a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' include files, which if used, will add 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;
&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=469&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.  The default functionality for entering console commands is to reply that they are unknown.  To block this functionality, you must return a new action:&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.&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;
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;
	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)&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).  Since clients are disconnected on mapchange, their userids change as well.  Userids are a handy way to check if a client's connection status has changed. &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 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;
=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;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=5436</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=5436"/>
		<updated>2007-11-26T04:10:43Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: &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]].  The author of this article uses [http://www.crimsoneditor.com/ Crimson Editor] to write plugins.  Other possibilities are [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], or any other text editor you're comfortable with.&lt;br /&gt;
&lt;br /&gt;
=Plugin Structure=&lt;br /&gt;
Almost all plugins follow have the same three elements:&lt;br /&gt;
*'''Includes''' - Allows you to access the SourceMod API, and if you desire, API from external SourceMod extensions/plugins.&lt;br /&gt;
*'''Info''' - Public information about your plugin.&lt;br /&gt;
*'''Startup''' - A function which performs start-up routines in your plugin.&lt;br /&gt;
&lt;br /&gt;
A skeletal plugin structure looks like:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&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.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;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The information portion is a special syntax construct.  You cannot change any of the keywords, or the &amp;lt;tt&amp;gt;public Plugin:myinfo&amp;lt;/tt&amp;gt; declaration.  The best idea is to copy and paste this skeletal structure and modify the strings to get started.&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''' include files, which is &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''' include files, which if used, will add a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' include files, which if used, will add 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;
&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=430&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.  The default functionality for entering console commands is to reply that they are unknown.  To block this functionality, you must return a new action:&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.&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;
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;
	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)&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).  Since clients are disconnected on mapchange, their userids change as well.  Userids are a handy way to check if a client's connection status has changed. &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 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;
=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;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=5435</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=5435"/>
		<updated>2007-11-26T04:09:12Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Multiple Targets */&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]].  The author of this article uses [http://www.crimsoneditor.com/ Crimson Editor] to write plugins.  Other possibilities are [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], or any other text editor you're comfortable with.&lt;br /&gt;
&lt;br /&gt;
=Plugin Structure=&lt;br /&gt;
Almost all plugins follow have the same three elements:&lt;br /&gt;
*'''Includes''' - Allows you to access the SourceMod API, and if you desire, API from external SourceMod extensions/plugins.&lt;br /&gt;
*'''Info''' - Public information about your plugin.&lt;br /&gt;
*'''Startup''' - A function which performs start-up routines in your plugin.&lt;br /&gt;
&lt;br /&gt;
A skeletal plugin structure looks like:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&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.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;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The information portion is a special syntax construct.  You cannot change any of the keywords, or the &amp;lt;tt&amp;gt;public Plugin:myinfo&amp;lt;/tt&amp;gt; declaration.  The best idea is to copy and paste this skeletal structure and modify the strings to get started.&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''' include files, which is &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''' include files, which if used, will add a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' include files, which if used, will add 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;
&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=430&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.  The default functionality for entering console commands is to reply that they are unknown.  To block this functionality, you must return a new action:&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.&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;
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;
	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)&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=356&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).  Since clients are disconnected on mapchange, their userids change as well.  Userids are a handy way to check if a client's connection status has changed. &lt;br /&gt;
&lt;br /&gt;
SourceMod provides two functions for userids: [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=399&amp;amp; GetClientOfUserId()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=361&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 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;
=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;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=5434</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=5434"/>
		<updated>2007-11-26T04:08:43Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Showing Activity, Logging */&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]].  The author of this article uses [http://www.crimsoneditor.com/ Crimson Editor] to write plugins.  Other possibilities are [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], or any other text editor you're comfortable with.&lt;br /&gt;
&lt;br /&gt;
=Plugin Structure=&lt;br /&gt;
Almost all plugins follow have the same three elements:&lt;br /&gt;
*'''Includes''' - Allows you to access the SourceMod API, and if you desire, API from external SourceMod extensions/plugins.&lt;br /&gt;
*'''Info''' - Public information about your plugin.&lt;br /&gt;
*'''Startup''' - A function which performs start-up routines in your plugin.&lt;br /&gt;
&lt;br /&gt;
A skeletal plugin structure looks like:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&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.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;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The information portion is a special syntax construct.  You cannot change any of the keywords, or the &amp;lt;tt&amp;gt;public Plugin:myinfo&amp;lt;/tt&amp;gt; declaration.  The best idea is to copy and paste this skeletal structure and modify the strings to get started.&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''' include files, which is &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''' include files, which if used, will add a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' include files, which if used, will add 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;
&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=430&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.  The default functionality for entering console commands is to reply that they are unknown.  To block this functionality, you must return a new action:&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.&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=767&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;
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;
	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)&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=356&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).  Since clients are disconnected on mapchange, their userids change as well.  Userids are a handy way to check if a client's connection status has changed. &lt;br /&gt;
&lt;br /&gt;
SourceMod provides two functions for userids: [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=399&amp;amp; GetClientOfUserId()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=361&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 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;
=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;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=5433</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=5433"/>
		<updated>2007-11-26T04:08:11Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* ConVars */&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]].  The author of this article uses [http://www.crimsoneditor.com/ Crimson Editor] to write plugins.  Other possibilities are [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], or any other text editor you're comfortable with.&lt;br /&gt;
&lt;br /&gt;
=Plugin Structure=&lt;br /&gt;
Almost all plugins follow have the same three elements:&lt;br /&gt;
*'''Includes''' - Allows you to access the SourceMod API, and if you desire, API from external SourceMod extensions/plugins.&lt;br /&gt;
*'''Info''' - Public information about your plugin.&lt;br /&gt;
*'''Startup''' - A function which performs start-up routines in your plugin.&lt;br /&gt;
&lt;br /&gt;
A skeletal plugin structure looks like:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&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.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;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The information portion is a special syntax construct.  You cannot change any of the keywords, or the &amp;lt;tt&amp;gt;public Plugin:myinfo&amp;lt;/tt&amp;gt; declaration.  The best idea is to copy and paste this skeletal structure and modify the strings to get started.&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''' include files, which is &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''' include files, which if used, will add a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' include files, which if used, will add 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;
&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=430&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.  The default functionality for entering console commands is to reply that they are unknown.  To block this functionality, you must return a new action:&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.&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=707&amp;amp; LogAction()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=763&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;
&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=767&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;
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;
	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)&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=356&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).  Since clients are disconnected on mapchange, their userids change as well.  Userids are a handy way to check if a client's connection status has changed. &lt;br /&gt;
&lt;br /&gt;
SourceMod provides two functions for userids: [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=399&amp;amp; GetClientOfUserId()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=361&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 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;
=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;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=5432</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=5432"/>
		<updated>2007-11-26T04:07:41Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Implementation */&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]].  The author of this article uses [http://www.crimsoneditor.com/ Crimson Editor] to write plugins.  Other possibilities are [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], or any other text editor you're comfortable with.&lt;br /&gt;
&lt;br /&gt;
=Plugin Structure=&lt;br /&gt;
Almost all plugins follow have the same three elements:&lt;br /&gt;
*'''Includes''' - Allows you to access the SourceMod API, and if you desire, API from external SourceMod extensions/plugins.&lt;br /&gt;
*'''Info''' - Public information about your plugin.&lt;br /&gt;
*'''Startup''' - A function which performs start-up routines in your plugin.&lt;br /&gt;
&lt;br /&gt;
A skeletal plugin structure looks like:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&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.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;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The information portion is a special syntax construct.  You cannot change any of the keywords, or the &amp;lt;tt&amp;gt;public Plugin:myinfo&amp;lt;/tt&amp;gt; declaration.  The best idea is to copy and paste this skeletal structure and modify the strings to get started.&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''' include files, which is &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''' include files, which if used, will add a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' include files, which if used, will add 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;
&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=430&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.  The default functionality for entering console commands is to reply that they are unknown.  To block this functionality, you must return a new action:&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.&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=558&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;
&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=707&amp;amp; LogAction()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=763&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;
&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=767&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;
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;
	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)&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=356&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).  Since clients are disconnected on mapchange, their userids change as well.  Userids are a handy way to check if a client's connection status has changed. &lt;br /&gt;
&lt;br /&gt;
SourceMod provides two functions for userids: [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=399&amp;amp; GetClientOfUserId()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=361&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 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;
=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;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Introduction_to_SourceMod_Plugins&amp;diff=5431</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=5431"/>
		<updated>2007-11-26T04:06:04Z</updated>

		<summary type="html">&lt;p&gt;Bl4nk: /* Declaration */&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]].  The author of this article uses [http://www.crimsoneditor.com/ Crimson Editor] to write plugins.  Other possibilities are [http://www.pspad.com/ PSPad], [http://www.ultraedit.com/ UltraEdit], [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++], [http://www.textpad.com/ TextPad], or any other text editor you're comfortable with.&lt;br /&gt;
&lt;br /&gt;
=Plugin Structure=&lt;br /&gt;
Almost all plugins follow have the same three elements:&lt;br /&gt;
*'''Includes''' - Allows you to access the SourceMod API, and if you desire, API from external SourceMod extensions/plugins.&lt;br /&gt;
*'''Info''' - Public information about your plugin.&lt;br /&gt;
*'''Startup''' - A function which performs start-up routines in your plugin.&lt;br /&gt;
&lt;br /&gt;
A skeletal plugin structure looks like:&lt;br /&gt;
&amp;lt;pawn&amp;gt;&lt;br /&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.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;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The information portion is a special syntax construct.  You cannot change any of the keywords, or the &amp;lt;tt&amp;gt;public Plugin:myinfo&amp;lt;/tt&amp;gt; declaration.  The best idea is to copy and paste this skeletal structure and modify the strings to get started.&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''' include files, which is &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''' include files, which if used, will add a dependency against a certain extension.&lt;br /&gt;
*'''Plugin''' include files, which if used, will add 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;
&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=430&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.  The default functionality for entering console commands is to reply that they are unknown.  To block this functionality, you must return a new action:&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.&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=434&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=129&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=423&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;
&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=558&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;
&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=707&amp;amp; LogAction()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=763&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;
&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=767&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;
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;
	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)&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=356&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).  Since clients are disconnected on mapchange, their userids change as well.  Userids are a handy way to check if a client's connection status has changed. &lt;br /&gt;
&lt;br /&gt;
SourceMod provides two functions for userids: [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=399&amp;amp; GetClientOfUserId()] and [http://docs.sourcemod.net/api/index.php?fastload=show&amp;amp;id=361&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 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;
=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;/div&gt;</summary>
		<author><name>Bl4nk</name></author>
		
	</entry>
</feed>