<?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=Luki1412</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=Luki1412"/>
	<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/Special:Contributions/Luki1412"/>
	<updated>2026-05-25T20:46:03Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.6</generator>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=11873</id>
		<title>Metamod:Source</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Metamod:Source&amp;diff=11873"/>
		<updated>2026-04-06T13:11:19Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Updated version history&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:{{owned_project}}&lt;br /&gt;
==Introduction==&lt;br /&gt;
Metamod:Source is an API manager and interception handler that sits in between the [[Half-Life_2|Half-Life 2]] Engine (Source) and a subsequent Game Modification (MOD). It can dynamically load &amp;quot;Metamod:Source Plugins&amp;quot;, written in C++, to intercept, override, and hook Engine and GameDLL API interfaces. It also allows for inter-plugin communication.  As a backend it contains [[SourceHook]], a powerful library for safely manipulating virtual table hooks.&lt;br /&gt;
&lt;br /&gt;
[[Category:Half-Life 2]]&lt;br /&gt;
[[Category:Metamod:Source Documentation]]&lt;br /&gt;
&lt;br /&gt;
==Where to Download==&lt;br /&gt;
Metamod:Source is hosted on [http://sourceforge.net/projects/sourcemm Source Forge] or can be accessed via the [http://www.sourcemm.net/ Metamod:Source Home Page].&lt;br /&gt;
&lt;br /&gt;
==Naming Conventions==&lt;br /&gt;
The name &amp;quot;SourceMM&amp;quot; is no longer used.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
Metamod:Source is derived from the [[Metamod]] concept of intercepting calls between a game's engine and mod library.  While not based on the same code, the API is designed to be similar and familiar to [[Half-Life 1]] programmers.&lt;br /&gt;
&lt;br /&gt;
====SourceMod Core1====&lt;br /&gt;
Initially, the [[SourceMod]] project was started as the next-generation continuation of the [[AMX Mod X]] project.  It was designed to be a meta-interface layer for inter-communicating plugins.  However, as development continued, it was soon realized that the [[Valve Server Plugin]] interface would not be sufficient to provide proper engine access.&lt;br /&gt;
&lt;br /&gt;
[[User:PM|Pavol Marko]] (core1 developer) decided to add &amp;quot;SourceHook&amp;quot; to SourceMod core1.  It was embedded as a large library for hooking specific virtual table functions.  After multiple revisions (see [[SourceHook]] history), it became apparent that 1)SourceHook needed to be game and interface generic, and 2)SourceMod and SourceHook needed to be split into two separate projects.  The logic behind this was that SourceHook needed to be a layer above [[Valve Server Plugin]]s, in order to properly manage hooks with the least possibility of conflicts.  Furthermore, SourceMod should be a plugin to the SourceHook interface, rather than managing it.  This decision can be likened to [[Admin-Mod]]'s early decision to split into the first [[Metamod]] project.&lt;br /&gt;
&lt;br /&gt;
====SourceHook Finalized====&lt;br /&gt;
After four major revisions, [[SourceHook]] was mature enough to be used in a production environment.  While [[User:PM|PM]] concentrated on fleshing out [[SourceHook]], [[User:BAILOPAN|BAILOPAN]] and [[User:DS|DS]] created the GameDLL wrapper portion.&lt;br /&gt;
&lt;br /&gt;
====Version 1.0====&lt;br /&gt;
On May 6, 2005, Metamod:Source 1.0 was released with SourceHook v4.1 as a backend.  GameDLL wrapping was achieved by providing the engine with fake copies of the IServerGame* interfaces.  Once the true GameDLL location was known it would be loaded by Metamod:Source.  The fake interface then directly wrapped calls to the real GameDLL.&lt;br /&gt;
&lt;br /&gt;
====Version 1.1====&lt;br /&gt;
On October 21, 2005, the first major revision of Metamod:Source was released, featuring SourceHook v4.4, internal event listeners, dropped reliance on STL, and rewritten GameDLL hooking code.  The [[Day of Defeat|Day of Defeat:Source]] release by [[VALVe_Software|Valve Software]] revealed that the binary interface between the engine and mod wasn't necessarily public or current, and MM:S's detection was improved for compatibility and speed.  Furthermore, Metamod:Source stopped wrapping the GameDLL interfaces and began using SourceHook to hook them.&lt;br /&gt;
&lt;br /&gt;
====Version 1.2====&lt;br /&gt;
On January 7th, 2006, Metamod:Source was updated for SourceHook v4.3, but received no major API changes.&lt;br /&gt;
&lt;br /&gt;
====Version 1.3====&lt;br /&gt;
On August 16th, 2006, Metamod:Source was updated for SourceHook v4.4, minor API changes, bug fixes, and a sync to the latest HL2SDK.&lt;br /&gt;
&lt;br /&gt;
====Version 1.4====&lt;br /&gt;
On April 5th, 2007, Metamod:Source was updated with API for [[Valve Server Plugin]] interface hooking and crash-safe user message enumeration. An experimental gameinfo.txt update tool was also added. No SourceHook changes were made in this release.&lt;br /&gt;
&lt;br /&gt;
====Version 1.6====&lt;br /&gt;
Metamod:Source received a near complete overhaul to abstract engine-specific code to support Orange Box.  Additionally, SourceHook received a massive overhaul and is now v5.0, adding global hooks and various major API simplifications.  It is the first backwards compatibility break since 1.1.&lt;br /&gt;
&lt;br /&gt;
====Version 1.7====&lt;br /&gt;
Major update -- it is a single version that runs on all Source engines, including Left 4 Dead.&lt;br /&gt;
There is no longer an automated installer.&lt;br /&gt;
&lt;br /&gt;
====Version 1.7.1====&lt;br /&gt;
Added support for Dark Messiah&lt;br /&gt;
&lt;br /&gt;
====Version 1.8====&lt;br /&gt;
Major update that adds a number of new features for both users and developers.&lt;br /&gt;
The first official release that supports the Left 4 Dead 2 engine. For developers, backport of a few New API features to the Legacy API. This includes SourceHook's extremely useful &amp;quot;VP hooks&amp;quot; feature.&lt;br /&gt;
&lt;br /&gt;
====Version 1.8.1====&lt;br /&gt;
Updated to work with the latest L4D2, TF, and DoD:Source updates&lt;br /&gt;
&lt;br /&gt;
====Version 1.8.4====&lt;br /&gt;
*Added support for Alien Swarm.&lt;br /&gt;
*Added support for L4D and L4D2 on Mac OS X.&lt;br /&gt;
*Fixed wrong engine detection on early Orange Box engines.&lt;br /&gt;
*Fixed a crash when hooking some functions compiled by very new GCC versions.&lt;br /&gt;
&lt;br /&gt;
====Version 1.8.5====&lt;br /&gt;
Small bug-fix release to work with the latest Orange Box engine update (TF2, CS:S, DOD:S, HL2DM, and Garry's Mod).&lt;br /&gt;
&lt;br /&gt;
====Version 1.8.6====&lt;br /&gt;
Small bug-fix release to work with the latest Orange Box engine update (TF2, CS:S, DOD:S, HL2DM, and Garry's Mod).&lt;br /&gt;
Added support for Bloody Good Time.&lt;br /&gt;
&lt;br /&gt;
====Version 1.8.7====&lt;br /&gt;
Small bug-fix release to work with the latest Orange Box engine update (TF2, CS:S, DOD:S, HL2DM, and Garry's Mod).&lt;br /&gt;
&lt;br /&gt;
====Version 1.9====&lt;br /&gt;
The first official release that supports the Counter-Strike: Global Offensive engine. In addition, CS:S is now treated as a separate engine from 'EP2V'.&lt;br /&gt;
&lt;br /&gt;
====Version 1.9.1====&lt;br /&gt;
*Fixed core-legacy crash on hook from making wrong page writable.&lt;br /&gt;
*Updated loader to attempt to guess correct tier0/vstdlib filenames on linux, fixing load on ep2v engine.&lt;br /&gt;
*Recompiled against new hl2sdk-ob-valve to fix vdf plugin loading on ep2v engine.&lt;br /&gt;
&lt;br /&gt;
====Version 1.9.2====&lt;br /&gt;
*Fixed load issues on CS:GO after protobuf networking game update (bug 5578).&lt;br /&gt;
*Fixed load issues on CS:S under linux after game update.&lt;br /&gt;
&lt;br /&gt;
====Version 1.10====&lt;br /&gt;
Major update that adds support for a new engines, reorganizes others, and contains general bugfixes.&lt;br /&gt;
The first official release that supports the Dota 2 engine. In addition, the 'EP2V' engine is no more. TF2, DoD:S, and HL2:DM now each act as their own. Nuclear Dawn is also now separate from Left 4 Dead 2.&lt;br /&gt;
&lt;br /&gt;
====Version 1.10.1====&lt;br /&gt;
*Added support for Source SDK 2013 mods, Insurgency, Contagion, and Blade Symphony.&lt;br /&gt;
*Updated Dota 2 support to add Linux and Mac OS X support.&lt;br /&gt;
*Improved engine detection when '-game' launch param is not present&lt;br /&gt;
&lt;br /&gt;
====Version 1.10.2====&lt;br /&gt;
Fixes a regression from 1.10.1 causing engine detection on Alien Swarm to fail, as well as improving detection for some games when the '-game' command line parameter is not present (such as when using the SRCDS GUI).&lt;br /&gt;
&lt;br /&gt;
====Version 1.10.3====&lt;br /&gt;
Resolves issues with recent game updates to Team Fortress 2 and Counter-Strike: Global Offensive.&lt;br /&gt;
&lt;br /&gt;
====Version 1.10.4====&lt;br /&gt;
Resolves issues with recent game updates to Team Fortress 2.&lt;br /&gt;
&lt;br /&gt;
====Version 1.10.5====&lt;br /&gt;
*Added support for Black Mesa.&lt;br /&gt;
*Updated support for recent CS:GO game updates.&lt;br /&gt;
*Fixed game detection issues on Nuclear Dawn.&lt;br /&gt;
&lt;br /&gt;
====Version 1.10.6====&lt;br /&gt;
Small update to restore support for TF2, CS:S, DoD:S, HL2:DM, and Source SDK Base 2013 after their recent updates.&lt;br /&gt;
&lt;br /&gt;
====Move to Rolling Release Model====&lt;br /&gt;
As of Apr 27, 2017 Metamod:Source, like SourceMod, is now officially on a rolling release cycle.&lt;br /&gt;
*There won't be any more &amp;quot;point&amp;quot; releases (1.10.7, etc). Instead, we're going to continue to make an effort to keep the stable branch stable, and better relay information about what has changed in each build.&lt;br /&gt;
*Major releases with potential API breakage will still occur and will still have release notes, along with continued updates even after the branch is considered to be stable.&lt;br /&gt;
*Some of the recent, potentially-breaking changes in the Dev branch include support for Source 2, support for 64-bit dedicated servers, and removal of the old v1.4 &amp;quot;ep1&amp;quot; plugin API. (The newer v1.6 API is now used for The Ship and Source SDK 2006 mods).&lt;br /&gt;
&lt;br /&gt;
====Version 1.11====&lt;br /&gt;
*Fixed linking errors with some compilers when MM:S plugins call functions in tier1 interface.h&lt;br /&gt;
*Added support for the following engine variants: Source SDK 2013, Blade Symphony, Insurgency, Contagion, Black Mesa, and Day of Infamy.&lt;br /&gt;
*Updated Dota 2 support for the move to Source 2 from Source. (Currently broken due to other game changes since then).&lt;br /&gt;
*Added 64-bit support for games with supported 64-bit dedicated server versions, including 64-bit support in SourceHook.&lt;br /&gt;
*Ported Episode 1 build from Core Legacy API to Core API.&lt;br /&gt;
*Removed support for plugins using the &amp;quot;Core Legacy&amp;quot; API.&lt;br /&gt;
*Updated AMBuild dependency to version 2.2.&lt;br /&gt;
&lt;br /&gt;
====Version 1.12====&lt;br /&gt;
*Improved 64-bit support&lt;br /&gt;
*Improved support for mods running on the 2025 refresh of Source SDK 2013&lt;br /&gt;
*Improved support for HL1DM&lt;br /&gt;
*Added support for Military Conflict: Vietnam and Pirates, Vikings, and Knights II&lt;br /&gt;
&lt;br /&gt;
====Version 2.0====&lt;br /&gt;
Currently in development, where Source 2 support continues to be refined, among other larger changes.&lt;br /&gt;
&lt;br /&gt;
==Design Considerations==&lt;br /&gt;
====Metamod====&lt;br /&gt;
Originally, Metamod:Source was a plugin co-existing with SourceMod.  However, there are factories, pointers, and certain capabilities not possible from a [[Valve Server Plugin]].  Furthermore, the [[Half-Life 2]] engine does not properly unload VSPs, making debugging and resource unloading more difficult.  Eventually it was decided the added functionality and fine-tuned control outweighed the extra cost of having to configure an intercepting binary.&lt;br /&gt;
&lt;br /&gt;
====Plugins====&lt;br /&gt;
Plugins are specific to Metamod:Source.  This means that [[Valve Server Plugin]]s and [[Open_Source_Plugins_for_Metamod:Source|Metamod:Source Plugins]] are entirely separate in the API characteristics.  While it is certainly possible to expose the necessary interfaces to VSPs, it creates an added layer of complexity for dealing with things that Metamod:Source might not directly control.  For example, when a Metamod:Source plugin is removed at runtime, all of the necessary hooks are also removed.  A VSP has no clear callback for detecting this event, therefore it would be more difficult to ensure proper unloading.  VSP and MM:S plugins also have different ways of attaching and detaching server [[Cvars|cvars]] and [[Console commands|concmds]].&lt;br /&gt;
&lt;br /&gt;
By keeping the plugin system isolated, Metamod:Source can also provide a unique set of console commands and API.  For example, plugins can listen for certain Metamod:Source-specific events and provide communication channels with other plugins.&lt;br /&gt;
&lt;br /&gt;
====Hooking====&lt;br /&gt;
Metamod:Source is powered by [[SourceHook]], a versatile library for hooking virtual functions.  The original [[Half-Life 1]] engine used structs of function pointers which could easily be modified as they passed from one library to another.  However, HL2 is comprised almost entirely of pure virtual interfaces.  SourceHook was designed for declaring single hooks against a given virtual function and a this pointer, which is not only faster than a blanket hooking system like Metamod's, but more flexible and precise.&lt;br /&gt;
&lt;br /&gt;
Hooking under Metamod:Source has a number of features that don't exist in a hooking system style like Metamod's, and it achieves something closer to [[Detours|detours]], rather than Metamod, which is hardcoded.  For example&lt;br /&gt;
*You can change parent parameters during a hooked call&lt;br /&gt;
*You can hook member functions, both by a pre-existing declaration or given vtable offset&lt;br /&gt;
*You can call the original function and still fire its associated hooks, or you can call it without firing hooks in order to prevent infinite recursion&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
For more information on installing, configuring, and coding for Metamod:Source, see [[:Category:Documentation (SourceMM)|Documentation]].&lt;br /&gt;
&lt;br /&gt;
==The Future==&lt;br /&gt;
While Metamod:Source is a stable/production product, more features are on the horizon.  There are distant plans for a [[Detours|detouring]] library and a library for efficiently automated [[Signature Scanning|signature scanning]].&lt;br /&gt;
&lt;br /&gt;
==License==&lt;br /&gt;
Metamod:Source is licensed under the [[zLib/libpng License]].  It is free to use for both open-source and proprietary projects.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[http://www.sourcemm.net/ Metamod:Source Website]&lt;br /&gt;
*[http://www.metamod.org/ Metamod Website]&lt;br /&gt;
*[http://www.sourcemod.net/ SourceMod Website]&lt;br /&gt;
*[http://resonus.net/doxygen_sourcemm/ Doxygen of Metamod:Source]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SourceMod&amp;diff=11872</id>
		<title>SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SourceMod&amp;diff=11872"/>
		<updated>2026-04-06T11:38:11Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
SourceMod is a [[SourceMM|Metamod:Source]] plugin for [[Half-Life 2]].  It provides comprehensive scripting for the Source engine and mods written using the Source SDK.  It has features for administration systems, commands, console variables, events, network messages, timed actions, math and string routines, entity modification, and more.  It also features a safely versioned, object oriented API usable from &amp;quot;extensions&amp;quot; written in C++.  The extension API can be used to add scripting language callbacks and native features.&lt;br /&gt;
&lt;br /&gt;
SourceMod scripts are written in the SourcePawn language, which is derived from [[Pawn]].  Some of the differences include:&lt;br /&gt;
*Passing functions as &amp;quot;objects,&amp;quot; instead of by name&lt;br /&gt;
*Natively packed and tagged strings&lt;br /&gt;
*Dynamic local variables&lt;br /&gt;
*A '&amp;lt;tt&amp;gt;decl&amp;lt;/tt&amp;gt;' operator for creating uninitialized variables&lt;br /&gt;
*A new virtual machine and JIT, both rewritten in C++&lt;br /&gt;
*A new file format&lt;br /&gt;
&lt;br /&gt;
=History=&lt;br /&gt;
==Initial Project==&lt;br /&gt;
SourceMod was officially announced on October 7th, 2004, as a successor to [[AMX Mod X]] for the Half-Life 1 engine.  It was targetted as a complete rewrite of AMX Mod X, with the following fundamental changes:&lt;br /&gt;
*Use of multiple (pluggable) scripting languages&lt;br /&gt;
*JavaScript support&lt;br /&gt;
*Unloadability&lt;br /&gt;
*An object-oriented module API&lt;br /&gt;
&lt;br /&gt;
The Source SDK was released on December 1st, 2004.  A few weeks later, SourceMod released its source code on December 25th.  Then, development began to stagnate.  The concept of multiple languages was over-ambitious and improper.  The system was largely too complex and too unorganized for developers to understand.  Most importantly, the integral calling abstraction layer, designed to let Core talk to plugins without knowing the target scripting layer, was never viable.  Because of this and the inherent complexity of MetaEng, scripts were not testable.&lt;br /&gt;
&lt;br /&gt;
By May of 2005, SourceMod had become completely abandoned.  The codebase was scrapped for a rewrite, called &amp;quot;Core 2.&amp;quot;  This was also quickly abandoned.  This timeline and the details therein are explained on the SourceMod [http://www.sourcemod.net/devlog/?p=88 Dev Log].  The remaining members of the SourceMod team went back to AMX Mod X.&lt;br /&gt;
&lt;br /&gt;
==SourceHook==&lt;br /&gt;
By January of 2005, it was apparent that Valve's API would not be sufficient for plugin development in C++.  SourceMod and AMX Mod X Developer Pavol &amp;quot;PM OnoTo&amp;quot; Marko started working on an API for safely hooking virtual functions via vtables.  &lt;br /&gt;
&lt;br /&gt;
By March of 2005, it was apparent that this technology would be more useful as a separate project.  Thus, SourceHook broke from SourceMod and the [[SourceMM|Metamod:Source]] project was started.  Metamod:Source was first released on May 26, 2005.&lt;br /&gt;
&lt;br /&gt;
==Current Project==&lt;br /&gt;
In March of 2006, a public survey was held to determine if the community still wanted SourceMod.  Since the response was good, the project was restarted, but in secret, to avoid the same public relations mistakes.  From March to September, SourcePawn was written, which included:&lt;br /&gt;
*A new JIT, written completely in C++&lt;br /&gt;
*A new virtual machine and API, written in C++ with object oriented API&lt;br /&gt;
*A new file format&lt;br /&gt;
*Various new language features&lt;br /&gt;
&lt;br /&gt;
From November 2006 to January 2007, SourceMod evolved into a usable scripting platform based on SourcePawn.  As of March 16, 2007, it contained enough scripting-level features to be usable, and builds were made available to the public.&lt;br /&gt;
&lt;br /&gt;
SourceMod remains an ongoing development project which now runs on over 38% of all Source servers.&lt;br /&gt;
&lt;br /&gt;
=Development Team=&lt;br /&gt;
*See the [http://www.sourcemod.net/credits.php credits page].&lt;br /&gt;
&lt;br /&gt;
=Future Plans=&lt;br /&gt;
As of the time of writing, SourceMod version 1.12 has been released and version 1.13 is under development. The best way to keep up with current development of SourceMod is to view our news section of the forums (linked below).&lt;br /&gt;
&lt;br /&gt;
https://forums.alliedmods.net/forumdisplay.php?f=59&lt;br /&gt;
&lt;br /&gt;
=License=&lt;br /&gt;
SourceMod along with it's extensions &amp;amp; plugins are all licensed under the [[GNU General Public License]].&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
*[[Introduction to SourcePawn]]&lt;br /&gt;
*[[Introduction to SourceMod Plugins]]&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
*[http://www.sourcemod.net/ SourceMod Website]&lt;br /&gt;
*[http://www.metamodsource.net/ Metamod:Source Website]&lt;br /&gt;
&lt;br /&gt;
[[Category:Half-Life_2]]&lt;br /&gt;
[[Category:SourceMod]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11869</id>
		<title>Category:SourceMod Scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11869"/>
		<updated>2026-03-31T20:26:46Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ForDevelopers}}&lt;br /&gt;
&lt;br /&gt;
This category contains articles about scripting for SourceMod with SourcePawn.&lt;br /&gt;
&lt;br /&gt;
===Introductions===&lt;br /&gt;
*[[Introduction to SourcePawn 1.7]] - Learning language syntax.&lt;br /&gt;
*[[SourcePawn Transitional Syntax]] - Learning transitional syntax.&lt;br /&gt;
*[[Introduction to SourceMod Plugins]] - Writing your &amp;quot;first plugin.&amp;quot;&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
&lt;br /&gt;
===Basic API===&lt;br /&gt;
*[[AutoConfigs (SourceMod Scripting)|AutoConfigs]] - Automatic .cfg creation for cvars.&lt;br /&gt;
*[[Commands (SourceMod Scripting)|Commands]] - Console commands/input.&lt;br /&gt;
*[[ConVars (SourceMod Scripting)|ConVars]] - Console variables (cvars).&lt;br /&gt;
*[[Events (SourceMod Scripting)|Events]] - Half-Life 2 Game Events.&lt;br /&gt;
*[[KeyValues (SourceMod Scripting)|KeyValues]] - KeyValues file parsing/writing.&lt;br /&gt;
*[[Menu API (SourceMod)|Menus]] - Building and drawing menus.&lt;br /&gt;
*[[SQL (SourceMod Scripting)|SQL]] - Using databases (MySQL, SQLite).&lt;br /&gt;
*[[Timers (SourceMod Scripting)|Timers]] - Timed callbacks.&lt;br /&gt;
*[[DataPacks|DataPacks]] -  A good way to store asynchronous data.&lt;br /&gt;
*[[Translations (SourceMod Scripting)|Translations]] - Internationalization.&lt;br /&gt;
*[[Entity References (SourceMod)|Entity References]] - A safe way of storing entities.&lt;br /&gt;
*[[Checking Admin Flags (SourceMod Scripting)|Checking Admin Flags]] - Limit commands to certain users&lt;br /&gt;
&lt;br /&gt;
===Advanced API===&lt;br /&gt;
*[[Admin API (SourceMod)|Administration API]] - Using the Admin Cache.&lt;br /&gt;
*[[Admin Menu (SourceMod Scripting)|Admin Menu API]] - Attaching to the Admin Menu.&lt;br /&gt;
*[[Creating Natives (SourceMod Scripting)|Creating Natives]] - Exposing API to other plugins.&lt;br /&gt;
*[[Function Calling API (SourceMod Scripting)|Function Calling API]] - Calling external functions.&lt;br /&gt;
*[[Optional Requirements (SourceMod Scripting)|Optional Requirements]] - Managing dependencies.&lt;br /&gt;
*[[SDKTools (SourceMod Scripting)|SDKTools]] - Using the powerful SDK abstraction layer.&lt;br /&gt;
*[[SDKHooks]] - Using SDKHooks, that provide additional hooks and functions.&lt;br /&gt;
*[[DHooks (SourceMod Scripting)]] - Dynamic hooks.&lt;br /&gt;
*[[TempEnts (SourceMod SDKTools)|Temporary Entities]] - Using temporary entities.&lt;br /&gt;
&lt;br /&gt;
===Information===&lt;br /&gt;
*[[Format Class Functions (SourceMod Scripting)|Format Class Functions]] - All about text formatting.&lt;br /&gt;
*[[Handles (SourceMod Scripting)|Handles]] - Overview of Handles and some common types.&lt;br /&gt;
*[[Optimizing Plugins (SourceMod Scripting)|Optimizing Plugins]] - Optimization hints.&lt;br /&gt;
*&amp;lt;s&amp;gt;[[Tags (Scripting)|Tags]] - All about tags.&amp;lt;/s&amp;gt;&lt;br /&gt;
*[[Vectors Explained (Scripting)|Vectors Explained]] - Explanation of Vector types.&lt;br /&gt;
&lt;br /&gt;
===Resources===&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
*[[Entity Properties]] - Explanation of Source entity properties.&lt;br /&gt;
*[[Game Events (Source)|Game Events]] - Game events listings for popular mods.&lt;br /&gt;
*[[Mod TempEnt List (Source)|Temp Entity Lists]] - Temporary entities for popular mods.&lt;br /&gt;
*[[SourceMod Profiler]] - Performance tracking and optimizing.&lt;br /&gt;
*[[Vice_keys]] - Decryption keys for ctx files&lt;br /&gt;
*[[Weapon Names(Source)]] - Weapon Names / weapon entity names&lt;br /&gt;
[[Category:SourceMod]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Tags_(Scripting)&amp;diff=11868</id>
		<title>Tags (Scripting)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Tags_(Scripting)&amp;diff=11868"/>
		<updated>2026-03-31T20:24:26Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|As of Sourcemod 1.7 there have been significant changes to the tags and types, making this page mostly outdated. See [[SourcePawn_Transitional_Syntax]] for more information}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
Tags are a concept in the original Small/Pawn language that work around the inherent lack of data types present.  For example, Java/C would declare variables like so:&lt;br /&gt;
&amp;lt;java&amp;gt;double dNumber = 5.0;&lt;br /&gt;
int iNumber = 5;&lt;br /&gt;
char cLetter = 'a';&lt;br /&gt;
&amp;lt;/java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Java, the sizes of these types respectively are eight bytes, four bytes, and two bytes.  However, Pawn is only capable of one data type size.  In SourcePawn, that's 32bit (four bytes).  Therefore, tags serve two purposes:&lt;br /&gt;
*Allow overloads and restrictions of basic math operators&lt;br /&gt;
*Introduce weak typing and coalescence&lt;br /&gt;
&lt;br /&gt;
An example of this is:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new Float:fNum = 5.0;&lt;br /&gt;
new iNum = 5;&lt;br /&gt;
new char = 'A';&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, all of the variables are the same ''type'', the &amp;lt;tt&amp;gt;cell&amp;lt;/tt&amp;gt;, which is four bytes.  But the &amp;lt;tt&amp;gt;fNum&amp;lt;/tt&amp;gt; variable is ''tagged'' as a &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt;, and so it uses a set of overloaded operators for floating point math.  The &amp;lt;tt&amp;gt;iNum&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt; variables are both integers.  Even though &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt; is only holding one byte of data (an ASCII character), it is still a 32bit data type.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Tags are identified by prefixing the tag name and a colon to a variable name.  Note that you still need the &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; declaration, as tags aren't a declaration in and of themselves.  Example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;//this is valid&lt;br /&gt;
new ValidTag:crab = something;&lt;br /&gt;
//this is not&lt;br /&gt;
InvalidTag:tag = something;&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tags can be used for enumerations.  For example, the following defines a list of constant symbols which are each tagged as the enumeration name.&lt;br /&gt;
&amp;lt;pawn&amp;gt;enum Clam&lt;br /&gt;
{&lt;br /&gt;
   Oyster = 0,  /* Oyster has the Clam tag */&lt;br /&gt;
   Quahog = 1,  /* Quahog has the Clam tag */&lt;br /&gt;
};&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mismatches and Coalescence==&lt;br /&gt;
If you attempt to mix tags in an expression, you will get the infamous (213) &amp;quot;Tag mismatch&amp;quot; warning from the compiler.  Although it is only a warning, it ''can'' be a serious error, and it is important that your plugins do not carry this warning (or, if they do, it is carefully understood to be safe).&lt;br /&gt;
&lt;br /&gt;
An example of a tag mismatch, using the above enumeration, might be:&lt;br /&gt;
&amp;lt;pawn&amp;gt;stock GetClamNumber()&lt;br /&gt;
{&lt;br /&gt;
   return Oyster;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stock Clam:GetOyster()&lt;br /&gt;
{&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both of these functions will generate tag mismatch warnings by the compiler.  This is because 0 is not inherently an Oyster, and Oyster is a &amp;lt;tt&amp;gt;Clam&amp;lt;/tt&amp;gt;, not a raw number.&lt;br /&gt;
&lt;br /&gt;
Luckily in Pawn, you can 'coalesce' tags.  This means you can convert one tag to another.  This is usually a bad idea, however, it can be important for converting a bitstring to another bitstring, or a raw integer.  The generic, or &amp;quot;empty&amp;quot; tag is &amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;, and this symbol will effectively strip a tag from a tagged variable.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;stock GetClamNumber()&lt;br /&gt;
{&lt;br /&gt;
   return _:Oyster;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stock Clam:GetOyster()&lt;br /&gt;
{&lt;br /&gt;
   return Clam:0;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This forces the tags to be correct.  ''Note that the second function could simply return &amp;lt;tt&amp;gt;Oyster&amp;lt;/tt&amp;gt;.  This mistake was for example purposes only.''&lt;br /&gt;
&lt;br /&gt;
=Built-in Tags=&lt;br /&gt;
Pawn has two built-in tags by default.  These are '''bool''' and '''Float'''.&lt;br /&gt;
&lt;br /&gt;
==Boolean==&lt;br /&gt;
The &amp;lt;tt&amp;gt;bool&amp;lt;/tt&amp;gt; tag (note case sensitivity) can be set to two values:&lt;br /&gt;
*'''true''' - 1&lt;br /&gt;
*'''false''' - 0&lt;br /&gt;
&lt;br /&gt;
Again, it is not faster or slower than an integer 1 or 0, because the data type is the same.  This tag simply provides better looking code.&lt;br /&gt;
&lt;br /&gt;
==Float==&lt;br /&gt;
The &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt; tag (note case sensitivity) is used for floating point math.  If the compiler detects a number to have a decimal point, it is automatically tagged as Float.  Floats have the following operators defined.  Note that these operators are not intrinsic to the compiler, and are written in &amp;lt;tt&amp;gt;float.inc&amp;lt;/tt&amp;gt;.&lt;br /&gt;
*'''Math'''&lt;br /&gt;
** '''Binary''' +, -, /, * (at least one side must be a Float)&lt;br /&gt;
** '''Unary''' ++, --&lt;br /&gt;
** '''Unary''' -&lt;br /&gt;
*'''Comparison'''&lt;br /&gt;
** '''Binary''' ==, != (at least one side must be a Float)&lt;br /&gt;
** '''Binary''' &amp;gt;=, &amp;gt;, &amp;lt;, &amp;lt;= (at least one side must be a Float)&lt;br /&gt;
** '''Unary''' !&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=SourceMod Specific=&lt;br /&gt;
==New Magic Tags==&lt;br /&gt;
In SourceMod, the rules for tags change in two cases, as there are a few 'magic' tags.  These magic tags are:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;'''Function''': This is the tag returned when using a function without a call.  For example: &amp;lt;pawn&amp;gt;stock Function() { }&lt;br /&gt;
new Function:fCall = Function;&amp;lt;/pawn&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;'''String''': This is a &amp;quot;magic&amp;quot; tag similar to &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt;.  It is inherent to literal strings.  Unlike &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt;, it secretly changes the storage method -- this makes it a true data type internally, unlike any other tag.  Any array tagged as a String is stored in ''bytes'', not ''cells''.  Observe the example: &amp;lt;pawn&amp;gt;new String:hello[] = &amp;quot;Hello&amp;quot;;&lt;br /&gt;
new hello2[] = &amp;quot;Hello&amp;quot;;&lt;br /&gt;
new hello3[] = {'H', 'e', 'l', 'l', 'o', 0};&amp;lt;/pawn&amp;gt;&lt;br /&gt;
In this example, &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; is a valid string array.  To the scripter, this appears normal.  Internally, it is roughly 6 bytes.  This is specifically to make C++ coding of Pawn very fast and easy, in order to avoid cell to string conversion.  &amp;lt;tt&amp;gt;hello2&amp;lt;/tt&amp;gt; is an invalid declaration, as it is a tag mismatch.  &amp;lt;tt&amp;gt;hello3&amp;lt;/tt&amp;gt; is a valid declaration, but uses one cell for each character, rather than one byte.  Thus, it will be incompatible with natives that use Strings.  ''This is a good example of why tag coalescence is often dangerous.''  If you attempt to manually rewrite tags for strings, the result will be very unexpected, and may even crash.&lt;br /&gt;
&lt;br /&gt;
Note, however, that is still possible to do assignments like this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new String:string[20]&lt;br /&gt;
new letter = 'a'&lt;br /&gt;
string[3] = 'a'&lt;br /&gt;
string[a] = letter&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These assignments work because the &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; tag is a true type underneath, and will correctly cast other tags when necessary.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Function Enumerations==&lt;br /&gt;
SourceMod features &amp;quot;function enumerations,&amp;quot; which are normal enums, except they define function prototypes rather than constants.  Each of the prototypes is given a unique sub-tag that only matches a &amp;lt;tt&amp;gt;Function&amp;lt;/tt&amp;gt; of that prototype.  These will be explained more in the future, as they are not used yet.&lt;br /&gt;
&lt;br /&gt;
==New General Tags==&lt;br /&gt;
SourceMod introduces one important general tag.&lt;br /&gt;
*'''Handle''': Used for the [[Handles (SourceMod Scripting)|Handle System]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=AMX Mod X Specific=&lt;br /&gt;
AMX Mod X has literally a plethora of tags, but has no new &amp;quot;magic&amp;quot; tags.  Some of these tags are:&lt;br /&gt;
*'''Sql''': An SQL index for the DBI system.&lt;br /&gt;
*'''Result''': An SQL Result index for the DBI system.&lt;br /&gt;
*'''Handle''': An SQL Handle (precursor to SourceMod's &amp;lt;tt&amp;gt;Handle&amp;lt;/tt&amp;gt;) for the SQLX system.&lt;br /&gt;
*'''Vault''': An index for a vault opened with the nVault module.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;br /&gt;
[[Category:Scripting (AMX Mod X)]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Tags_(Scripting)&amp;diff=11867</id>
		<title>Tags (Scripting)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Tags_(Scripting)&amp;diff=11867"/>
		<updated>2026-03-31T20:16:40Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added a note&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|As of Sourcemod 1.7 there have been significant changes to the tags and types. See [[SourcePawn_Transitional_Syntax]] for more information}}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
Tags are a concept in the original Small/Pawn language that work around the inherent lack of data types present.  For example, Java/C would declare variables like so:&lt;br /&gt;
&amp;lt;java&amp;gt;double dNumber = 5.0;&lt;br /&gt;
int iNumber = 5;&lt;br /&gt;
char cLetter = 'a';&lt;br /&gt;
&amp;lt;/java&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Java, the sizes of these types respectively are eight bytes, four bytes, and two bytes.  However, Pawn is only capable of one data type size.  In SourcePawn, that's 32bit (four bytes).  Therefore, tags serve two purposes:&lt;br /&gt;
*Allow overloads and restrictions of basic math operators&lt;br /&gt;
*Introduce weak typing and coalescence&lt;br /&gt;
&lt;br /&gt;
An example of this is:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new Float:fNum = 5.0;&lt;br /&gt;
new iNum = 5;&lt;br /&gt;
new char = 'A';&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, all of the variables are the same ''type'', the &amp;lt;tt&amp;gt;cell&amp;lt;/tt&amp;gt;, which is four bytes.  But the &amp;lt;tt&amp;gt;fNum&amp;lt;/tt&amp;gt; variable is ''tagged'' as a &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt;, and so it uses a set of overloaded operators for floating point math.  The &amp;lt;tt&amp;gt;iNum&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt; variables are both integers.  Even though &amp;lt;tt&amp;gt;char&amp;lt;/tt&amp;gt; is only holding one byte of data (an ASCII character), it is still a 32bit data type.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Tags are identified by prefixing the tag name and a colon to a variable name.  Note that you still need the &amp;lt;tt&amp;gt;new&amp;lt;/tt&amp;gt; declaration, as tags aren't a declaration in and of themselves.  Example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;//this is valid&lt;br /&gt;
new ValidTag:crab = something;&lt;br /&gt;
//this is not&lt;br /&gt;
InvalidTag:tag = something;&lt;br /&gt;
&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tags can be used for enumerations.  For example, the following defines a list of constant symbols which are each tagged as the enumeration name.&lt;br /&gt;
&amp;lt;pawn&amp;gt;enum Clam&lt;br /&gt;
{&lt;br /&gt;
   Oyster = 0,  /* Oyster has the Clam tag */&lt;br /&gt;
   Quahog = 1,  /* Quahog has the Clam tag */&lt;br /&gt;
};&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mismatches and Coalescence==&lt;br /&gt;
If you attempt to mix tags in an expression, you will get the infamous (213) &amp;quot;Tag mismatch&amp;quot; warning from the compiler.  Although it is only a warning, it ''can'' be a serious error, and it is important that your plugins do not carry this warning (or, if they do, it is carefully understood to be safe).&lt;br /&gt;
&lt;br /&gt;
An example of a tag mismatch, using the above enumeration, might be:&lt;br /&gt;
&amp;lt;pawn&amp;gt;stock GetClamNumber()&lt;br /&gt;
{&lt;br /&gt;
   return Oyster;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stock Clam:GetOyster()&lt;br /&gt;
{&lt;br /&gt;
   return 0;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Both of these functions will generate tag mismatch warnings by the compiler.  This is because 0 is not inherently an Oyster, and Oyster is a &amp;lt;tt&amp;gt;Clam&amp;lt;/tt&amp;gt;, not a raw number.&lt;br /&gt;
&lt;br /&gt;
Luckily in Pawn, you can 'coalesce' tags.  This means you can convert one tag to another.  This is usually a bad idea, however, it can be important for converting a bitstring to another bitstring, or a raw integer.  The generic, or &amp;quot;empty&amp;quot; tag is &amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;, and this symbol will effectively strip a tag from a tagged variable.  For example:&lt;br /&gt;
&amp;lt;pawn&amp;gt;stock GetClamNumber()&lt;br /&gt;
{&lt;br /&gt;
   return _:Oyster;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
stock Clam:GetOyster()&lt;br /&gt;
{&lt;br /&gt;
   return Clam:0;&lt;br /&gt;
}&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This forces the tags to be correct.  ''Note that the second function could simply return &amp;lt;tt&amp;gt;Oyster&amp;lt;/tt&amp;gt;.  This mistake was for example purposes only.''&lt;br /&gt;
&lt;br /&gt;
=Built-in Tags=&lt;br /&gt;
Pawn has two built-in tags by default.  These are '''bool''' and '''Float'''.&lt;br /&gt;
&lt;br /&gt;
==Boolean==&lt;br /&gt;
The &amp;lt;tt&amp;gt;bool&amp;lt;/tt&amp;gt; tag (note case sensitivity) can be set to two values:&lt;br /&gt;
*'''true''' - 1&lt;br /&gt;
*'''false''' - 0&lt;br /&gt;
&lt;br /&gt;
Again, it is not faster or slower than an integer 1 or 0, because the data type is the same.  This tag simply provides better looking code.&lt;br /&gt;
&lt;br /&gt;
==Float==&lt;br /&gt;
The &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt; tag (note case sensitivity) is used for floating point math.  If the compiler detects a number to have a decimal point, it is automatically tagged as Float.  Floats have the following operators defined.  Note that these operators are not intrinsic to the compiler, and are written in &amp;lt;tt&amp;gt;float.inc&amp;lt;/tt&amp;gt;.&lt;br /&gt;
*'''Math'''&lt;br /&gt;
** '''Binary''' +, -, /, * (at least one side must be a Float)&lt;br /&gt;
** '''Unary''' ++, --&lt;br /&gt;
** '''Unary''' -&lt;br /&gt;
*'''Comparison'''&lt;br /&gt;
** '''Binary''' ==, != (at least one side must be a Float)&lt;br /&gt;
** '''Binary''' &amp;gt;=, &amp;gt;, &amp;lt;, &amp;lt;= (at least one side must be a Float)&lt;br /&gt;
** '''Unary''' !&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=SourceMod Specific=&lt;br /&gt;
==New Magic Tags==&lt;br /&gt;
In SourceMod, the rules for tags change in two cases, as there are a few 'magic' tags.  These magic tags are:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;'''Function''': This is the tag returned when using a function without a call.  For example: &amp;lt;pawn&amp;gt;stock Function() { }&lt;br /&gt;
new Function:fCall = Function;&amp;lt;/pawn&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;'''String''': This is a &amp;quot;magic&amp;quot; tag similar to &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt;.  It is inherent to literal strings.  Unlike &amp;lt;tt&amp;gt;Float&amp;lt;/tt&amp;gt;, it secretly changes the storage method -- this makes it a true data type internally, unlike any other tag.  Any array tagged as a String is stored in ''bytes'', not ''cells''.  Observe the example: &amp;lt;pawn&amp;gt;new String:hello[] = &amp;quot;Hello&amp;quot;;&lt;br /&gt;
new hello2[] = &amp;quot;Hello&amp;quot;;&lt;br /&gt;
new hello3[] = {'H', 'e', 'l', 'l', 'o', 0};&amp;lt;/pawn&amp;gt;&lt;br /&gt;
In this example, &amp;lt;tt&amp;gt;hello&amp;lt;/tt&amp;gt; is a valid string array.  To the scripter, this appears normal.  Internally, it is roughly 6 bytes.  This is specifically to make C++ coding of Pawn very fast and easy, in order to avoid cell to string conversion.  &amp;lt;tt&amp;gt;hello2&amp;lt;/tt&amp;gt; is an invalid declaration, as it is a tag mismatch.  &amp;lt;tt&amp;gt;hello3&amp;lt;/tt&amp;gt; is a valid declaration, but uses one cell for each character, rather than one byte.  Thus, it will be incompatible with natives that use Strings.  ''This is a good example of why tag coalescence is often dangerous.''  If you attempt to manually rewrite tags for strings, the result will be very unexpected, and may even crash.&lt;br /&gt;
&lt;br /&gt;
Note, however, that is still possible to do assignments like this:&lt;br /&gt;
&amp;lt;pawn&amp;gt;new String:string[20]&lt;br /&gt;
new letter = 'a'&lt;br /&gt;
string[3] = 'a'&lt;br /&gt;
string[a] = letter&amp;lt;/pawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These assignments work because the &amp;lt;tt&amp;gt;String&amp;lt;/tt&amp;gt; tag is a true type underneath, and will correctly cast other tags when necessary.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Function Enumerations==&lt;br /&gt;
SourceMod features &amp;quot;function enumerations,&amp;quot; which are normal enums, except they define function prototypes rather than constants.  Each of the prototypes is given a unique sub-tag that only matches a &amp;lt;tt&amp;gt;Function&amp;lt;/tt&amp;gt; of that prototype.  These will be explained more in the future, as they are not used yet.&lt;br /&gt;
&lt;br /&gt;
==New General Tags==&lt;br /&gt;
SourceMod introduces one important general tag.&lt;br /&gt;
*'''Handle''': Used for the [[Handles (SourceMod Scripting)|Handle System]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=AMX Mod X Specific=&lt;br /&gt;
AMX Mod X has literally a plethora of tags, but has no new &amp;quot;magic&amp;quot; tags.  Some of these tags are:&lt;br /&gt;
*'''Sql''': An SQL index for the DBI system.&lt;br /&gt;
*'''Result''': An SQL Result index for the DBI system.&lt;br /&gt;
*'''Handle''': An SQL Handle (precursor to SourceMod's &amp;lt;tt&amp;gt;Handle&amp;lt;/tt&amp;gt;) for the SQLX system.&lt;br /&gt;
*'''Vault''': An index for a vault opened with the nVault module.&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;br /&gt;
[[Category:Scripting (AMX Mod X)]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11866</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11866"/>
		<updated>2026-03-31T20:08:18Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added more information about how to hook and some hooks and how to use takedamage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
SDKHooks extension provides hooks, functions and natives. &lt;br /&gt;
&lt;br /&gt;
==Take Damage==&lt;br /&gt;
Native SDKHooks_TakeDamage allows you to force an entity to take damage: &amp;lt;code&amp;gt;void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,&lt;br /&gt;
		float damage, int damageType=DMG_GENERIC, int weapon=-1,&lt;br /&gt;
		const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR,&lt;br /&gt;
		bool bypassHooks = true);&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Damage types are available in the sdkhooks.inc file - [https://sm.alliedmods.net/new-api/sdkhooks/__raw sdkhooks.inc]&amp;lt;br&amp;gt;&lt;br /&gt;
The weapon parameter is not used by all games and damage sources.&lt;br /&gt;
&lt;br /&gt;
==Hooking an entity==&lt;br /&gt;
SDKHooks provides 3 functions related to hooking entities: '''SDKHook''', '''SDKHookEx''' and '''SDKUnhook'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SDKHook===&lt;br /&gt;
SDKHook is used to hook entities:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
void SDKHook(int entity, SDKHookType type, SDKHookCB callback);&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The first parameter is the entity index.&amp;lt;br&amp;gt;&lt;br /&gt;
The second parameter is the hook type, some of which are listed in the Hooks section below but you can always find the full list in the sdkhooks.inc file. Online version available [https://sm.alliedmods.net/new-api/sdkhooks/__raw here].&amp;lt;br&amp;gt;&lt;br /&gt;
The third parameter is the callback function, that will be run, when the hook is triggered.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The callback function signature changes depending on the hook type. You can see all the callback function signatures in the sdkhooks.inc file - [https://sm.alliedmods.net/new-api/sdkhooks/__raw sdkhooks.inc]&amp;lt;br&amp;gt;&lt;br /&gt;
Example callback function signature for the OnTakeDamage hook:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function Action (int victim, int &amp;amp;attacker, int &amp;amp;inflictor, float &amp;amp;damage, int &amp;amp;damagetype, int &amp;amp;weapon,&lt;br /&gt;
		float damageForce[3], float damagePosition[3], int damagecustom);&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note the callback return type: &lt;br /&gt;
*void - event cannot be changed at this point&lt;br /&gt;
*Action - event can be changed or stopped where possible&lt;br /&gt;
&lt;br /&gt;
===SDKHookEx===&lt;br /&gt;
SDKHookEx is exactly the same as SDKHook, with only 1 difference:&lt;br /&gt;
Unlike SDKHook, it has a boolean return value telling you whether the hook was successful.&lt;br /&gt;
&lt;br /&gt;
===SDKUnhook===&lt;br /&gt;
SDKUnhook removes/unhooks the hook from the entity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
void SDKUnhook(int entity, SDKHookType type, SDKHookCB callback);&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
It has the same parameters as SDKHook.&lt;br /&gt;
&lt;br /&gt;
It is rarely used, because:&lt;br /&gt;
* SDKHooks blocks hooking the same hook (for the same entity) twice&lt;br /&gt;
* Hooks are unhooked automatically upon destruction/removal of the entity&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
Not all games use FireBullets so this hook will not trigger in such games.&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
Trigged after SDKHook_OnTakeDamage, but before SDKHook_OnTakeDamageAlive&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
Triggered after the player took damage.&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
Called before OnGameFrame(), but only for the hooked entity.&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Triggers when the hooked entity is about to spawn. Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
Triggers after the hooked entity was spawned.&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
Triggers when the hooked entity is about to be touched by another entity. Not all entities can trigger/fire touch events. Adjusting collision groups for the entity can fix that.&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
Triggers when the hooked entity is about to update.&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggers when the hooked weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
Triggers after the hooked weapon was dropped.&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
Triggers when the hooked weapon is about to be equipped.&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
Triggers after the hooked weapon was equipped.&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
Triggers when the hooked weapon is about to be switched for another one.&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
Triggers after the hooked weapon was switched for another one.&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11865</id>
		<title>Category:SourceMod Scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11865"/>
		<updated>2026-03-31T19:08:09Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ForDevelopers}}&lt;br /&gt;
&lt;br /&gt;
This category contains articles about scripting for SourceMod with SourcePawn.&lt;br /&gt;
&lt;br /&gt;
===Introductions===&lt;br /&gt;
*[[Introduction to SourcePawn 1.7]] - Learning language syntax.&lt;br /&gt;
*[[SourcePawn Transitional Syntax]] - Learning transitional syntax.&lt;br /&gt;
*[[Introduction to SourceMod Plugins]] - Writing your &amp;quot;first plugin.&amp;quot;&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
&lt;br /&gt;
===Basic API===&lt;br /&gt;
*[[AutoConfigs (SourceMod Scripting)|AutoConfigs]] - Automatic .cfg creation for cvars.&lt;br /&gt;
*[[Commands (SourceMod Scripting)|Commands]] - Console commands/input.&lt;br /&gt;
*[[ConVars (SourceMod Scripting)|ConVars]] - Console variables (cvars).&lt;br /&gt;
*[[Events (SourceMod Scripting)|Events]] - Half-Life 2 Game Events.&lt;br /&gt;
*[[KeyValues (SourceMod Scripting)|KeyValues]] - KeyValues file parsing/writing.&lt;br /&gt;
*[[Menu API (SourceMod)|Menus]] - Building and drawing menus.&lt;br /&gt;
*[[SQL (SourceMod Scripting)|SQL]] - Using databases (MySQL, SQLite).&lt;br /&gt;
*[[Timers (SourceMod Scripting)|Timers]] - Timed callbacks.&lt;br /&gt;
*[[DataPacks|DataPacks]] -  A good way to store asynchronous data.&lt;br /&gt;
*[[Translations (SourceMod Scripting)|Translations]] - Internationalization.&lt;br /&gt;
*[[Entity References (SourceMod)|Entity References]] - A safe way of storing entities.&lt;br /&gt;
*[[Checking Admin Flags (SourceMod Scripting)|Checking Admin Flags]] - Limit commands to certain users&lt;br /&gt;
&lt;br /&gt;
===Advanced API===&lt;br /&gt;
*[[Admin API (SourceMod)|Administration API]] - Using the Admin Cache.&lt;br /&gt;
*[[Admin Menu (SourceMod Scripting)|Admin Menu API]] - Attaching to the Admin Menu.&lt;br /&gt;
*[[Creating Natives (SourceMod Scripting)|Creating Natives]] - Exposing API to other plugins.&lt;br /&gt;
*[[Function Calling API (SourceMod Scripting)|Function Calling API]] - Calling external functions.&lt;br /&gt;
*[[Optional Requirements (SourceMod Scripting)|Optional Requirements]] - Managing dependencies.&lt;br /&gt;
*[[SDKTools (SourceMod Scripting)|SDKTools]] - Using the powerful SDK abstraction layer.&lt;br /&gt;
*[[SDKHooks]] - Using SDKHooks, that provide additional hooks and functions.&lt;br /&gt;
*[[TempEnts (SourceMod SDKTools)|Temporary Entities]] - Using temporary entities.&lt;br /&gt;
&lt;br /&gt;
===Information===&lt;br /&gt;
*[[Format Class Functions (SourceMod Scripting)|Format Class Functions]] - All about text formatting.&lt;br /&gt;
*[[Handles (SourceMod Scripting)|Handles]] - Overview of Handles and some common types.&lt;br /&gt;
*[[Optimizing Plugins (SourceMod Scripting)|Optimizing Plugins]] - Optimization hints.&lt;br /&gt;
*&amp;lt;s&amp;gt;[[Tags (Scripting)|Tags]] - All about tags.&amp;lt;/s&amp;gt;&lt;br /&gt;
*[[Vectors Explained (Scripting)|Vectors Explained]] - Explanation of Vector types.&lt;br /&gt;
&lt;br /&gt;
===Resources===&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
*[[Entity Properties]] - Explanation of Source entity properties.&lt;br /&gt;
*[[Game Events (Source)|Game Events]] - Game events listings for popular mods.&lt;br /&gt;
*[[Mod TempEnt List (Source)|Temp Entity Lists]] - Temporary entities for popular mods.&lt;br /&gt;
*[[SourceMod Profiler]] - Performance tracking and optimizing.&lt;br /&gt;
*[[Vice_keys]] - Decryption keys for ctx files&lt;br /&gt;
*[[Weapon Names(Source)]] - Weapon Names / weapon entity names&lt;br /&gt;
[[Category:SourceMod]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11864</id>
		<title>Category:SourceMod Scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11864"/>
		<updated>2026-03-31T19:07:52Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ForDevelopers}}&lt;br /&gt;
&lt;br /&gt;
This category contains articles about scripting for SourceMod with SourcePawn.&lt;br /&gt;
&lt;br /&gt;
===Introductions===&lt;br /&gt;
*[[Introduction to SourcePawn 1.7]] - Learning language syntax.&lt;br /&gt;
*[[SourcePawn Transitional Syntax]] - Learning transitional syntax.&lt;br /&gt;
*[[Introduction to SourceMod Plugins]] - Writing your &amp;quot;first plugin.&amp;quot;&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
&lt;br /&gt;
===Basic API===&lt;br /&gt;
*[[AutoConfigs (SourceMod Scripting)|AutoConfigs]] - Automatic .cfg creation for cvars.&lt;br /&gt;
*[[Commands (SourceMod Scripting)|Commands]] - Console commands/input.&lt;br /&gt;
*[[ConVars (SourceMod Scripting)|ConVars]] - Console variables (cvars).&lt;br /&gt;
*[[Events (SourceMod Scripting)|Events]] - Half-Life 2 Game Events.&lt;br /&gt;
*[[KeyValues (SourceMod Scripting)|KeyValues]] - KeyValues file parsing/writing.&lt;br /&gt;
*[[Menu API (SourceMod)|Menus]] - Building and drawing menus.&lt;br /&gt;
*[[SQL (SourceMod Scripting)|SQL]] - Using databases (MySQL, SQLite).&lt;br /&gt;
*[[Timers (SourceMod Scripting)|Timers]] - Timed callbacks.&lt;br /&gt;
*[[DataPacks|DataPacks]] -  A good way to store asynchronous data.&lt;br /&gt;
*[[Translations (SourceMod Scripting)|Translations]] - Internationalization.&lt;br /&gt;
*[[Entity References (SourceMod)|Entity References]] - A safe way of storing entities.&lt;br /&gt;
*[[Checking Admin Flags (SourceMod Scripting)|Checking Admin Flags]] - Limit commands to certain users&lt;br /&gt;
&lt;br /&gt;
===Advanced API===&lt;br /&gt;
*[[Admin API (SourceMod)|Administration API]] - Using the Admin Cache.&lt;br /&gt;
*[[Admin Menu (SourceMod Scripting)|Admin Menu API]] - Attaching to the Admin Menu.&lt;br /&gt;
*[[Creating Natives (SourceMod Scripting)|Creating Natives]] - Exposing API to other plugins.&lt;br /&gt;
*[[Function Calling API (SourceMod Scripting)|Function Calling API]] - Calling external functions.&lt;br /&gt;
*[[Optional Requirements (SourceMod Scripting)|Optional Requirements]] - Managing dependencies.&lt;br /&gt;
*[[SDKTools (SourceMod Scripting)|SDKTools]] - Using the powerful SDK abstraction layer.&lt;br /&gt;
*[[SDKHooks]] - Using SDKHooks, that provide additional hooks and functions.&lt;br /&gt;
*[[TempEnts (SourceMod SDKTools)|Temporary Entities]] - Using temporary entities.&lt;br /&gt;
&lt;br /&gt;
===Information===&lt;br /&gt;
*[[Format Class Functions (SourceMod Scripting)|Format Class Functions]] - All about text formatting.&lt;br /&gt;
*[[Handles (SourceMod Scripting)|Handles]] - Overview of Handles and some common types.&lt;br /&gt;
*[[Optimizing Plugins (SourceMod Scripting)|Optimizing Plugins]] - Optimization hints.&lt;br /&gt;
&amp;lt;s&amp;gt;*[[Tags (Scripting)|Tags]] - All about tags.&amp;lt;/s&amp;gt;&lt;br /&gt;
*[[Vectors Explained (Scripting)|Vectors Explained]] - Explanation of Vector types.&lt;br /&gt;
&lt;br /&gt;
===Resources===&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
*[[Entity Properties]] - Explanation of Source entity properties.&lt;br /&gt;
*[[Game Events (Source)|Game Events]] - Game events listings for popular mods.&lt;br /&gt;
*[[Mod TempEnt List (Source)|Temp Entity Lists]] - Temporary entities for popular mods.&lt;br /&gt;
*[[SourceMod Profiler]] - Performance tracking and optimizing.&lt;br /&gt;
*[[Vice_keys]] - Decryption keys for ctx files&lt;br /&gt;
*[[Weapon Names(Source)]] - Weapon Names / weapon entity names&lt;br /&gt;
[[Category:SourceMod]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11863</id>
		<title>Category:SourceMod Scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Category:SourceMod_Scripting&amp;diff=11863"/>
		<updated>2026-03-31T18:59:50Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: added SDKHooks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{ForDevelopers}}&lt;br /&gt;
&lt;br /&gt;
This category contains articles about scripting for SourceMod with SourcePawn.&lt;br /&gt;
&lt;br /&gt;
===Introductions===&lt;br /&gt;
*[[Introduction to SourcePawn 1.7]] - Learning language syntax.&lt;br /&gt;
*[[SourcePawn Transitional Syntax]] - Learning transitional syntax.&lt;br /&gt;
*[[Introduction to SourceMod Plugins]] - Writing your &amp;quot;first plugin.&amp;quot;&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
&lt;br /&gt;
===Basic API===&lt;br /&gt;
*[[AutoConfigs (SourceMod Scripting)|AutoConfigs]] - Automatic .cfg creation for cvars.&lt;br /&gt;
*[[Commands (SourceMod Scripting)|Commands]] - Console commands/input.&lt;br /&gt;
*[[ConVars (SourceMod Scripting)|ConVars]] - Console variables (cvars).&lt;br /&gt;
*[[Events (SourceMod Scripting)|Events]] - Half-Life 2 Game Events.&lt;br /&gt;
*[[KeyValues (SourceMod Scripting)|KeyValues]] - KeyValues file parsing/writing.&lt;br /&gt;
*[[Menu API (SourceMod)|Menus]] - Building and drawing menus.&lt;br /&gt;
*[[SQL (SourceMod Scripting)|SQL]] - Using databases (MySQL, SQLite).&lt;br /&gt;
*[[Timers (SourceMod Scripting)|Timers]] - Timed callbacks.&lt;br /&gt;
*[[DataPacks|DataPacks]] -  A good way to store asynchronous data.&lt;br /&gt;
*[[Translations (SourceMod Scripting)|Translations]] - Internationalization.&lt;br /&gt;
*[[Entity References (SourceMod)|Entity References]] - A safe way of storing entities.&lt;br /&gt;
*[[Checking Admin Flags (SourceMod Scripting)|Checking Admin Flags]] - Limit commands to certain users&lt;br /&gt;
&lt;br /&gt;
===Advanced API===&lt;br /&gt;
*[[Admin API (SourceMod)|Administration API]] - Using the Admin Cache.&lt;br /&gt;
*[[Admin Menu (SourceMod Scripting)|Admin Menu API]] - Attaching to the Admin Menu.&lt;br /&gt;
*[[Creating Natives (SourceMod Scripting)|Creating Natives]] - Exposing API to other plugins.&lt;br /&gt;
*[[Function Calling API (SourceMod Scripting)|Function Calling API]] - Calling external functions.&lt;br /&gt;
*[[Optional Requirements (SourceMod Scripting)|Optional Requirements]] - Managing dependencies.&lt;br /&gt;
*[[SDKTools (SourceMod Scripting)|SDKTools]] - Using the powerful SDK abstraction layer.&lt;br /&gt;
*[[SDKHooks]] - Using SDK Hooks, that provide additional hooks.&lt;br /&gt;
*[[TempEnts (SourceMod SDKTools)|Temporary Entities]] - Using temporary entities.&lt;br /&gt;
&lt;br /&gt;
===Information===&lt;br /&gt;
*[[Format Class Functions (SourceMod Scripting)|Format Class Functions]] - All about text formatting.&lt;br /&gt;
*[[Handles (SourceMod Scripting)|Handles]] - Overview of Handles and some common types.&lt;br /&gt;
*[[Optimizing Plugins (SourceMod Scripting)|Optimizing Plugins]] - Optimization hints.&lt;br /&gt;
*[[Tags (Scripting)|Tags]] - All about tags.&lt;br /&gt;
*[[Vectors Explained (Scripting)|Vectors Explained]] - Explanation of Vector types.&lt;br /&gt;
&lt;br /&gt;
===Resources===&lt;br /&gt;
*[https://sm.alliedmods.net/new-api/ API Reference] - Searchable scripting API reference.&lt;br /&gt;
*[[Entity Properties]] - Explanation of Source entity properties.&lt;br /&gt;
*[[Game Events (Source)|Game Events]] - Game events listings for popular mods.&lt;br /&gt;
*[[Mod TempEnt List (Source)|Temp Entity Lists]] - Temporary entities for popular mods.&lt;br /&gt;
*[[SourceMod Profiler]] - Performance tracking and optimizing.&lt;br /&gt;
*[[Vice_keys]] - Decryption keys for ctx files&lt;br /&gt;
*[[Weapon Names(Source)]] - Weapon Names / weapon entity names&lt;br /&gt;
[[Category:SourceMod]]&lt;br /&gt;
[[Category:SourceMod Development]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Format_Class_Functions_(SourceMod_Scripting)&amp;diff=11862</id>
		<title>Format Class Functions (SourceMod Scripting)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Format_Class_Functions_(SourceMod_Scripting)&amp;diff=11862"/>
		<updated>2026-03-31T18:49:52Z</updated>

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

		<summary type="html">&lt;p&gt;Luki1412: Added warning template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;margin:0.5em;padding:0.3em;border-width: 2px; border-color: Orange; border-style:solid;color:DarkOrange;background-color:rgb(255, 240, 210);&amp;quot;&lt;br /&gt;
| [[File:Warning.png|text-bottom|link=|alt=]] || '''Warning:''' || {{{1}}}&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11860</id>
		<title>Template:Note</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11860"/>
		<updated>2025-12-31T18:34:59Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Replaced with a table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;margin:0.5em;padding:0.3em;border-width: 2px; border-color: Blue; border-style:solid;color:blue;background-color:rgb(200 230 255);&amp;quot;&lt;br /&gt;
| [[File:Note.png|text-bottom|link=|alt=]] || '''Note:''' || {{{1}}}&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:HandleType&amp;diff=11859</id>
		<title>Template:HandleType</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:HandleType&amp;diff=11859"/>
		<updated>2025-12-31T18:28:42Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added color and left border&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;border-left: 2px solid darkred&amp;quot;&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;color:darkred&amp;quot; | '''Type''':&lt;br /&gt;
 | {{{1}}}&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;color:darkred&amp;quot; | '''Closeable''': &lt;br /&gt;
 | {{{2}}}&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;color:darkred&amp;quot; | '''Cloneable''':&lt;br /&gt;
 | {{{3}}}&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;color:darkred&amp;quot; | '''API''':&lt;br /&gt;
 | {{{4}}}&lt;br /&gt;
 |-&lt;br /&gt;
 | style=&amp;quot;color:darkred&amp;quot; | '''Found in''':&lt;br /&gt;
 | {{{5}}}&lt;br /&gt;
 |}&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11858</id>
		<title>Template:Note</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11858"/>
		<updated>2025-12-31T18:20:42Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;margin:0.4em 1em;padding:0.3em;border-width: 2px; border-color: Blue; border-style:solid;display:inline;color:blue;background-color:rgb(200 230 255);&amp;quot;&amp;gt;&amp;lt;strong style=&amp;quot;display:table-cell;text-align:right;white-space:nowrap;padding-right:0.3em;&amp;quot;&amp;gt;[[File:Note.png|text-bottom|link=|alt=]] Note:&amp;lt;/strong&amp;gt;&amp;lt;span style=&amp;quot;display:table-cell;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11857</id>
		<title>Template:Note</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11857"/>
		<updated>2025-12-31T18:07:01Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;margin:0.4em 1em;padding:0.3em;border-width: 2px; border-color: Blue; border-style:solid;display:inline;color:blue;background-color:rgb(190 220 255);&amp;quot;&amp;gt;&amp;lt;strong style=&amp;quot;display:table-cell;text-align:right;white-space:nowrap;padding-right:0.3em;&amp;quot;&amp;gt;[[File:Note.png|text-bottom|link=|alt=]] Note:&amp;lt;/strong&amp;gt;&amp;lt;span style=&amp;quot;display:table-cell;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11856</id>
		<title>Template:Note</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11856"/>
		<updated>2025-12-31T18:05:44Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added background&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;margin:0.4em 1em;padding:0.3em;border-width: 2px; border-color: Blue; border-style:solid;display:inline;color:blue;background-color:rgb(170 200 255);&amp;quot;&amp;gt;&amp;lt;strong style=&amp;quot;display:table-cell;text-align:right;white-space:nowrap;padding-right:0.3em;&amp;quot;&amp;gt;[[File:Note.png|link=|alt=]] Note:&amp;lt;/strong&amp;gt;&amp;lt;span style=&amp;quot;display:table-cell;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11855</id>
		<title>Template:Note</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11855"/>
		<updated>2025-12-31T17:56:06Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Changed text color&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;margin:0.4em 1em;padding:0.3em;border-width: 2px; border-color: Blue; border-style:solid;display:inline;color:blue&amp;quot;&amp;gt;&amp;lt;strong style=&amp;quot;display:table-cell;text-align:right;white-space:nowrap;padding-right:0.3em;&amp;quot;&amp;gt;[[File:Note.png|link=|alt=]] Note:&amp;lt;/strong&amp;gt;&amp;lt;span style=&amp;quot;display:table-cell;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11854</id>
		<title>Template:Note</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:Note&amp;diff=11854"/>
		<updated>2025-12-31T17:55:20Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added border and padding and changed to inline&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;margin:0.4em 1em;padding:0.3em;border-width: 2px; border-color: Blue; border-style:solid;display:inline&amp;quot;&amp;gt;&amp;lt;strong style=&amp;quot;display:table-cell;text-align:right;white-space:nowrap;padding-right:0.3em;&amp;quot;&amp;gt;[[File:Note.png|link=|alt=]] Note:&amp;lt;/strong&amp;gt;&amp;lt;span style=&amp;quot;display:table-cell;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:ForAdvancedDevelopers&amp;diff=11853</id>
		<title>Template:ForAdvancedDevelopers</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:ForAdvancedDevelopers&amp;diff=11853"/>
		<updated>2025-12-31T17:22:11Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added the link to the scripting category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;padding: 0.75em 1.5em; border-width: 2px; border-color: Orange; border-style:solid; background-color: Moccasin; max-width: 60rem;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Wires.png|frameless|128px|left|link=|alt=]]&lt;br /&gt;
&amp;lt;b style=&amp;quot;font-size: 20px&amp;quot;&amp;gt;&lt;br /&gt;
For Internal Development&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This page is geared towards helping developers learn how to use the behind-the-scenes parts of {{{1|SourceMod}}} itself.&lt;br /&gt;
If you're looking to contribute to or extend {{{1|SourceMod}}}, this is probably the page for you!&lt;br /&gt;
To learn how to create and modify SourceMod plugins, check out the '''[[:Category:SourceMod_Scripting|scripting]]''' categories for articles about scripting for SourceMod with SourcePawn.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:ForSysadmins&amp;diff=11852</id>
		<title>Template:ForSysadmins</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:ForSysadmins&amp;diff=11852"/>
		<updated>2025-12-31T17:16:16Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added the link to the development category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;padding: 0.75em 1.5em; border-width: 2px; border-color: LightPink; border-style:solid; background-color: MistyRose; max-width: 60rem;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:FlorkSunglasses.png|frameless|64px|left|link=|alt=]]&lt;br /&gt;
&amp;lt;b style=&amp;quot;font-size: 20px&amp;quot;&amp;gt;&lt;br /&gt;
For System Administrators&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This page is geared towards helping a sysadmin install, manage, and maintain a {{{1|SourceMod}}} installation.&lt;br /&gt;
If you're looking to create, develop, or modify {{{1|SourceMod}}} plugins, check out the '''[[:Category:SourceMod_Development|development]]''' pages for relevant documentation.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Template:ForDevelopers&amp;diff=11851</id>
		<title>Template:ForDevelopers</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Template:ForDevelopers&amp;diff=11851"/>
		<updated>2025-12-31T17:00:01Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added the link to the documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;padding: 0.75em 1.5em; border-width: 2px; border-color: LightSeaGreen; border-style:solid; background-color: Azure; max-width: 60rem;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Silly goose.png|frameless|64px|left|link=|alt=]]&lt;br /&gt;
&amp;lt;b style=&amp;quot;font-size: 20px&amp;quot;&amp;gt;&lt;br /&gt;
For Developers &amp;amp; Modders&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
This page is geared towards helping developers learn how to create and modify {{{1|SourceMod}}} plugins.&lt;br /&gt;
To learn how to install and manage {{{1|SourceMod}}} itself, check out the '''[[:Category:SourceMod_Documentation|documentation]]''' categories for system-administrator geared articles.&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=User_talk:Luki1412&amp;diff=11850</id>
		<title>User talk:Luki1412</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=User_talk:Luki1412&amp;diff=11850"/>
		<updated>2025-11-20T17:12:17Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Created page with &amp;quot;We can talk maybe&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We can talk maybe&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=User:Luki1412&amp;diff=11849</id>
		<title>User:Luki1412</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=User:Luki1412&amp;diff=11849"/>
		<updated>2025-11-20T17:11:04Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Created page with &amp;quot;Why are you here?  Go [https://forums.alliedmods.net/member.php?u=43109 here] instead&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Why are you here?&lt;br /&gt;
&lt;br /&gt;
Go [https://forums.alliedmods.net/member.php?u=43109 here] instead&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=DataPacks&amp;diff=11848</id>
		<title>DataPacks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=DataPacks&amp;diff=11848"/>
		<updated>2025-11-15T14:29:44Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added link to Timers/DataTimers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DataPacks are a way to store and move around various types of data in [[:Category:SourceMod Scripting|SourceMod Scripting]]. Since some things are not possible in SourcePawn, such as a function consuming a String, DataPacks help us get these Strings and other items where they need to go.&lt;br /&gt;
&lt;br /&gt;
=Example of using a DataPack=&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;&lt;br /&gt;
//writing&lt;br /&gt;
DataPack pack = new DataPack();&lt;br /&gt;
pack.WriteCell(23);&lt;br /&gt;
pack.WriteString(&amp;quot;I'm a little teapot.&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
//reading&lt;br /&gt;
pack.Reset(); //resets the index to the beginning, necessary for read.&lt;br /&gt;
int cellValue = pack.ReadCell();&lt;br /&gt;
char buffer[1024];&lt;br /&gt;
pack.ReadString(buffer, 1024);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Creating a DataPack=&lt;br /&gt;
Creating a DataPack is very simple; all you need is a Handle to write to.&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;Datapack dataPackHandle = new DataPack();&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information on using Handles, see [[Handle API (SourceMod)]].&lt;br /&gt;
&lt;br /&gt;
=DataPack Functions=&lt;br /&gt;
On you have created your DataPack, you can use a variety of functions to manage the DataPack.&lt;br /&gt;
&lt;br /&gt;
==WritePackCell==&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native void WritePackCell(Handle pack, any cell);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WritePackFloat==&lt;br /&gt;
This function can be used to write a Float to a DataPack.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native void WritePackFloat(Handle pack, float val);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WritePackString==&lt;br /&gt;
This function can be used to write a String to a DataPack.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native void WritePackString(Handle pack, const char[] str);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ReadPackCell==&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native any ReadPackCell(Handle pack);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ReadPackFloat==&lt;br /&gt;
This function can be used to read a Float from a DataPack.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native float ReadPackFloat(Handle pack);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ReadPackString==&lt;br /&gt;
This function can be used to read a String from a DataPack.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native void ReadPackString(Handle pack, char[] buffer, maxlen);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ResetPack==&lt;br /&gt;
This function resets your position in the DataPack.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native void ResetPack(Handle pack, bool clear=false);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetPackPosition==&lt;br /&gt;
This function gets your current position in the DataPack.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native int GetPackPosition(Handle pack);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetPackPosition==&lt;br /&gt;
This function sets your current position in the DataPack.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;native void SetPackPosition(Handle pack, int position);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Disposing of a DataPack=&lt;br /&gt;
To dispose of a DataPack, all you have to do is close its Handle.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;CloseHandle(dataPackHandle);&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=DataTimers=&lt;br /&gt;
DataPacks can be used with timers, in order to send more than one value. For more information, visit [[Timers_(SourceMod_Scripting)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11847</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11847"/>
		<updated>2025-09-07T17:24:19Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
SDKHooks blocks hooking the same hook twice.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
Not all games use FireBullets so this hook will not trigger in such games.&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
Called before OnGameFrame(), but only for the hooked entity.&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Triggers when the hooked entity is about to spawn. Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
Triggers when the hooked entity was spawned.&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
Triggers when the hooked entity is about to be touched by another entity. Not all entities can trigger/fire touch events. Adjusting collision groups for the entity can fix that.&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
Triggers when the hooked entity is about to update.&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggers when the hooked weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
Triggers when the hooked weapon was dropped.&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
Triggers when the hooked weapon is about to be equipped.&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
Triggers when the hooked weapon was equipped.&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
Triggers when the hooked weapon is about to be switched for another one.&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
Triggers when the hooked weapon was switched for another one.&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11846</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11846"/>
		<updated>2025-09-07T15:35:07Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
Not all games use FireBullets so this hook will not trigger in such games.&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
Called before OnGameFrame(), but only for the hooked entity.&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Triggers when the hooked entity is about to spawn. Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
Triggers when the hooked entity was spawned.&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
Triggers when the hooked entity is about to be touched by another entity. Not all entities can trigger/fire touch events. Adjusting collision groups for the entity can fix that.&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
Triggers when the hooked entity is about to move.&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggers when the hooked weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
Triggers when the hooked weapon was dropped.&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
Triggers when the hooked weapon is about to be equipped.&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
Triggers when the hooked weapon was equipped.&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
Triggers when the hooked weapon is about to be switched for another one.&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
Triggers when the hooked weapon was switched for another one.&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11845</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11845"/>
		<updated>2025-09-07T15:25:06Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
Called before OnGameFrame(), but only for the hooked entity.&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Triggers when the hooked entity is about to spawn. Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
Triggers when the hooked entity was spawned.&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
Triggers when the hooked entity is about to be touched by another entity. Not all entities can trigger/fire touch events. Adjusting collision groups for the entity can fix that.&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
Triggers when the hooked entity is about to move.&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggers when the hooked weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
Triggers when the hooked weapon was dropped.&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
Triggers when the hooked weapon is about to be equipped.&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
Triggers when the hooked weapon was equipped.&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
Triggers when the hooked weapon is about to be switched for another one.&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
Triggers when the hooked weapon was switched for another one.&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11844</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11844"/>
		<updated>2025-09-07T14:10:41Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Triggers when the hooked entity is about to spawn. Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
Triggers when the hooked entity was spawned.&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
Triggers when the hooked entity is about to be touched by another entity. Not all entities can trigger/fire touch events. Adjusting collision groups for the entity can fix that.&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggers when the hooked weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
Triggers when the hooked weapon was dropped.&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
Triggers when the hooked weapon is about to be equipped.&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
Triggers when the hooked weapon was equipped.&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
Triggers when the hooked weapon is about to be switched.&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
Triggers when the hooked weapon was switched.&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11843</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11843"/>
		<updated>2025-09-07T13:59:31Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Triggers when the hooked entity is about to spawn. Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
Triggers when the hooked entity was spawned.&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
Triggers when the hooked entity is about to be touched by another entity. Not all entities can trigger/fire touch events. Adjusting collision groups for the entity can fix that.&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggers when the hooked weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
Triggers when the hooked was dropped.&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
Triggers when the hooked weapon is about to be equipped.&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
Triggers when the hooked weapon was equipped.&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11842</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11842"/>
		<updated>2025-09-07T13:57:39Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Triggers when the hooked entity is about to spawn. Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
Triggers when the hooked entity was spawned.&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
Triggers when the hooked entity is about to be touched by another entity. Not all entity can trigger/fire touch events.&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggered when the hooked weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
Triggered when the hooked was dropped.&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
Triggered when the hooked weapon is about to be equipped.&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
Triggered when the hooked weapon was equipped.&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11841</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11841"/>
		<updated>2025-09-07T13:33:04Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
Entity creation and spawn are not the same thing. Some entity properties are not available until the entity spawns. This hook is before the entity spawns.&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
Triggered when a weapon is about to be dropped.&lt;br /&gt;
====Under TF2====&lt;br /&gt;
When a weapon is dropped in tf2, a new entity is created called tf_dropped_weapon and this new entity is not the same entity as the one that player had equipped nor do they share entity IDs. They share the m_iAccountID property however, which contains the steam ID of the owner of the weapon that dropped it. You cannot prevent weapon drop through this hook in TF2.&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11840</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11840"/>
		<updated>2025-09-07T13:03:40Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
===SDKHook_Blocked===&lt;br /&gt;
===SDKHook_BlockedPost===&lt;br /&gt;
===SDKHook_CanBeAutobalanced===&lt;br /&gt;
===SDKHook_EndTouch===&lt;br /&gt;
===SDKHook_EndTouchPost===&lt;br /&gt;
===SDKHook_FireBulletsPost===&lt;br /&gt;
===SDKHook_GetMaxHealth===&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
===SDKHook_GroundEntChangedPost===&lt;br /&gt;
===SDKHook_OnTakeDamage===&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
&lt;br /&gt;
====Under CSS====&lt;br /&gt;
'''Non-regular cases for SDKHook_OnTakeDamage'''&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
'''Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive'''&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
====Under TF2====&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
'''Some damage types'''&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
===SDKHook_OnTakeDamagePost===&lt;br /&gt;
===SDKHook_OnTakeDamageAlive===&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
===SDKHook_OnTakeDamageAlivePost===&lt;br /&gt;
===SDKHook_PreThink===&lt;br /&gt;
===SDKHook_PreThinkPost===&lt;br /&gt;
===SDKHook_PostThink===&lt;br /&gt;
===SDKHook_PostThinkPost===&lt;br /&gt;
===SDKHook_Reload===&lt;br /&gt;
===SDKHook_ReloadPost===&lt;br /&gt;
===SDKHook_SetTransmit===&lt;br /&gt;
===SDKHook_ShouldCollide===&lt;br /&gt;
===SDKHook_Spawn===&lt;br /&gt;
===SDKHook_SpawnPost===&lt;br /&gt;
===SDKHook_StartTouch===&lt;br /&gt;
===SDKHook_StartTouchPost===&lt;br /&gt;
===SDKHook_Think===&lt;br /&gt;
===SDKHook_ThinkPost===&lt;br /&gt;
===SDKHook_Touch===&lt;br /&gt;
===SDKHook_TouchPost===&lt;br /&gt;
===SDKHook_TraceAttack===&lt;br /&gt;
===SDKHook_TraceAttackPost===&lt;br /&gt;
===SDKHook_Use===&lt;br /&gt;
===SDKHook_UsePost===&lt;br /&gt;
===SDKHook_VPhysicsUpdate===&lt;br /&gt;
===SDKHook_VPhysicsUpdatePost===&lt;br /&gt;
===SDKHook_WeaponCanSwitchTo===&lt;br /&gt;
===SDKHook_WeaponCanSwitchToPost===&lt;br /&gt;
===SDKHook_WeaponCanUse===&lt;br /&gt;
===SDKHook_WeaponCanUsePost===&lt;br /&gt;
===SDKHook_WeaponDrop===&lt;br /&gt;
===SDKHook_WeaponDropPost===&lt;br /&gt;
===SDKHook_WeaponEquip===&lt;br /&gt;
===SDKHook_WeaponEquipPost===&lt;br /&gt;
===SDKHook_WeaponSwitch===&lt;br /&gt;
===SDKHook_WeaponSwitchPost===&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11839</id>
		<title>SDKHooks</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SDKHooks&amp;diff=11839"/>
		<updated>2025-09-07T12:59:01Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Added other hooks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
SDKHooks was previously an external extension to Sourcemod. It was rolled in [https://wiki.alliedmods.net/Sourcemod_1.5.0_API_Changes#SDKHooks Sourcemod 1.5] and it does not need to be manually installed anymore.&lt;br /&gt;
&lt;br /&gt;
==Hooks==&lt;br /&gt;
Some information on various hooks below:&lt;br /&gt;
==SDKHook_Blocked==&lt;br /&gt;
==SDKHook_BlockedPost==&lt;br /&gt;
==SDKHook_CanBeAutobalanced==&lt;br /&gt;
==SDKHook_EndTouch==&lt;br /&gt;
==SDKHook_EndTouchPost==&lt;br /&gt;
==SDKHook_FireBulletsPost==&lt;br /&gt;
==SDKHook_GetMaxHealth==&lt;br /&gt;
  (ep2v and later)&lt;br /&gt;
==SDKHook_GroundEntChangedPost==&lt;br /&gt;
==SDKHook_OnTakeDamage==&lt;br /&gt;
inflictor (3rd argument) is the entity that inflicts the damage. If a player directly damages another, inflictor should be equal to the attacking player id. An example of an indirect damage would be a grenade.&lt;br /&gt;
==SDKHook_OnTakeDamagePost==&lt;br /&gt;
==SDKHook_OnTakeDamageAlive==&lt;br /&gt;
This hook works in a similar way to SDKHook_OnTakeDamage but it gives the [https://bugs.alliedmods.net/show_bug.cgi?id=6249#c7 actual, calculated damage amount done to the player. The pre-hook will fire after an OnTakeDamage pre-hook, and the post-hook will fire before an OnTakeDamage post-hook. The health is subtracted in between pre and post unless the hook is blocked.] {{pr|149}}&lt;br /&gt;
&lt;br /&gt;
[https://forums.alliedmods.net/showthread.php?p=2309798#post2309798 OnTakeDamageAlive is also only called for players.]&lt;br /&gt;
==SDKHook_OnTakeDamageAlivePost==&lt;br /&gt;
==SDKHook_PreThink==&lt;br /&gt;
==SDKHook_PreThinkPost==&lt;br /&gt;
==SDKHook_PostThink==&lt;br /&gt;
==SDKHook_PostThinkPost==&lt;br /&gt;
==SDKHook_Reload==&lt;br /&gt;
==SDKHook_ReloadPost==&lt;br /&gt;
==SDKHook_SetTransmit==&lt;br /&gt;
==SDKHook_ShouldCollide==&lt;br /&gt;
==SDKHook_Spawn==&lt;br /&gt;
==SDKHook_SpawnPost==&lt;br /&gt;
==SDKHook_StartTouch==&lt;br /&gt;
==SDKHook_StartTouchPost==&lt;br /&gt;
==SDKHook_Think==&lt;br /&gt;
==SDKHook_ThinkPost==&lt;br /&gt;
==SDKHook_Touch==&lt;br /&gt;
==SDKHook_TouchPost==&lt;br /&gt;
==SDKHook_TraceAttack==&lt;br /&gt;
==SDKHook_TraceAttackPost==&lt;br /&gt;
==SDKHook_Use==&lt;br /&gt;
==SDKHook_UsePost==&lt;br /&gt;
==SDKHook_VPhysicsUpdate==&lt;br /&gt;
==SDKHook_VPhysicsUpdatePost==&lt;br /&gt;
==SDKHook_WeaponCanSwitchTo==&lt;br /&gt;
==SDKHook_WeaponCanSwitchToPost==&lt;br /&gt;
==SDKHook_WeaponCanUse==&lt;br /&gt;
==SDKHook_WeaponCanUsePost==&lt;br /&gt;
==SDKHook_WeaponDrop==&lt;br /&gt;
==SDKHook_WeaponDropPost==&lt;br /&gt;
==SDKHook_WeaponEquip==&lt;br /&gt;
==SDKHook_WeaponEquipPost==&lt;br /&gt;
==SDKHook_WeaponSwitch==&lt;br /&gt;
==SDKHook_WeaponSwitchPost==&lt;br /&gt;
&lt;br /&gt;
==Under CSS==&lt;br /&gt;
===Non-regular cases for SDKHook_OnTakeDamage===&lt;br /&gt;
In the scenario where a player throw a grenade to another player then quickly disconnect, the attacker (2nd argument) will become the inflictor (3rd argument). &lt;br /&gt;
&lt;br /&gt;
In the scenario where a player fall; the attacker, which is also the inflictor, will be 0 (the world).&lt;br /&gt;
&lt;br /&gt;
In the scenario where a terrorist plants the bomb, when the bomb explodes, the attacker (2nd argument) will be the same as the inflictor (3rd argument) which will have the Classname &amp;quot;planted_c4&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Some damage types===&lt;br /&gt;
A normal HEGrenade and the C4 inflict damage of type DMG_BLAST.&lt;br /&gt;
&lt;br /&gt;
A fall inflicts damage of type DMG_FALL.&lt;br /&gt;
&lt;br /&gt;
A grenade impact (for instance a flash hitting a teammate) will inflict damage of type DMG_CLUB.&lt;br /&gt;
&lt;br /&gt;
A normal gun bullet and the knife will inflict damage of type (DMG_BULLET | DMG_NEVERGIB) (non-headshot) or (DMG_BULLET | DMG_NEVERGIB | (1 &amp;lt;&amp;lt; 30) ) (headshot).&lt;br /&gt;
&lt;br /&gt;
A single attack can trigger many SDKHook_OnTakeDamage; when a gun throws pullets for instance (shotgun and glock in burst-mode notably).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(Regarding SM/Admin damaged; maybe place this is another section if someone can be sure that this would occur on all mods)&lt;br /&gt;
&lt;br /&gt;
sm_slap does not trigger SDKHook_OnTakeDamage.&lt;br /&gt;
&lt;br /&gt;
sm_burn will trigger two different callback : an entity with the classname &amp;quot;entityflame&amp;quot; will deal once 0 damage of type DMG_BURN and once 1 damage of type (DMG_BURN | DMG_DIRECT) every tick.&lt;br /&gt;
&lt;br /&gt;
===Regarding SDKHook_OnTakeDamage and SDKHook_OnTakeDamageAlive===&lt;br /&gt;
&lt;br /&gt;
SDKHook_OnTakeDamage/Post is triggered when hitting a teammate with mp_friendlyfire 0 (except in TF2), but not SDKHook_OnTakeDamageAlive.&lt;br /&gt;
&lt;br /&gt;
==Under TF2==&lt;br /&gt;
Under TF2, the SDKHook_OnTakeDamage hook isn't 100% accurate, it's damage parameter is the weapon's base damage. the DMG_CRIT flag is for both crits and minicrits. Weapon spread and minicrit/crit damage is calculated after this call (in SDKHook_OnTakeDamageAlive/Post).&lt;br /&gt;
&lt;br /&gt;
===Some damage types===&lt;br /&gt;
Shotgun = DMG_BUCKSHOT | DMG_SLOWBURN&lt;br /&gt;
&lt;br /&gt;
Rocket Launcher = DMG_SLOWBURN | DMG_RADIATION | DMG_BLAST&lt;br /&gt;
&lt;br /&gt;
If a crit, |= DMG_CRIT&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Rcon&amp;diff=11838</id>
		<title>Rcon</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Rcon&amp;diff=11838"/>
		<updated>2025-09-02T19:51:36Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Rcon is a TCP/IP protocol for remote connections to the server console of a game server that supports it. This connection allows administering console commands directly to the server and therefore can be a security risk.&lt;br /&gt;
&lt;br /&gt;
More information about this protocol's implementation in source games can be found [https://developer.valvesoftware.com/wiki/Source_RCON_Protocol here].&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Rcon&amp;diff=11837</id>
		<title>Rcon</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Rcon&amp;diff=11837"/>
		<updated>2025-09-02T19:47:50Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Rcon is a TCP/IP protocol for remote connections to the server console of a game server that supports it. This connection allows administering console commands directly to the server therefore can be a security risk.&lt;br /&gt;
&lt;br /&gt;
More information about this protocol's implementation in source games can be found [https://developer.valvesoftware.com/wiki/Source_RCON_Protocol here]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Rcon&amp;diff=11836</id>
		<title>Rcon</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Rcon&amp;diff=11836"/>
		<updated>2025-09-02T19:46:34Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: Created page with &amp;quot;Rcon is a TCP/IP protocol for remote connections to the server console of a game server that supports it. This connection allows administering console commands directly to the...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Rcon is a TCP/IP protocol for remote connections to the server console of a game server that supports it. This connection allows administering console commands directly to the server.&lt;br /&gt;
&lt;br /&gt;
More information about this protocol's implementation in source games can be found here:[https://developer.valvesoftware.com/wiki/Source_RCON_Protocol]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Installing_SourceMod&amp;diff=11835</id>
		<title>Installing SourceMod</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Installing_SourceMod&amp;diff=11835"/>
		<updated>2025-09-02T19:19:32Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages|Installing_SourceMod}}&lt;br /&gt;
&lt;br /&gt;
Installing SourceMod is very simple, and it can be added with almost no configuration changes.&lt;br /&gt;
&lt;br /&gt;
=Prerequisites=&lt;br /&gt;
A GUI Web Browser to retrieve Metamod:Source and SourceMod compressed archives.&lt;br /&gt;
A tool to copy archive to your dedicated server host.&lt;br /&gt;
&lt;br /&gt;
SourceMod requires [[Metamod:Source]] 1.9.0 or higher (it is recommended that the latest version is used). [http://www.metamodsource.net/ Click here] to visit the Metamod:Source homepage. Instructions to install Metamod:Source manually can be found [[Installing Metamod:Source|here]].&lt;br /&gt;
&lt;br /&gt;
SourceMod will run on almost any mod built using the Source SDK. Only the latest release of a mod is officially supported.&lt;br /&gt;
&lt;br /&gt;
Valve sometimes makes changes in their games that break SourceMod between releases.  When this happens, you may need to install snapshot versions of Metamod:Source and SourceMod.  You can see if this is required on the [[Required Versions (SourceMod)|Required Versions]] page.&lt;br /&gt;
&lt;br /&gt;
=Uploading/Installing=&lt;br /&gt;
==Local Server==&lt;br /&gt;
To install [http://www.sourcemod.net/downloads.php SourceMod] locally, simply extract the &amp;lt;tt&amp;gt;.zip&amp;lt;/tt&amp;gt; (Windows) or &amp;lt;tt&amp;gt;.tar.gz&amp;lt;/tt&amp;gt; (Linux) package to your mod folder (i.e. &amp;lt;tt&amp;gt;cstrike&amp;lt;/tt&amp;gt; for Counter-Strike, &amp;lt;tt&amp;gt;dod&amp;lt;/tt&amp;gt; for Day of Defeat, et cetera).&lt;br /&gt;
&lt;br /&gt;
==Remote Server==&lt;br /&gt;
To install SourceMod remotely, first extract the &amp;lt;tt&amp;gt;.zip&amp;lt;/tt&amp;gt; (Windows) or &amp;lt;tt&amp;gt;.tar.gz&amp;lt;/tt&amp;gt; (Linux) package to your local computer (for example, your Desktop).  You will see an &amp;lt;tt&amp;gt;addons&amp;lt;/tt&amp;gt; folder.  &lt;br /&gt;
&lt;br /&gt;
Using a tool such as [https://encrypted.google.com/#q=FTP FTP], locate your mod folder (i.e. &amp;lt;tt&amp;gt;cstrike&amp;lt;/tt&amp;gt; for Counter-Strike:Source, &amp;lt;tt&amp;gt;dod&amp;lt;/tt&amp;gt; for Day of Defeat:Source, et cetera).  Underneath this folder, you should have an &amp;lt;tt&amp;gt;addons&amp;lt;/tt&amp;gt; folder (if not, Metamod:Source is probably not installed).  From your local &amp;lt;tt&amp;gt;addons&amp;lt;/tt&amp;gt; folder, upload the entire contents to your remote &amp;lt;tt&amp;gt;addons&amp;lt;/tt&amp;gt; folder.  When done, your remote &amp;lt;tt&amp;gt;addons&amp;lt;/tt&amp;gt; folder should have a &amp;lt;tt&amp;gt;sourcemod&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
&lt;br /&gt;
If you have trouble with these steps, you need to get acquainted with FTP and server management.  However, you can also ask your server provider for help.  Some providers also have web interfaces for managing your server.&lt;br /&gt;
&lt;br /&gt;
Alternatively, if you copied the tar.gz to your srcds directory, execute the following from the cstrike sub directory:&lt;br /&gt;
tar -xzf ../sourcemod-1.1.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
=Scripting folder=&lt;br /&gt;
The scripting folder addons\sourcemod\scripting contains sourcemod plugins source code and sourcemod plugin compiler. This folder is not needed for running sourcemod. It is used for plugin development and compilation.&lt;br /&gt;
&lt;br /&gt;
=Checking the Install=&lt;br /&gt;
Your folder layout should look like:&lt;br /&gt;
*&amp;lt;tt&amp;gt;[mod]&amp;lt;/tt&amp;gt; - Your mod's folder&lt;br /&gt;
**&amp;lt;tt&amp;gt;addons&amp;lt;/tt&amp;gt;&lt;br /&gt;
***&amp;lt;tt&amp;gt;metamod&amp;lt;/tt&amp;gt; - Metamod:Source&lt;br /&gt;
***&amp;lt;tt&amp;gt;sourcemod&amp;lt;/tt&amp;gt; - SourceMod&lt;br /&gt;
&lt;br /&gt;
Once SourceMod is uploaded/copied and configured with Metamod:Source, restart your server completely.  If it is local, shut it down and restart it.  If it is remote, you may need to ask your server provider for help.  However, it is often safe to issue a &amp;quot;quit&amp;quot; command via [[rcon]], since most providers will automatically restart your server.&lt;br /&gt;
&lt;br /&gt;
First, in your [[server console]] (not client console), type:&lt;br /&gt;
&amp;lt;pre&amp;gt;meta list&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the install worked, you will see something like:&lt;br /&gt;
&amp;lt;pre&amp;gt;] meta list&lt;br /&gt;
Listing 1 plugin:&lt;br /&gt;
    [01] SourceMod (1.1.0.2489) by AlliedModders LLC&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should then be able to use the SourceMod root console command, which can be invoked with simply:&lt;br /&gt;
&amp;lt;pre&amp;gt;sm&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;] sm version&lt;br /&gt;
 SourceMod Version Information:&lt;br /&gt;
    SourceMod Version: 1.1.0.2489&lt;br /&gt;
    SourcePawn Engine: SourcePawn 1.1, jit-x86 (build 1.1.0-svn)&lt;br /&gt;
    SourcePawn API: v1 = 4, v2 = 2&lt;br /&gt;
    Compiled on: Sep  5 2008 02:02:12&lt;br /&gt;
    http://www.sourcemod.net/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lastly, assuming you have already setup your administration user (if not, see [[Adding Admins (SourceMod)|this page]]), you can test the in game menu by joining the server, and in the client console type the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;sm_admin&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should see a menu popup with all you options.&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
If the install failed, you will generally see one of four symptoms.  &lt;br /&gt;
&lt;br /&gt;
==Metamod reports NOFILE or FAILED==&lt;br /&gt;
If &amp;quot;meta list&amp;quot; replies with something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;] meta list&lt;br /&gt;
Listing 1 plugin:&lt;br /&gt;
  [01] &amp;lt;NOFILE&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most likely, either the files are not located in the correct place, or the file could not be loaded.  For more information, use the following command (except use the correct list number):&lt;br /&gt;
&amp;lt;pre&amp;gt;meta info 1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Metamod lists no plugins==&lt;br /&gt;
If &amp;quot;meta list&amp;quot; replies with something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;] meta list&lt;br /&gt;
Listing 0 plugins:&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several causes of this error.&lt;br /&gt;
&lt;br /&gt;
# The most common cause is that sourcemod.vdf can't be located in the addons/metamod folder.  Verify that sourcemod.vdf is present in this folder.&lt;br /&gt;
# If sourcemod.vdf is present, make sure you are using the correct build of Sourcemod (zip = windows, tar.gz = linux).&lt;br /&gt;
&lt;br /&gt;
==Metamod says nothing==&lt;br /&gt;
If &amp;quot;meta list&amp;quot; has no reply at all, Metamod:Source is not properly installed. [[Installing Metamod:Source|This wiki page]] may provide you with clues on how to solve this problem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Documentation]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=Optimizing_Plugins_(SourceMod_Scripting)&amp;diff=11834</id>
		<title>Optimizing Plugins (SourceMod Scripting)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=Optimizing_Plugins_(SourceMod_Scripting)&amp;diff=11834"/>
		<updated>2025-09-02T19:11:40Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This guide contains some general suggestions as to how to improve local performance in your code. However, '''take note'''. Do not use this as a guide to prematurely optimizing your program. You should focus on making your scripts easily readable and maintainable. Premature optimization can make your code more complex, introducing bugs that you otherwise wouldn't have had.&lt;br /&gt;
&lt;br /&gt;
If you do notice performance problems on your server, and you think they are introduced by your plugin, there are a few steps you can take. The best way to start is to get a profiler. You can use the [[SourceMod Profiler]] to tell you how much time is being spent in script functions.&lt;br /&gt;
&lt;br /&gt;
However, if you are worried about your code, you can also try to estimate the cost of operations in your program. Anything that happens repeatedly in a small period of time - the contents of a loop, the body of a timer, an &amp;lt;tt&amp;gt;OnGameFrame&amp;lt;/tt&amp;gt; hook - are good targets.&lt;br /&gt;
&lt;br /&gt;
'''DISCLAIMER:''' The units of time in this article are comparative only. We estimate most SourcePawn operations as costing 1-10 cycles, where a cycle is measured in nanoseconds.&lt;br /&gt;
&lt;br /&gt;
=Estimating Cost=&lt;br /&gt;
&lt;br /&gt;
The goal of estimating cost is to figure out two things:&lt;br /&gt;
* How expensive an operation is, run only once.&lt;br /&gt;
* How many times the operation is repeated.&lt;br /&gt;
&lt;br /&gt;
Let's try this with a simple example loop below. Most syntactic language features have a simple cost. Natives can be trickier.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;for (int i = 0; i &amp;lt; strlen(string); i++)&lt;br /&gt;
{&lt;br /&gt;
    if (string[i] == '&amp;quot;')&lt;br /&gt;
    {&lt;br /&gt;
        return i;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, let's determine how many times this loop will run. If the length of &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; is ''n'', then the loop will run ''n'' times. Next, let's see what each iteration of the loop costs:&lt;br /&gt;
* &amp;lt;tt&amp;gt;strlen(string)&amp;lt;/tt&amp;gt;: This has to count all of the characters in |string|. Let's say counting a character costs 1 unit of time. Therefore, |strlen(string)| will cost ''n'' units of time.&lt;br /&gt;
* &amp;lt;tt&amp;gt;if (string[i] == '&amp;quot;')&amp;lt;/tt&amp;gt;: This contains an array load and comparison. Let's say those each cost 1 unit of time, totaling 2.&lt;br /&gt;
* &amp;lt;tt&amp;gt;i++&amp;lt;/tt&amp;gt;: This increments a local variable. Let's say that costs 1 unit of time.&lt;br /&gt;
&lt;br /&gt;
Therefore, every iteration of the loop costs &amp;lt;tt&amp;gt;n + 3&amp;lt;/tt&amp;gt; units of time.&lt;br /&gt;
&lt;br /&gt;
That means this loop may cost up to &amp;lt;tt&amp;gt;(n * (n + 3))&amp;lt;/tt&amp;gt; units of time. Now, if we know that &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; is always small - say, under 100 - that might not be a problem. But what happens if the string has 10,000 characters? Now, the loop will take over 100,000,000 units of time! If a &amp;quot;unit of time&amp;quot; is even as small as a nanosecond, that loop will take a whole tenth of a second, delaying the server by multiple frames!&lt;br /&gt;
&lt;br /&gt;
This example is easy to fix. We can identify that &amp;lt;tt&amp;gt;strlen&amp;lt;/tt&amp;gt; magnifies the cost of the loop, and rewrite it like this:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;int length = strlen(string);&lt;br /&gt;
for (int i = 0; i &amp;lt; length; i++)&lt;br /&gt;
{&lt;br /&gt;
    if (string[i] == '&amp;quot;')&lt;br /&gt;
    {&lt;br /&gt;
        return i;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the cost of this loop is just: &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; times a very, very small amount of time.&lt;br /&gt;
&lt;br /&gt;
=Avoid Large KeyValues=&lt;br /&gt;
KeyValues is an n-ary structure using linked lists.  This type of structure is extremely expensive to allocate and traverse.  While it might be suitable for tiny pieces of information (that is, under 10KB of data or so), its complexity growth is very poor.&lt;br /&gt;
&lt;br /&gt;
If you load KeyValues data, you should make an effort to, at the very least, cache its Handle so you don't need to reparse the file every time.  Caching its contents on a needed basis would be a bonus as well.&lt;br /&gt;
&lt;br /&gt;
If you're trying to use a KeyValues file with thousands of entries and updating/loading it on events such as player connections or disconnections, you will find that the structure will grow to an unmanageably slow size.  If that's the case, you should consider moving to something like SQLite or MySQL.&lt;br /&gt;
&lt;br /&gt;
=Consider using &amp;quot;switch&amp;quot; statements instead of &amp;quot;if else&amp;quot; statements where possible=&lt;br /&gt;
Consider the following code:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;&lt;br /&gt;
int iConVarMode = GetConVarInt(g_hCVMode);&lt;br /&gt;
&lt;br /&gt;
if (iConVarMode == 0)&lt;br /&gt;
{&lt;br /&gt;
   // do stuff&lt;br /&gt;
}&lt;br /&gt;
else if (iConVarMode == 1)&lt;br /&gt;
{&lt;br /&gt;
   // do stuff&lt;br /&gt;
}&lt;br /&gt;
else if (iConVarMode == 2)&lt;br /&gt;
{&lt;br /&gt;
   // do stuff&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
   // do stuff&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
Since we are checking the same variable for its value multiple times, it is better to use a switch statement here:&lt;br /&gt;
&amp;lt;sourcepawn&amp;gt;&lt;br /&gt;
int iConVarMode = GetConVarInt(g_hCVMode);&lt;br /&gt;
&lt;br /&gt;
switch (iConVarMode)&lt;br /&gt;
{&lt;br /&gt;
   case 0:&lt;br /&gt;
   {&lt;br /&gt;
      // do stuff&lt;br /&gt;
   }&lt;br /&gt;
   case 1:&lt;br /&gt;
   {&lt;br /&gt;
      // do stuff&lt;br /&gt;
   }&lt;br /&gt;
   case 2:&lt;br /&gt;
   {&lt;br /&gt;
      // do stuff&lt;br /&gt;
   }&lt;br /&gt;
   default:&lt;br /&gt;
   {&lt;br /&gt;
      // do stuff&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/sourcepawn&amp;gt;&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.alliedmods.net/index.php?title=SourceMod_Profiler&amp;diff=11833</id>
		<title>SourceMod Profiler</title>
		<link rel="alternate" type="text/html" href="https://wiki.alliedmods.net/index.php?title=SourceMod_Profiler&amp;diff=11833"/>
		<updated>2025-09-02T18:42:45Z</updated>

		<summary type="html">&lt;p&gt;Luki1412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SourceMod has built-in profiling support for plugins with integration into the game's &amp;quot;vprof&amp;quot; system.&lt;br /&gt;
&lt;br /&gt;
See the &amp;quot;sm prof&amp;quot; command for more details.&lt;br /&gt;
&lt;br /&gt;
Run the command &amp;quot;vprof_generate_report&amp;quot; after you start profiling, to generate a report txt file in the game folder server_root_folder\&amp;lt;game&amp;gt;\vprof&lt;br /&gt;
&lt;br /&gt;
[[Category:SourceMod Development]]&lt;br /&gt;
[[Category:SourceMod Scripting]]&lt;/div&gt;</summary>
		<author><name>Luki1412</name></author>
		
	</entry>
</feed>