AMX Mod X Documentation

AMX Mod X
AMX Mod X 1.60
Documentation

www.amxmodx.org
Copyright © 2003-2005 by the AMX Mod X Dev Team


Introduction

I. Introduction
Content:
  • About
  • Features


Introduction: About

1. Introduction: About
Content:
  • AMX Mod X
  • AMX Mod X and AMX Mod
a) AMX Mod X
AMX Mod X is a versatile Half-Life metamod plugin which is targetted toward server administration. It has a wide array of scripting capabilities so people can write "plugins", or files which add on to a mod's functionality. Plugins can take form in administrative services (adding new admin commands), statistcs generation (StatsX), fun additions (godmode, etc), gameplay changes (WC3, CSDM), and much, much more! You can also write modules to expand the functionality of AMX Mod Xand add to the scripting language.
b) AMX Mod X and AMX Mod
AMX Mod X was originally based on AMX Mod, a similar Half-Life modification by OLO. However, AMX Mod began to slip into poor project policies (lack of public input, no open source enforcement, no central source code maintained, and much more). Due to the dead appearance of the project as all maintainers had disappeared into oblivion, the AMX Mod X project was started. Since then, the AMX Mod X project has come a long way. Nearly every portion of AMX Mod has been either rewritten from the ground up, cleaned up, or changed to work in a new system. AMX Mod X is not AMX Mod. And better yet, it's almost fully backward compatible.


Introduction: Features

2. Introduction: Features
Content:
  • Features
  • Features for Developers
a) Features
  • Administration system
  • Scripting/plugin system
  • Module expansion system
  • Basic admin commands, such as:
    • Banning, kicking
    • Slap/slay
    • Chat
    • Reserve slot control
    • Flood protection
    • Weapon restriction
    • Statistics (in the style of StatsMe)
  • Dynamic menu system
b) Features for Developers
AMX Mod X has an integrated development API that can connect modules to Metamod and AMX Mod X. This easy, contained environment provides debugging, memory leak tracking, and rapid toolkit development.
With over 600 native functions and an easily expandable and interfaceable M/SDK, AMX Mod X is perfect for creating quick server solutions without having to muck around with the annoying details of making a Metamod plugin or an archaic AMX Mod module.

Plugins have the following advantages:
  • Registering client/console commands
  • Hooking almost all GameDLL and HL Engine functions
  • Calling almost all GameDLL and HL Engine functions
  • Catching and modifying events
  • Easily extracting information from entities and global settings
  • Creating/modifying CVARs
  • Interfacing to PostgreSQL, MySQL, or MS-SQL
  • Using TCP and UDP socket functions
  • Regular Expressions
  • New debugging system with stack trace support
  • Creation of in-game menus
  • Easy to use multi-lingual system
  • Architecture independent format (.amxx)
  • Game-specific natives for CS/CZ, DoD, TFC, TS, and NS
  • ... and more!
Modules have the following advantages:
  • Contained environment for tracking memory allocations
  • M/SDK that eliminates the need for .def files or outside explicit includes such as "modules.h"
  • Interface that is both forwards and backwards compatible, using a "request function by name" system.
  • Functions to interface with the AMX Mod X core, for general tasks such as getting internal player information and manipulating plugin data.
  • Modules use a router interface from Metamod called "FakeMeta", therefore they are contained from Metamod but compatible with it.


Installation

II. Installation
Content:
  • Automatic Tool
  • Manual


Installation: Automatic Tool

1. Installation: Automatic Tool
  1. Install the AMX Mod X Automated Installer by downloading the package.
  2. Go to Start -> Programs -> AMX Mod X -> Installer
  3. The installer will attempt to determine the different HL installations on your system.
    1. For Steam, there will be two options: Listen Server or Dedicated Server. Make sure you choose the right one.
    2. Other installations detected will be 3rd-party and Valve mods in Steam, as well as HLDS installations (HLServer).
    3. If your installation does not appear on the menu, you can browse for the right folder containing your mod(s).
    4. Lastly, you have the option of installing AMX Mod X remotely over FTP. You will be asked to enter the host, username, and password to access your server. If the installer cannot detect a mod or HL installation properly, it will ask you to select a folder remotely on your FTP.

  4. If you already have an AMX Mod X installation, you will be asked if you want to upgrade. This will preserve your configuration options. This is a good idea, but in general you should make an effort to see if there were any new options added. You will also be asked in the same menu if you would like to remove AMX Mod X - this will simply disable it, you will need to delete the files yourself.
  5. The installer will then copy the files to your server and install+configure metamod (old metamod plugins will not be overwritten and plugins.ini will not be erased, just appended).
  6. If you are using a mod which has extra support (currently CS, CZ, DoD, TFC, TS, and NS), then you will be asked if you want to install the addon package for it. You will usually want to click Yes.
  7. You should be all finished! Exit the program and restart your server. Continue the installation with the Configuration section. For problems, visit the Troubleshooting section.


Installation: Manual

2. Installation: Manual
Content:
  • Introduction
  • Directory structure
  • Metamod
  • AMX Mod X
  • Configuration
a) Introduction
There are a few ways you can install AMX Mod X. If you have shell or direct access to your server, you can do all operations directly on the server itself. If you only have FTP access, it's best to install AMX Mod X on a "dummy" folder on your hard drive, do all configuration there, and then upload the files to your server. Otherwise, you can upload the files as you're installing and then use FTP to change things along the way.
Throughout the documentation we'll refer to your "mod folder" - this is the folder your mod is stored in, like "cstrike", or "dod", for example. If you're installing on a listen server, it will be somewhere in \Program Files\Steam\SteamApps\<your steam login>\<Valve game or Half-Life>\<mod folder>. If you're using a dedicated server, it will be HLServer\<mod folder>. On linux this is hlds_l/<mod folder>. If you are using remote/FTP access, you may be restricted to your mod folder or hlds_l already, and don't need to find it. For this documentation, <mod folder> will refer to the mod folder mentioned above. For Linux users, binaries will not end in ".dll", they will usually end in "_i386.so" or "_amd64.so" for AMD64 machines.
b) Directory structure
You should familiarize yourself with the directory structure for AMX Mod X now.
addons\ - this is where Server addons go
metamod\ - this is where Metamod goes. Metamod is necessary to run AMX Mod X
dlls\ - this is where Metamod's binaries go
amxmodx\ - this is where AMX Mod X goes
dlls\ - amxmodx_mm.dll should go here
modules\ - Where modules are stored (_amxx.dll or _amxx_i386.so etc)
plugins\ - Where plugins are stored (.amx or .amxx)
scripting\ - Where example source code and the compiler/assembler are stored
include\ - Where include files for source code is stored
compiled\ - Where the compiler batch file stores .amxx output
doc\ - This documentation is kept here
data\ - Binary data, for example saved stats, language caches, and GeoIP information
lang\ - Dictionary text files for AMX Mod X ML features (multi lingual)
configs\ - Configuration files
logs\ - AMX Mod X log files
c) Metamod
  1. If you already have metamod installed, you may skip to step e.
    In your mod folder, create a folder called "addons".
    In <mod folder>\addons, create a folder called "metamod".
    In <mod folder>\addons\metamod, create a folder called "dlls".
  2. Go to www.metamod.org and download the appropriate version of Metamod (either Windows, Linux, or Linux AMD64).
  3. Extract the metamod binary into <mod folder>\addons\metamod\dlls.
  4. Edit the file <mod folder>\liblist.gam with a text-editor like Notepad.
    For windows, find the gamedll line. It will look like this:
    gamedll "dlls\mp.dll"
    Replace it with:
    gamedll "addons\metamod\dlls\metamod.dll"
    For Linux, find the gamedll line. It will look like this:
    gamedll_linux "dlls/mp_i386.so"
    Replace it with:
    gamedll_linux "addons/metamod/dlls/metamod_i386.so"
    *NOTE: use metamod_amd64.so for AMD64 servers.
  5. Edit the file <mod folder>\addons\metamod\plugins.ini. If it does not exist, create it.
  6. If you are upgrading from AMX or AMX Mod X 0.1x, skip to step h.
  7. Add a line to <mod folder>\addons\metamod\plugins.ini like so: Windows:
    win32 addons\amxmodx\dlls\amxmodx_mm.dll
    Linux:
    linux addons/amxmodx/dlls/amxmodx_mm_i386.so
    Linux AMD64:
    linux addons/amxmodx/dlls/amxmodx_mm_amd64.so
  8. If you're using AMX, change "amx\amx_" to "amxmodx\amxmodx_".
    If you're using AMX Mod X 0.1x, change "amxx\amxx_" to "amxmodx\amxmodx_".
d) AMX Mod X
  1. Go to www.amxmodx.org and click "Downloads". Download the amxmodx-base package for either Windows, Linux, or AMD64.
  2. Extract the base package to your mod folder. This will place AMX Mod X into <mod folder>\addons\amxmodx.
  3. Go back to the AMX Mod X download site. If there is one available, and you want to use it, download the addon package corresponding to your mod.
    As of this writing, addon packs are available for Counter-Strike/Condition-Zero, Team Fortress Classic, Day of Defeat, The Specialists, and Natural Selection.
    Make sure you download the pack that corresponds to the server's operating system, either Windows, Linux, or AMD64.
  4. Extract the addons pack into your mod folder. This will merge the addon pack into your installation in <mod folder>\addons\amxmodx.
  5. AMX Mod X should now be installed! You can load your server now to try it out (type "meta list" to see it loaded).
e) Configuration
Now that AMX Mod X is installed, move on to the Configuration Section.


Configuration

III. Configuration
Content:
  • Plugins
  • Modules
  • Base CVARs
  • Admins
  • SQL
  • Maps
  • Menus
    • Client Commands
    • Commands
    • Configs
    • CVARs
    • Speech


Plugins

V. Plugins
Content:
  • Installing Plugins
  • Removing Plugins
  • Default Plugins
  • Troubleshooting
  • Porting AMX Mod Plugins
  • Compiling Plugins


Modules

VI. Modules
Content:
  • Installing Modules
  • Removing Modules
  • Default Modules
  • Troubleshooting


Configuration: Base CVARs

3. Configuration: Base CVARs
To edit these options, open "addons/amxmodx/configs/amxx.cfg" with your favorite text editor.

CVAR | Default Setting | Purpose
amx_default_access | "z" | Sets the default access level for non-admin players.
amx_password_field | "_pw" | Name of the setinfo key which a user should store their password in.
amx_mode | 1 | Changes the mode of logging into a server: 0 - Disable logging, players won't be checked and no access will be given. 1 - Normal mode which obeys flags set in accounts. 2 - Kick all players not on the users list.
amx_show_activity | 2 | Sets the mode of admin activity on the server: 0 - Disabled 1 - Show action anonymously 2 - Show action with the admin's name
amx_scrollmsg | "Welcome to %hostname% -- This server is using AMX Mod X" 600 | Sets the parameters (message and frequency) for a scrolling message.
amx_imessage | "Welcome to %hostname" "000255100" "This server is using AMX Mod X\nVisit http://www.amxmodx.org" "00010025" | Adds a center-typed colored message. The last parameter is in RRRGGGBBB format (red, green, blue).
amx_freq_imessage | 180 | Frequency, in seconds, of the colored center messages.
amx_flood_time | 0.75 | Chat flood prevention. Sets how fast a player can chat (in seconds).
amx_reservation | 0 | Sets the amount of reserved slots.
amx_time_display | "ab 1200" "ab 600" "ab 300" "ab 180" "ab 60" "bcde 11" | Sets flags for remaining time display: a - Display white text on bottom b - Use voice c - Don't add "remaining" in voice d - Don't add "hours/minutes/seconds" in voice e - Show/speak if current time is less than set in parameter
amx_time_voice | 1 | Sets whether to announce "say thetime" and "say timeleft" with voice.
amx_vote_delay | 10 | Sets the minimum delay in seconds between two voting sessions.
amx_vote_time | 10 | Sets how long a voting sessions lasts for.
amx_vote_answers | 1 | Displays who votes for which options, publically.
amx_voteban_ratio | 0.40 | Ratio for a ban vote to be successful.
amx_votekick_ratio | 0.40 | Ratio for a kick vote to be successful.
amx_votemap_ratio | 0.40 | Ratio for a map vote to be successful.
amx_vote_ratio | 0.02 | Ratio for a general vote to be successful.
amx_extendmap_max | 90 | Maximum time a mapvote can be extended.
amx_extendmap_step | 15 | Amount of time a map extensions adds.
amx_client_languages | 1 | Enables or disables the ability for clients to choose their own language.
amx_debug | 1 | Sets the debug mode for plugins: 0 - No debugging (warning messages for plugin errors) 1 - Plugins with "debug" option in plugins.ini are put into debug mode. 2 - All plugins are put into debug mode (full backtraces for errors). Note that debug mode greatly decreases JIT performance.


Configuration: Admins

4. Configuration: Admins
The following instructions are for admins stored in addons\amxmodx\configs\users.ini. If you are using SQL, please refer to the SQL setion.

Open users.ini with your favorite text editor. There are four parameters when adding a user:

Authentication Style, Password, Access Rights, Connection Flags

Generally, a users.ini entry will look like this:

"STEAMID" "" "abcdefghijklmnopqrstu" "ce"

Or for a more concrete example:

"STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce"

This means:
  • Authentication: STEAM_0:0:123456
  • Password: None (auth by SteamID)
  • Access Rights: a through u
  • Connection Flags: SteamID + No Password
In general you should follow this example. Rarely should you ever need to authenticate by password + name, but it is possible. Here is what the entry would look like:

"BAILOPAN" "mypass" "abcdefghijklmnopqrstu" "a"

Then to authenticate yourself, edit "autoexec.cfg" (or create it) in your client mod folder and add:

setinfo "_pw" "mypass"

Where "_pw" is the setting for amx_password_field in amxx.cfg.

The available access and connection flags are below.

Important: Do not use "z" for admins.

Access Flag | Purpose
a | immunity (can't be kicked/baned/slayed/slaped and affected by other commmands)
b | reservation (can join on reserved slots)
c | amx_kick command
d | amx_ban and amx_unban commands
e | amx_slay and amx_slap commands
f | amx_map command
g | amx_cvar command (not all cvars will be available)
h | amx_cfg command
i | amx_chat and other chat commands
j | amx_vote and other vote commands
k | access to sv_password cvar (by amx_cvar command)
l | access to amx_rcon command and rcon_password cvar (by amx_cvar command)
m | custom level A (for additional plugins)
n | custom level B
o | custom level C
p | custom level D
q | custom level E
r | custom level F
s | custom level G
t | custom level H
u | menu access
z | user (no admin)

Connection Flag | Purpose
a | disconnect player on invalid password
b | clan tag
c | this is steamid/wonid
d | this is ip
e | password is not checked (only name/ip/steamid needed)


Configuration: SQL

5. Configuration: SQL
AMX Mod X features a universal set of natives to be used across all SQL connectors. This means you should only enable one SQL module, but it should work with all 0.20+ plugins.

To begin, enable one of the SQL modules - mysql_amxx, pgsql_amxx, or mssql_amxx. See the modules section for enabling modules.

Next you need to edit your SQL configuration. Open addons\amxmodx\configs\sql.cfg with your favorite text editor. You will need to change the settings for the CVARs. See below is a table showing their definitions and purposes.

Once you have configured this, enable the admin_sql plugin and disable the admin plugin (see Plugins section for enabling/disabling plugins).

Next time your server changes map or restarts, the table will be created for you automatically.

To add administrators via SQL, follow the same directions as in the "Adding Administrators" section, except the four fields are not written to users.ini, they are added to the four corresponding fields in the amx.admins table.

CVAR | Default Setting | Purpose
amx_sql_host | "127.0.0.1" | IP address of SQL server.
amx_sql_user | "root" | Username to connect to the SQL server.
amx_sql_pass | "" | Password to connect to the SQL server.
amx_sql_db | "amx" | Database to use on the SQL server.
amx_sql_table | "admins" | The table to use for the admin_sql plugin.


Configuration: Maps

6. Configuration: Maps
If you use the mapsmenu plugin, you can either use "maps.ini" or "mapcycle.txt" to manage map rotations.

Delete "maps.ini" to use mapcycle.txt, otherwise, simply add a list of map names to maps.ini like so:

de_dust
cs_assault
de_aztec

Et cetera. For each map, you can also add a configuration file that will execute when the map loads. This is useful to set certain settings for 3rd party maps, say, removing the freeze time on fy_iceworld.

To do this, simply create a folder in addons\amxmodx\configs called "maps" and place a .cfg file named after the map with the settings in it, for example, you might have addons\amxmodx\configs\maps\fy_iceworld.cfg:

mp_startmoney 16000
mp_freezetime 0
mp_timelimit 20


Configuration: Menus

7. Configuration: Menus
There are a number of menu configuration files for the administration in-game menus. Click each of the menus to see how to configure them.
Menus:
  • Client Commands
  • Commands
  • Configs
  • CVARs
  • Speech
Client Commands Menu
File: | addons\amxmodx\configs\clcmds.ini
Format: | "Name" "Command" "Flags" "Access Level"
Options: | Name is the name that will appear on the menu. Command is the format for the console command - you can use %userid% to insert the user's id. Flags are one of the following: a - execute from server console b - execute from admin console c - execute on selected player d - display menu again once done
Example: | "Slay player" "amx_slay #%userid%" "bd" "u"

Commands Menu
File: | addons\amxmodx\configs\cmds.ini
Format: | "Name" "Command" "Flags" "Access Level"
Options: | Name is the name that will appear on the menu. Command is the format for the console command - you can use %userid% to insert the user's id. Flags are one of the following: a - execute from server console b - execute from admin console c - execute on selected player d - display menu again once done
Example: | "Pause" "amx_pause" "bd" "u"

Server Configs Menu
File: | addons\amxmodx\configs\configs.ini
Format: | "Name" "Command" "Flags" "Access Level"
Options: | Name is the name that will appear on the menu. Command is the format for the console command - you can use %userid% to insert the user's id. Flags are one of the following: a - execute from server console b - execute from admin console c - execute on selected player d - display menu again once done
Example: | "PUBLIC Settings" "servercfgfile server.cfg;exec server.cfg" "a" "u"

CVARs Menu
File: | addons\amxmodx\configs\cvars.ini
Format: | "CVAR" "Values" ... "Access Level"
Options: | CVAR - the CVAR's name Values - list of space delimited, quotation enclosed values
Example: | "mp_autoteambalance" "0" "1" "@" "u"

Speech Menu
File: | addons\amxmodx\configs\speech.ini
Format: | "Name" "Command" "Flags" "Access Level"
Options: | Name is the name that will appear on the menu. Command is the format for the console command - you can use %userid% to insert the user's id. Flags are one of the following: a - execute from server console b - execute from admin console c - execute on selected player d - display menu again once done
Example: | "Hello!" "spk \'vox/hello\'" "cd" "u"


Commands

IV. Commands
Content:
  • Admin Commands
  • Chat Commands
  • Vote Commands
  • Stats Commands
  • Say Commands
  • Menu Commands
  • Config Commands
  • RCON Commands


Commands

4. Commands

Content:
  • Admin Commands
  • Chat Commands
  • Vote Commands
  • Stats Commands
  • Say Commands
  • Menu Commands
  • Config Commands
  • RCON Commands
Console commands are entered into the console like this:

amx_<command> <option1> <option2> [option3]

Required options are shown with <>, optional parameters are shown with []. Do not actually type <> or [].

To view in-game command help, use this in the console:

amx_help

Admin Commands
Command | Format | Access | Description
amx_kick | <name or #userid> [reason] | ADMIN_KICK | Kicks a player.
amx_ban | <name or #userid> <time> [reason] | ADMIN_BAN | Bans a player.
amx_addban | <authid or ip> <minutes> [reason] | ADMIN_BAN | Adds a ban to the server banlist.
amx_unban | <authid or ip> | ADMIN_BAN | Unbans a player.
amx_slay | <name or #userid> | ADMIN_SLAY | Slays a player.
amx_slap | <name or #userid> [damage] | ADMIN_SLAY | Slaps a player for variable damage.
amx_leave | <tag> [tag1] [tag2] [tag3] | ADMIN_KICK | Kicks all players not wearing one of the tags.
amx_pause |  | ADMIN_CVAR | Pauses or unpauses the game.
amx_who |  | ADMIN_ADMIN | Displays who is on the server.
amx_cvar | <cvar> [value] | ADMIN_CVAR | Changes or displays a cvar value.
amx_map | <mapname> | ADMIN_MAP | Changes map.
amx_cfg | <filename> | ADMIN_CFG | Executes a server-side config file.
amx_rcon | <rcon command line> | ADMIN_RCON | Executes a command on the server console.
amx_plugins |  | ADMIN_ADMIN | Lists all loaded plugins.
amx_modules |  | ADMIN_ADMIN | Lists all loaded modules.

Chat Commands
Command | Format | Access | Description
amx_say | <message> | ADMIN_CHAT | Sends a message to all players through normal say.
amx_chat | <message> | ADMIN_CHAT | Sends a message to all admins through normal chat.
amx_psay | <name or #userid> <message> | ADMIN_CHAT | Sends a private message to a player.
amx_tsay | <color> <message> | ADMIN_CHAT | Sends a left side HUD message to all players.
amx_csay | <color> <message> | ADMIN_CHAT | Sends a center HUD message to all players.

Vote Commands
Command | Format | Access | Description
amx_votemap | <map> [map] [map] [map] | ADMIN_VOTE | Starts a vote for a map.
amx_votekick | <name or #userid> | ADMIN_VOTE | Starts a vote to kick a player.
amx_voteban | <name or #userid> | ADMIN_VOTE | Starts a vote to ban a player.
amx_vote | <question> <answer1> <answer2> | ADMIN_VOTE | Starts a custom poll.
amx_cancelvote |  | ADMIN_VOTE | Cancels the last poll in progress.

Stats Commands
Command | Format | Access | Description
say /hp |  |  | Displays information about your killer.
say /statsme |  |  | Displays your stats.
say /stats |  |  | Displays other players' stats.
say /top15 |  |  | Displays the top 15 players.
say /rank |  |  | Displays your rank on the server.

Say Commands
Command | Format | Access | Description
say nextmap |  |  | Displays the next map in the mapcycle.
say timeleft |  |  | Displays the time left in the map.
say thetime |  |  | Displays the current time.

Menu Commands
Command | Format | Access | Description
amxmodmenu |  | ADMIN_MENU | Displays the main AMX Mod X menu.
amx_cvarmenu |  | ADMIN_CVAR | Displays the CVAR menu.
amx_mapmenu |  | ADMIN_MAP | Displays the map change menu.
amx_votemapmenu |  | ADMIN_MAP | Displays the map voting menu.
amx_kickmenu |  | ADMIN_KICK | Displays kick menu.
amx_banmenu |  | ADMIN_BAN | Displays ban menu.
amx_slapmenu |  | ADMIN_SLAY | Displays slap/slay menu.
amx_teammenu |  | ADMIN_LEVEL_A | Displays team switch menu.
amx_clcmdmenu |  | ADMIN_LEVEL_A | Displays client commands menu.
amx_restmenu |  | ADMIN_CFG | Displays weapon restriction menu.
amx_teleportmenu |  | ADMIN_CFG | Displays teleport menu.
amx_pausecfgmenu |  | ADMIN_CFG | Pause/unpause plugins with menu.
amx_statscfgmenu |  | ADMIN_CFG | Displays stats configuration menu.

Config Commands
Command: | amx_pausecfg
Format: | <command> [name]
Access: | ADMIN_CFG
Description: | Command list available: off - Pauses all plugins not in the list. on - Unpauses all plugins. stop <file> - Stops a plugin. pause <file> - Pauses a plugin. enable <file> - Enables a plugin. save - Saves a list of stopped plugins. clear - Clears a list of stopped plugins. list [id] - Lists plugins. add <title> - Marks a plugin as unpauseable.

Command: | amx_statscfg
Format: | <command> [parameters]
Access: | ADMIN_CFG
Description: | Command list available: on <variable> - Enable specific option. off <variable> - Disable specific option. save - Save stats configuration. load - Load stats configuration. list [id] - List stats statuses. add <name> <variable> - Add stat variable to the list.

RCON Commands
Command: | amxx
Format: | <command> [parameters]
Access: |
Description: | Command list available: amxx version - Display version. amxx modules - Display modules. amxx plugins - Display plugins. amxx gpl - Display the GNU General Public License amxx cvars - Display AMX Mod X registered CVARs. amxx cmds - Display AMX Mod X registered commands. amxx pause - Pause a running plugin. amxx unpause - Unpause a running plugin.the list.


Plugins

1. Plugins

Content:
  • Installing Plugins
  • Removing Plugins
  • Default Plugins
  • Troubleshooting
  • Porting AMX Mod Plugins
  • Compiling Plugins

Installing Plugins
  1. Follow any directions the plugin author has given you. If the plugin requires extra steps or special files, make sure you have them in the proper place and order.
  2. If you are given a .sma source file, you must compile it. Click here to find out how to compile plugins.
  3. Place the plugin's .amxx file in the addons\amxmodx\plugins folder.
  4. Add the plugin's name to addons\configs\plugins.ini. Example:
    myplugin.amxx
  5. Restart the server or change maps. If the plugin has any load errors, see below.

Removing Plugins
  • Remove the entry from addons\amxmodx\configs\plugins.ini by deleting it or prepending a semi-colon to comment it out.
  • Delete any associated files.

Default Plugins
Plugin Name | Purpose
admin.amxx | Administration Base
admin_sql.amxx | Administration Base for SQL. Use only one base.
admincmd.amxx | Basic administration commands (such as kick/slap).
adminhelp.amxx | Help for admin commands.
adminslots.amxx | Slot reservation.
multilingual.amxx | Multi-Lingual client configuration.
menufront.amxx | Front-end for admin menus.
cmdmenu.amxx | Command menu for settings.
plmenu.amxx | Player menu commands (kick, ban, etc).
telemenu.amxx | Teleport Menu (fun module required).
mapsmenu.amxx | Maps menu (vote, changeleve, etc).
adminchat.amxx | Console-based chat commands.
antiflood.amxx | Prevents clients from flooding the say chat.
scrollmsg.amxx | Displays a scrolling message.
imessage.amxx | Displays a centered, timed information message.
adminvote.amxx | Voting commands.
nextmap.amxx | Displays next map in the mapcycle.
mapchooser.amxx | Allows players to vote for the next map.
timeleft.amxx | Displays time left on the current map.
pausecfg.amxx | Allows pausing/unpausing of plugins.
statscfg.amxx | Configuration of statistical plugins.

Troubleshooting

Q: What does "function not found" mean?

A: Your plugin requires a module which you have not enabled. Make sure you followed the plugin author's instructions. If there were none supplied, you can use these methods to find the module you need to enable: Look at the plugin's source code (.sma file). There will be lines like this:
  #include <amxmodx>
  #include <amxmisc>
  #include <engine>
  #include <fakemeta>
These last two lines mean "Engine module" and "Fakemeta module".
Also, some modern plugins will have sections like this:
  public plugin_modules()
  {
      require_module("engine")
    require_module("fakemeta")
  }
These each correspond to one module that must be enabled.

Lastly, you can see if the function is in the scripting database at http://www.amxmodx.org/funcwiki.php
If all of these options fail, search the forums or contact the plugin developer.

Q: What does "module required for plugin" mean?
A: This means you do not have the specified module enabled. As the error says, you should open addons\amxmodx\configs\modules.ini and enable it.

Q: What does "Run time error ... debug not enabled" mean?
A: This means an internal error occured in the plugin. To enable debug mode, you can do one of two things:
  1. Change the "amx_debug" cvar in amxx.cfg to one of the following values:
    0 - No debugging
    1 - See option 2 below
    2 - All plugins in debug mode
  2. Change the entry in addons\amxmodx\configs\plugins.ini to have debug enabled. For example, change something
like:
myplugin.amxx
to:
myplugin.amxx debug
You should the contact the plugin author with the debug output when the error occurs again.

Q: I am a plugin developer. How can I use the debugging system?
A: See the scripting section for more information on this.

Porting AMX Mod Plugins
In order to port AMX Mod plugins to AMX Mod X, you should first try simply recompiling them. Many function names have changed so you can't run them directly. If the compilation is successful, but the plugin doesn't work, read on.

If the re-compilation or plugin did not work, you must assess the source code.
  • Is the plugin from AMX Mod 0.9.9+? It may use new or unportable natives, such as _T() or other crap.
  • Does the plugin use unported modules? There are some modules so outdated, closed source, or poorly made that they were not ported, and never will be. These modules are:
    • UDP
    • MThread
    • D2Tools
    • Misc
    • Tazmod
    • CMath
    • pvPrivateData
  • Luckily, these modules are rarely used because of the reasons listed above.
  • Are you using AMX Mod X 0.20? The functionality for MySQL and some other idiosyncracies (such as set_task) changed significantly, which could render some plugins unportable without editing the source code.
  • Does the plugin use VexD forwards? The handling, nature, and/or names of some forwards changed from AMX Mod to AMX Mod X 0.16, and again to 0.20. Make sure that they are being used correctly.
  • Is the author still around? See if they are willing to help you.
If you do complete a successful port, you should have the author's permission before distributing it. If you do distribute it, you must use the GNU General Public License as the plugins are linked to AMX Mod X.

Compiling Plugins

Windows:

Place the .sma source file in addons\amxmodx\scripting.
Method 1: Quick
  1. Drag the .sma file onto "compile.exe".
  2. Look in the compiled folder for the output .amxx file.
Method 2: Compile All (Quick)
  1. Double click compile.exe to compile all plugins into the compiled folder.
Method 3: Command Line
  1. Go to Start, Run, type "cmd", click Ok.
  2. Use cd to change to the directory, I.e.:
      cd c:\hlserver\cstrike\addons\amxmodx\scripting
  3. Use amxxsc to compile the plugin:
      amxxsc.exe myplugin.sma
  4. The output will be in the same folder.
Linux

Copy or move the .sma file into addons/amxmodx/scripting.
Then change the directory to the scripting folder with:
  cd addons/amxmodx/scripting

Method 1: Compile all
  1. Run the script compile.sh by either:
      sh compile.sh
    Or:
      chmod +x compile.sh
  ./compile.sh
Method 2: Compile single
  1.   ./amxxsc myplugin.sma
    The output will be in the same folder.


Modules

1. Commands

Content:
  • Installing Modules
  • Removing Modules
  • Default Modules
  • Troubleshooting

Installing Modules
  1. Figure out what operating system your server is: Windows, Linux, or Linux using AMD64 (64bit).
  2. Download the module corresponding to your OS, normally modules follow the following naming scheme:
    module_amxx.dll - Windows
    module_amxx_i386.so - Linux
    module_amxx_amd64.so - Linux, AMD64.
  3. Place the file in addons\amxmodx\modules\
  4. Add the module's name to addons\amxmodx\configs\modules.ini. You should use the full file name, although AMX Mod X supports notation like this for multiple server configurations:
    ;auto-detct OS
module_amxx
  5. Follow any additional instructions the module author has. Then restart the server.
  6. To see if the module is working, you can type in your server console:
    amxx modules

Removing Modules
  • Remove or comment the entry from addons\amxmodx\configs\modules.ini (commenting is prepending a semi-colon).
  • Delete any associated files.

Default Modules
Module Name | Purpose
fun_amxx | General functions for changing game values.
engine_amxx | More advanced functions for getting and setting values in the HL engine.
fakemeta_amxx | Expert/advanced functions for manipulating, hooking, and calling functions in the HL engine.
mysql_amxx, pgsql_amxx, mssql_amxx | MySQL (all platforms), PgSQL (all platforms except AMD64), and MS-SQL (Windows only) scripting functions.
geoip_amxx | Functions for finding countries by IP address.
array_amxx | Functions for somewhat-dynamic arrays.
sockets_amxx | Functions for socket (TCP/UDP) control and manipulation.
regex_amxx | Functions for regular expression support.

Troubleshooting

If a module does not load, you are pretty much stuck for options. The most you can do is contact the module author or attempt to modify/compile the source code on your own system.

To troubleshoot why a module might not load on Linux, you can use the supplied "dlsym" or "dlsym64" (for AMD64) program.

Log into your linux server using SSH and use something like:
cd  hlds_l/cstrike/addons/amxmodx/scripting
chmod +x dlsym
./dlsym ../modules/module_amxx_i386.so

If you get a successful load/handle, the module should be loading correctly. To be safest, post on the AMX Mod X forums or contact the module author.


Troubleshooting

VII. Troubleshooting
Content:
  • AMX Mod X doesn't load (bad load)
  • A module doesn't load
  • Modules or plugins don't load
  • A plugin doesn't load (badload)
  • How do I add admins?
  • My admin doesn't work!
  • I get "ML_LNOTFOUND"!
  • I get "ML_NOTFOUND"!
  • I get "Run time error 10!"
  • I get "Run time error <x>!"


Addon Packages

VIII. Addon Packages
Mods:
  • Counter-Strike and Condition Zero
    • Configuration
    • Plugins
    • Modules
  • Day of Defeat
    • Plugins
    • Modules
  • Natural-Selection
    • Configuration
    • Plugins
    • Modules
  • Team Fortress Classic
    • Plugins
    • Modules
  • The Specialists
    • Plugins
    • Modules


Addons: Counter-Strike

1. Counter-Strike
Sections:
  • Configuration
  • Plugins
  • Modules
CVAR Config

To edit these options, open addons\amxmodx\configs\amxx.cfg with your favorite text editor.

CVAR | Default Setting | Purpose
csstats_rank | 1 | Sets the rank player mode for CSX. Options: 0 - By name 1 - By SteamID 2 - By IP Address
csstats_maxsize | 3500 | Maximum size of the CSX stats file.
amx_statsx_duration | 12.0 | Duration of HUD statistics.
amx_statsx_freeze | -2.0 | HUD statistics display limit relative to round freeze end. Negative values will clear the HUD before the round freezetime has ended.

Plugins
Plugin Name | Purpose
restmenu.amxx | Weapon Restriction Menu
statsx.amxx | Statistics Generation (such as end of death/round stats) - Requires CSX
miscstats.amxx | Events announcement for Counter-Strike (requires CSX)
stats_logging.amxx | Weapon stats logging (requires CSX)

Modules
Module Name | Purpose
cstrike_amxx | Adds scripting functionality to modify aspects of Counter-Strike
csx_amxx | CSSTATS replacement - statistics generation and other events


Addons: Day of Defeat

2. Day of Defeat
Sections:
  • Plugins
  • Modules
Plugins
Plugin Name | Purpose
stats.amxx | Statistics on death/round end/etc. (DoDX module required)
statssounds.amxx | Precache sound plugin for stats.
stats_logging.amxx | Weapon stats logging (DoDX module required)

Modules
Module Name | Purpose
dodfun_amxx | Adds Day of Defeat specific scripting functions
dodx_amxx | Adds Day of Defeat statistical functionality


Addons: Natural Selection

3. Natural Selection
Sections:
  • Configuration
  • Plugins
  • Modules
CVAR Config

To edit these options, open addons\amxmodx\configs\amxx.cfg with your favorite text editor.

CVAR | Default Setting | Purpose
amx_mapnum_ignore | 0 | Sets whether to ignore the minimum and maximum settings for maps in the mapcycle.
amx_idle_time | 120 | Time players must be idle in order to be kicked
amx_idle_min_players | 8 | Minimum number of players on the server before kicking starts
amx_idle_ignore_immunity | 1 | Sets whether to kick idle admins with immunity
amx_unstuck_frequency | 4 | Sets the frequency in seconds that a player can say /stuck to free themselves.

Plugins
Plugin Name | Purpose
idlekicker.amxx | Kicks idle players
nscommands.amxx | Extra commands for Natural-Selection
unstuck.amxx | Free stuck players (Engine and NS modules required!)

Modules
Module Name | Purpose
ns_amxx | Adds many Natural-Selection related functions


Addons: Team Fortress Classic

4. Team Fortress Classic
Sections:
  • Plugins
  • Modules
Plugins
Plugin Name | Purpose
stats.amxx | Statistics on death/round end/etc. (TFCX module required)
statssounds.amxx | Precache sound plugin for stats.
stats_logging.amxx | Weapon stats logging (TFCX module required)

Modules
Module Name | Purpose
tfcx_amxx | Adds Team Fortress Classic statistical functionality


Addons: The Specialists

5. The Specialists
Sections:
  • Plugins
  • Modules
Plugins
Plugin Name | Purpose
stats.amxx | Statistics on death/round end/etc. (TSX module required)
statssounds.amxx | Precache sound plugin for stats.
stats_logging.amxx | Weapon stats logging (TSX module required)

Modules
Module Name | Purpose
tsx_amxx | Adds The Specialists statistical functionality


Scripting Tutorial

IX. Scripting Tutorial
Content:
  • Introduction
  • Pawn Language Primer
  • Basic Plugins
  • Advanced Topics
    • Tasks
    • Menus
    • Multi-Lingual Support
    • Using Events/Messages
    • Catching Logs
    • Entities
    • FakeMeta
  • Compiling
  • Debugging


Scripting Tutorial: Introduction

1. Introduction
Pawn is a "scripting" language used to embed functionality in other programs. There are two kinds of languages. The first is a language like C or C++, a "compiled" language which outputs executable binaries. The other is "interpreted" which is run through a virtual machine that runs code on the fly. AMX Pawn is a mixture of the two: You compile it, but the binaries are interpreted.

There a few important constructs you should know before you begin to script. The first is a "variable". A variable is a symbol, or marker, that holds data. For example, the variable "a" could hold the number "2", "16", "0", et cetera. Variables are created for storage space throughout a program. It is your responsibility to declare the names of variables you will be using before you use them. Variables are assigned data with the equal sign:

new a,b,c,d

a=5
b=16
c=0
d=500

The next important concept is functions. Functions are symbols or markers that do something when called. That means when you activate them, they carry out actions on the data you supply to them. There are a few types of functions, but every function is activated the same way. For example, say the "show" function prints a number to the screen:

show(56)   //Activates "show" function, and gives the number 56 to it
show()     //Activates "show" function with no data, blank
show(a)    //Activates "show" function, gives a variable's contents as data

Note any text that appears after a "//" is considered a "comment" and is not actual code. For every piece of data you pass to a function, it is called a "parameter". A function can have any number of parameters, and you need to make sure the data you give each parameter is correct. If a function takes in two numbers, you cannot give it words. Functions may also return data, like so:

new b
b = add(5, 7)

In this case, if "add" is a function that adds the first parameter to the second and returns the answer, the variable "b" will be assigned the number 12.

The next concept is block coding. You can group code into "blocks" separated by { and }. This effectively makes one large block of code act as one piece. For example:

{
   here
   is
   some
   code
}
It is a common practice to always use block coding when possible, and to indent the code in between the block delimiters.

This should give you a VERY brief necessary background to learning Pawn.


Scripting Tutorial: Pawn Language Basics

2. Pawn Language Basics
Areas of Interest:
  1. Variables
  2. Arrays
  3. Strings
  4. Functions
  5. Expressions and Operators
  6. Conditionals
  7. Looping
  8. Two Dimensional Arrays
  9. Compiler Directives
  10. Conclusion
1. Variables

Pawn is an embeddable, (almost) typeless, easy to use scripting language that is compiled for a virtual machine. AMX Mod X uses Small to route scripting functions to the Half-Life engine, using the Small Virtual Machine and Metamod (Small is written in C, Metamod is written in C++). While you write Small scripts in a text editor, the scripts must be compiled with a "Compiler", which produces a binary for AMX Mod X. The AMX Mod X team distributes a specially modified Small compiler.

Programming scripts in Pawn is relatively easy, and does not have concepts in other languages that are unnecessary for general use, such as pointers, vectors, structs, classes, streams, et cetera. Small has just three data types for declaring variables. The default variable type is a regular whole number, or integer. A variable name, for backwards compatibility, should be 19 characters or less, and MUST start with a letter. It can contain the symbols A-Z, a-z, 0-9, and the underscore ("_"). It is important to note that variable names are case sensitive - "myvar", "MyVaR", and "MYVAR" are three separate symbols. To declare a new variable, use the "new" operator like so:

new a            //Declare empty variable "a"
new b=5          //Declare variable "b" and set it to 5.
new c=5.0        //This is invalid, technically not a whole number!
new d="hello"    //"hello" is not a number either, this is invalid.

//You can also declare multiple variables on one line:
new e,f,g,h
new x=7, y=3

You can also declare a variable as a "Float", which means it can store numbers with decimal places. These are called "floating point" numbers:

new Float:a            //Declare empty floating point variable "a"
new Float:b=5.3        //This will declare a new variable "b" and assign 5.3 to it.
new Float:c=5          //This is valid, but the compiler will give you a warning.
new Float:d="hello"    //This is invalid, "hello" is not a decimal number.

You can also do the following:
//float(n) is a function that takes a number n and makes it a
// floating point number.
new Float:var = float(5)
new Float:var2 = 5.0
new Float:var3 = 1.0*5
new var4 = floatround(5.0)
//Note: floatround(n) is a function that takes a number n and rounds it to a whole number.
//  this makes the assignment to a regular integer variable valid.

Note - Spacing does generally not matter, as long as the compiler can tell symbols apart from each other. If your spacing is REALLY bad, you will get errors or maybe even warnings. For example, "new var = 5" and "new var=5" are the same, but "newvar=5" is totally wrong.

The last variable type is "boolean". It is very simple - it is either "true", or "false". Both "true" and "false" are predefined data structures.

new bool:IsItOn        //Declares a new variable "IsItOn" which is automatically false
new bool:xyz=true      //Declares a new variable "xyz" set to true

2. Arrays

Pawn features basic "arrays". An array is a very important type of aggregate data. This means you can store multiple values in one variable! An array follows the same rules as a regular variable, and it has the same types. It simply can contain multiple values. You define an array with brackets, and how many values it can hold. For example:

//This will declare a variable called "Players" which holds 32 numbers.
new Players[32]
//You can now store values in any of the 32 "slots" this array has.
// The slots are numbered from 0 to n-1, or in this case, 0 to 31.
//Every slot starts off as 0.

//Set slot 0 to 5
Players[0] = 5
//Set slot 1 to whatever is in slot 0, in this case, the number 5
Players[1] = Players[0]
//This is invalid!
//Although there are 32 slots, they are numbered from 0 to 31.
//Doing this results in AMX Native Error 4 - AMX_ERR_BOUNDS
// or, it simply won't compile!
Players[32] = 15
//This is also totally invalid
Players[-1] = 6
new a = 3
//This is also totally invalid.
//a must be a constant number, so this is valid:
new BadArray[a]
const b = 3
new GoodArray[b]
//You can also use Compiler Directives (See last section)

#define ARRAY_SIZE 3
new Array[ARRAY_SIZE]

Arrays can also be declared with groups of data default, such as:

new Numbers[4] = {0,1,2,3}
//Note: it is important that you make sure the amount of numbers you pass and the size of the array

You can also use any data type with arrays:

//Array of floating points:
new Float:Numbers[4] = {0.0, 1.2, 2.4, 3.8}
//Array of booleans.  Note this sets every slot to true.
new bool:playerHasGun[32] = true

3. Strings

You have probably noticed that an important data type is missing - characters (letters and symbols). These are called "strings", and in Pawn, they are technically numbers! A string of data is an array of numbers that translate to ASCII (character) symbols. For example:

//This will declare a number array "myString" that contains the data "Hello".
//It will have 6 slots, because there are 5 characters.
//The last slot is reserved for the number 0, which tells the Pawn engine that it is a string.
new myString[] = "Hello"

//Note: anything in between /* and */ is also a comment.  You cannot use /* */ inside a /* */.
/* The following set of commands achieves the same purpose, however, it is longer and not recommended.
   This works because each character of the string "Hello" is stored in a slot in the array.
new myString[6]
myString[0] = "H"
myString[1] = "e"
myString[2] = "l"
myString[3] = "l"
myString[4] = "o"
myString[5] = 0

/*You CANNOT do this! While it may compile, it is highly dangerous as it might cause overflow errors.*/
new myString[6]
myString = "Hello"     //INVALID!
myString[0] = "Hello"  //INVALID!
//To add data to a string, you can do this:
new goodString[6]
copy(goodString, 6, "Hello")

//Copy is a function that takes three parameters:
copy(destination[], length, source[])
//It copies the string inside the source array and places
// it into the destination array, but only copies up to length characters.

//Lastly, to prove that a string is really an array of numbers, this is completely valid:
new weird[6]
weird[0] = 68
weird[1] = 65
weird[2] = 73
weird[3] = 86
weird[4] = 68
weird[5] = 0
//This will set the variable "weird" to the string "DAVID".
//To see how letters and symbols translate into numbers, visit www.asctiitable.com

4. Functions

Pawn allows you to define your own functions. This comes in handy for removing code that is used in multiple places. Note that all functions should return a value. To do this, you use the "return" command, which immediately halts the function and returns the value of the expression passed to it. No code is executed in a function once the return is found. Here are some examples:

//This is a function that takes no parameters and returns 1.
//When activated, it uses the (non-existant) print function.
show()
{
   print("Hello!")

   return 1   //End, return 1
}

//Activate like this:
show()

You can also declare functions to take parameters.

//This declares a function called "add_two_numbers", which takes two numbers and returns the sum.
add_two_numbers(first, second)
{
   new sum = first + second

   return sum  //Return the sum
}
//Then you can use your new function like this:

new a,b
a = 5
a = 12
new c = add_two_numbers(a,b)
//c will now be equal to 17.

You are not limited by what types of data parameters can accept. When you give parameters to a function, it is called "passing". You can pass either data or a variable to a function.

//This defines a new function called "add_two_floats"
// which takes two floating points and returns the sum
Float:add_two_floats(Float:first, Float:second)
{
   new Float:sum = first + second

   return sum
}

new Float:a
new Float:b
a = 5.0
b = 6.3
new Float:c
c = add_two_floats( a+b )
//c is now equal to 11.3

//You can even pass arrays!  You do not have to specify the size of the array.
//If you do, you must make sure you are calling the function with an array of equal size and type.
add_two_from_array(array[], a, b)
{
   new first = array[a]
   new second = array[b]
   new sum = add_two_numbers(first, second)   //use our function from earlier

   return sum
}

Note, that when you pass arrays through a function they are passed through what is called "by reference". When a normal variable is passed to a function, it is copied in memory, and the copy is sent and then deleted afterwards. This is not the case with an array. Because arrays can be very large, the array is "referenced" instead of copied. This means if you change the array, afterwards it will stay changed. For example:

//This function will switch slots a and b inside any array passed to this function.
swap_slots(array[], a, b)
{
   new temp             //Note, you need to temporarily hold one of the slots before swapping them
                        //Otherwise, you can't swap both values! This is a classic problem.
                        //If you have a and b, setting b equal to a eliminates the original value in b.
   temp = array[b]
   array[b] = array[a]
   array[a] = temp
}

new myArray[2]
myArray[0] = 5
myArray[1] = 6
swap_slots(myArray, 0, 1)
//myArray[0] is 6, myArray[1] is 5

//You can prevent arrays from being modified by declaring them "constant", like so:
add_two_from_array(const array[], a, b)
{
   new first = array[a]
   new second = array[b]
   new sum = add_two_from_array(first, second)
   return sum
}
//Note, now when you use the function, you are guaranteed that the array will not be modified.

//This function modifies an array passed as a constant.  It will not work.
bad_function(const array[])
{
   array[0] = 0
}

5. Expressions

Expressions are just what they sound like from mathematics. They are groupings of symbols that return one piece of data. Expressions are normally comprised of parenthetical expressions, and are evaluated in a certain order (from innermost to outermost, parenthesis first, then multiplication, division, addition, subtraction, et cetera). You can put expressions anywhere. You can set variables equal to them or pass them to functions.

//This is the simplest expression.  It returns the number zero.
0
//However, to make it easier to read, this is also valid:
(0)

If an expression is not zero or it is not false, it not only returns a value, it also returns "true". Otherwise, it will return 0, which is also "false".

//Here are more mathematical expressions.  The mathematical operators are
// + for addition
// - for subtraction
// * for multiplication
// / for division
// % for modulus (finding the remainder of one number divided by another (5%2 is 1)
(5+6)                       //returns 11
((5*6)+3)                   //returns 33
((((5+3)/2)*4)-9)           //returns 5
((5*6) % 7)                 //returns 2
//Here are other expressions:
(true)                      //returns true
(5.0 + 2.3)                 //returns 7.3 as a floating point

//There are also extensions of these operators for direct use on variables.
new a = 5
new b = 6
//The first are the post/pre increment and decrement operators.
a++          //returns a+1, or 6.  This is a post increment.
++a          //also returns a+1, or 6.  This is a pre increment.

The difference between the two is subtle but important. a++ is evaluated LAST in an expression, while ++a is evaluated FIRST. This differences comes in handy with code that uses loops in certain ways. It is also important to know that the increment/decrement operators will not only return a+1, but set the variable a to a+1.

a--          //returns 4, post decrement
--a          //returns 4, pre decrement

//Note that a++ essentially trims down this code:
a = a + 1
//However, there is another way to write lines of code of this form:
a = a OP y
//Where OP is a math operator.  It can be shortened to:
a OP= x
//Observe:
a += 1       //This sets a to a + 1
a -= b       //This sets b to a - b
a *= 0       //This multiplies a by 0
a /= 2       //This divides a by 2.

However, mathematical operators are not the only operators you are given. There are boolean operators to help you with logical circuits or logical decisions.

//The and operator takes in the left expression and right expression.
// If both are "true", then it returns true.

//This is false, because 1 returns true and 0 returns false.
//Since both are not true, && returns false.
(1 && 0)
(1 && 2)                    //Both numbers are "true", therefore the expression is true.
(true && false)             //false
(false && false)            //false
(true && true)              //true

//The other important operator is "or".  It returns true if one of two expressions are true.
(1 || 0)                    //true, since one of the values is true.
(1 || 2)                    //true
(true || true)              //true
(false || false)            //false
(true || true)              //true

There are other operators as well, that you may not use as often. The "bitwise and" operator returns whether a binary bit sequence is contained in another sequence. In the technical terms, it does an "and (&&)" operation on each of the bits in both numbers. For example, say you have the number "9", which is "1001" in binary. If you want to know if that sequence contains the number "8" (1000), you can do:

//This will return 8, which means 8 is indeed a bit in 9.
(9 & 8)
//4 (00100) is not a bit inside 16 (10000) and this will return 0.
(16 & 4)
//The next operator is "bitwise or"
//which does an "or (||)' operation on each of the bits in both numbers.
//This will take 9 (1001) and match it with 3 (0011), resulting in 1011, or 11.
(9 | 3)

These two operators are also important, but not used often. They are the bitwise shift operators, << is a left shift and >> is a right shift. They shift the bits in a number to one direction.

//This takes the number 3 (00011) and shifts it three places to binary (11000), or 24.
(3 << 3)
//This takes the number 24 (11000) and shifts it three places to binary (00011), or 3.
(24 >> 3)

The last operator is "bitwise not". It returns the exact opposite of whatever is given to it. When used on a number, it will return each of the bits flipped (1 to 0, 0 to 1).

//This returns false
(!true)
//This returns true
(!false)
//This takes 9 (binary 1001) and makes it 6 (binary 0110).
(!(9))

6. Conditionals

Conditionals allow you to test if an expression meets a standard, and to execute code based on that decision. The most important conditional is called "if ... then". If evaluates whether a given expression is true or false. It if is true, it executes a block of code. If not, it executes a different block of code. For example:

This is an example of the most basic if ... then statement. The first line checks to see if the expression is true. In this case, if the variable a is equal to 5, then the if statement will execute the block of code underneath it, which sets a to 6.

if (a == 5)
{
   a = 6
}

However, what happens if a does not equal 5? Then the code will not be executed. However, you can tell it to execute code if the conditions are not met. Now, if a is equal to 5, a will be set to 6. Otherwise, it will be set to 7.

 if (a == 5)
{
   a = 6
} else {
   a = 7
}

There are many different operators you can use inside the if () statement. In fact, you can use any expression that evaluates to true (not zero) or false (zero).

//This will return true if a does not equal 5
if (a != 5) {
//Returns true if a is greater than 5
if (a > 5) {
//Returns true if a is less than 5
if (a < 5) {
//Returns true if a is greater than or equal to 5
if (a >= 5) {
//Returns true if a is less than or equal to 5
if (a <= 5) {
//Returns true because 11 is true
if (5+6) {
//Returns true of both a and b are true
if (a && b) {
//Returns true if 7.5 is greater than c
if ( ((5*3)/2) > c) {
//Always returns true no matter what
if (true) {
//Never returns true
if (false) {

Note that array comparisons have restrictions. This is invalid:

my arrayOne[3]
my arrayTwo[3]
if (arrayOne == arrayTwo) {

You must do:
if ((arrayOne[0] == arrayTwo[0]) &&
    (arrayOne[1] == arrayTwo[1]) &&
    (arrayOne[2] == arrayTwo[2])) {

Obviously, this would get very tedious with large arrays. You will see later on how to easily compare strings and arrays.

The if...then model of conditional switching can be brought up to another level. Pawn provides a way for you to provide multiple levels of true and false expressions.

//Example of "if...else if"
if (a == 5) {
   //This code will be run if a is 5.
} else if (a < 6) {
   //This code will be run if a is less than 6
} else if (a == 7) {
   //This code will be run if a is 7.
} else {
   //If none of the above conditions are met, this code will be run.
}

It is important to note that in the above example, each code block is not "fall through". That means each of the conditions will be checked in order, and if one is true, the code will be executed and the if statement is done. It will not execute multiple true conditions.

Lastly, there is one last type of conditional statement. It is called a "switch" statement, and it allows you to make a nicely ordered list of conditions similar to, but not as powerful as, "if...else if".

//Example of a switch statement
switch (a)
{
    case 5:
    {
       //This code will run if a is equal to 5
    }

    case 6:
    {
       //This code will run if a is equal to 6
    }

    case 7:
    {
       //This code will run if a is equal to 7
    }

    default:
    {
       //This code will run if all other cases fail
    }
}

Note that a switch is not "fall-through". If a case is true, no other cases are evaluated.

7. Looping

Looping is essential for any language. It allows you to perform the same block of code over and over, by constructing conditions on which code should be repeated.

The first and most widely used loop is called a "for loop". It takes an initial value, a condition upon which it should stop, and an incremental step. Then it executes code until it the conditions are no longer true. This lets you repeat the same block of code any number of times. Example:

/*A for loop has three parameters:
  for (initial; condition; increment)
  {
    //your code here
  }

  Before the first loop executes, it runs your initial condition.
  Then it begins looping your code with these steps:
  1.  Check if the condition is true.  If so, continue.  If not, stop.
  2.  Run the code.
  3.  Run the "increment" parameter.
  4.  Go to step 1.
*/

//Example of a for loop
new i
new sum
for (i=1; i<=10; i++)
{
   sum += i
}

Explanation:
  • The first parameter, i=1, sets the i variable to one. This happens before the looping starts.
  • Next, the "increment" parameter is checked. This parameter is a post-increment operator, so 1 will be added to i after the entire code block is evaluated.
  • Then the condition is checked. Is i<=10? It is currently 1, so it is indeed less than or equal to 10.
  • Since the condition is true, sum+=i is executed. This means i is added into sum.
  • The code block has finished, and i++ increments i to 2.
  • Now it repeats.
  • Is i<=10? Yes, it is 2. Now sum+=i runs again, and now sum is equal to 3.
  • The code block has finished, and i now increments to 3.
  • This happens until...
  • The increment parameter sets i to 11. The condition is no longer true, and the for loop is finished.
  • The sum variable now holds the number 55, which is the sum of 1 through 10.
This provides a nice way of managing arrays!

//Note: this provides a nice way to loop through arrays!  Observe this function below.
sum_of_array(myArray[], size)
{
   //Note: Make sure the user passes the size of the array, so we don't overflow it.
   new i, sum

   //This loop will start at 0 and stop right before size is reached.
   //If the user passes the correct size of the array,
   // the loop will be going from 0 to size-1
   // This correctly matches the numbers of slots in the array.
   for  (i=0; i<size; i++)
   {
      //For every time this loop executes,
      // i will be a number from 0 to size-1
      //Add the value of the slot (i) in the array to sum.
      //Once this is finished, sum will contain
      // the sum of all slots in the array.
      sum += myArray[i]
   }

   return sum
}

new NumberArray[4]
NumberArray[0] = 3
NumberArray[1] = 1
NumberArray[2] = 4
NumberArray[3] = 1

new answer = sum_of_array(NumberArray, 4)
//answer will be 3+1+4+1, or 9

//Here is a function to compare if one array is equal to another (i.e. a string)
bool:compare_arrays(array1[], array2[], size)
{
   new i
   for (i=0; i<size, i++)
   {
      //If a slot does not match, halt the function and return false.
      if (array1[i] != array2[i])
      {
         return false
      }
   }

   //If the function got to this point without returning false, return true.
   return true
}

The next kind of loop is also very important, and is simpler than a for loop. Called a "while" loop, it only takes one parameter: a condition. As long as the condition is true, it keep executing code. See the above examples rewritten with while loops.

//Basic loop
new i=0
new sum

while (++i <= 10)
{
   sum+=i
}

sum_of_array(array[], size)
{
   new i=0, sum

   //Do this loop while i is less than the size.
   //i is incremented at the end of every loop.
   while (i++ < size)
   {
      sum += array[i]
   }

   return sum
}

bool:compare_arrays(array1[], array2[], size)
{
   new i
   while (i++ < size)
   {
      if (array1[i] != array2[i])
      {
         return false
      }
   }

   return true
}

8. Two Dimensional Arrays

In Pawn it is possible to have arrays where each slot is another array. This is very useful for storing a table of data, where the first section of slots is a row and the second section of slots is a column. Two dimensional arrays are declared like so:

//This declares an array with 50 rows and 50 columns.
new BigArray[50][50]
//this declares a floating point array with 25 rows and 10 columns.
new Float:BigArray[25][10]

Each slot in the first subset of the array becomes its own array.

new BigArray[3][3]
BigArray[0][0] = 10
BigArray[0][1] = 20
BigArray[0][2] = 30
BigArray[1][0] = 40
BigArray[1][1] = 50
BigArray[1][2] = 60
BigArray[2][0] = 70
BigArray[2][1] = 80
BigArray[2][2] = 90

Will result in BigArray looking like this:
BigArray | 0 | 1 | 2
0 | 10 | 20 | 30
1 | 40 | 50 | 60
2 | 70 | 80 | 90

Note that our old sum_of_array() function can still work! We can do:

new sum = sum_of_array(BigArray[2], 3)

Because BigArray[2] contains a second, single dimensional array, containing {7,8,9}. However, let's write a 2D sum of array function.

//This function will tally up a two dimensional array.
sum_of_table(array[][], rows, cols)
{
   new i, j, sum

   //Note, there is a loop inside the loop.
   //This lets you go through each array inside the
   // bigger array.
   for (i=0; i

Note, it is also possible to store an array of strings using two dimensional arrays.

new StringList[3][] = {"Hello", "my", "friend"}
/*
  StringList[0][0] through [0][5] contains "Hello"
  StringList[1][0] through [1][2] contains "my"
  StringList[2][0] through [1][6] contains "friend"
*/

The table for StringList will look like:

StringList | 0 | 1 | 2 | 3 | 4 | 5 | 6
0 | H | e | l | l | o | \0 |
1 | m | y | \0 |  |  |  |
2 | f | r | i | e | n | d | \0

Comparing strings in multidimensional arrays is also similar:

if (StringList[0] == "Hello")       //INVALID
if (StringList[0][0] == "Hello")    //INVALID
if (equali(StringList[0], "Hello")) //Valid

9. Compiler Pre-processor Directives

Compiler directives allow you to change how your code is read.  This is rather advanced and will only be run over briefly.

//To bind a symbol to a value, you can do this:
#define SYMBOL VALUE
//for example:

#define MAX_STRING 250
new String[MAX_STRING]

#define HELLO "Hello.  This is a generic greeting."
new Hello[MAX_STRING] = {HELLO}

//You can also use #defines to change the flow of code.
#if defined LINUX
   //This portion will be compiled if #define LINUX exists
   execute_command("ls -l")
#else
   //This portion will be compiled if #define LINUX does not exist
   execute_command("dir")
#endif

//You can also change how much memory your script uses.
#pragma dynamic 4096
//This creates a 16K stack of memory (default).
//It is measured in blocks of 4 byte cells.

10. Conclusion

This guide should have given you a VERY brief introduction to basic Pawn programming.  It is by no means comprehensive and it should not constitute the entirety of one's knowledge of Pawn.  To read the official Small documentation and language guide, go this website: http://www.compuphase.com/pawn/pawn-lang.pdf (Note, this guide is very long and should be used as a reference.  You may want to try the Small forums or the AMX Mod X forums).  Continue to the next Section to see how to apply Small programming to the Half-Life and AMX Mod X engine!


Scripting Tutorial: Basic AMX Mod X Plugins

3. Basic AMX Mod X Plugins
Sections:
  • Overview
  • Beginning
  • Building Admin Commands
  • CVARs
  • Finding More
1. Overview

So you want to create a plugin? You should have a good understand of how Pawn works, so make sure Sections 0 and 1 of this manual make perfect sense to you. You should be reading this portion of the document, sitting at a computer, with a text editor and small compiler at hand. Doing this interactively helps learning. You won't be writing plugins like WC3, Matrix Mod, and CSDM right away, but this is meant to give you a kick start to the modding world of AMX Mod X. For a good text editor that is AMX Pawn enabled, try Crimson Editor (it's free as in beer): http://www.crimsoneditor.com/

You should get familiar with compiling plugins. Refer to the "Compiling Plugins" section of the AMX Mod X Documentation, as it will not be provided here. You should also be familiar with adding new plugins, so you can test your plugins out.

2. The structure of an AMX Mod X plugin.

An AMX Mod X plugin can have four main types of functions. The first is a "public" function. This means it is publically viewable to the AMX Mod X engine. The second is a "native" function, which is declared in a module or the AMX Mod X Core. The third is a regular user function, which is declared without any special attributes. The fourth is a "forward" function, which is called whenever a special event occurs (a forward is also public). An AMX Mod X plugin must begin with a function initializing the plugin:

//This makes it so you can use the core AMX Mod X functions
//It "includes" the native definitions from includes\amxmodx.inc
#include <amxmodx>

//Declare three string variables
new PLUGIN[]="AMXX Demo"
new AUTHOR[]="BAILOPAN"
new VERSION[]="1.00"

//This is a public function.
//It is necessary to initialize your script under AMX Mod X.
//It takes no parameters, and is called right after map load.
public plugin_init()
{
     //This is a function that takes three strings.
     //It registers your function in AMX Mod X, and assigns some basic information.
     register_plugin(PLUGIN, VERSION, AUTHOR)
}

Try compiling the script above. It will be very small - as it does nothing so far. However, if you load this script, and type "amxx plugins", you should see the new entry on the list.

3. Building Admin Commands

AMX Mod X provides a way to easily add console admin commands. Each command is "registered" as a console command. When you register a command, you must define four properties: The console command that is typed in, the function you are making that interprets the command, the access level required to use it, and a short description of the command.

For this demonstration, let's build a plugin that lets you change the health of players on the server with the command "amx_hp".

We'll need to do two things to start off - first, we need to register the command in the console. As we are binding a command to a public function, we must then make sure that function exists.

#include <amxmodx>
#include <amxmisc> //This contains some useful functions
#include <fun>     //This contains the function to change health

new PLUGIN[]="Change Health"
new AUTHOR[]="BAILOPAN"
new VERSION[]="1.00"

public plugin_init()
{
     register_plugin(PLUGIN, VERSION, AUTHOR)
     register_concmd("amx_hp", "cmd_hp", ADMIN_SLAY, "<target> ")
}

public cmd_hp(id, level, cid)
{
     return PLUGIN_HANDLED
}

The first new function is "register_concmd", which takes four parameters. The first is the command that a player must type into their console. The second is the public function that will handle the command. The third is the access level your command needs. Lastly, you can pass a string that describes how to use your command (for amx_help).

Next, we have created a public function to handle the amx_hp command. Note that we are giving it three parameters. These parameters will hold special data when the command is used - id will hold the player's id who started the command, level will hold the access level of the command (you must do access checking yourself), and cid will hold the command's internal id.

Also, note PLUGIN_HANDLED. There are two main return values you should concern yourself with. PLUGIN_CONTINUE generally means "continue with normal operation", and PLUGIN_HANDLED means "block further operation". The differences are subtle but important. For example, when binding a command, you should never return PLUGIN_CONTINUE. But if you return PLUGIN_HANDLED while binding to the "say" command, it will block the player's text from ever appearing. You must be careful with which you choose in certain situations. However, most things are unaffected (such as tasks, events, and other things you will run into later on).

So, first things first. How do we make sure this user is an admin who has ADMIN_SLAY access?
public cmd_hp(id, level, cid)
{
     if (!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED
     return PLUGIN_HANDLED
}

The cmd_access() function will check a command's information (user, access level, and id) and makes sure of two things: that the user has access to it, and that it was given a minimum number of parameters. Here we passed three, because the command will look like this: amx_hp <target> <amount>, and the actual command itself counts as a parameter. If cmd_access fails, we have the command immediately end.

The next portion to solve is: we need to take the two parameters and decode them. The "amount" parameter is easy, as we just convert it from a string to a number. The second parameter will be trickier, as we want to be able to target three different types of people:

  • @CT or @T - CTs or Ts
  • @ALL - Everyone
  • <target> - Partial name of a player
public cmd_hp(id, level, cid)
{
     if (!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED

     new Arg1[24]
     new Arg2[4]

     //Get the command arguments from the console
     read_argv(1, Arg1, 23)
     read_argv(2, Arg2, 3)

     //Convert the health from a string to a number
     new Health = str_to_num(Arg2)

     //Is the first character the @ symbol?
     if (Arg1[0] == '@')
     {
          new Team = 0
          //Check which team was specified.
          //Note that we start from [1], this is okay
          // it just means the @ isn't included
          if (equali(Arg1[1], "CT"))
          {
               Team = 2
          } else if (equali(Arg1[1], "T")) {
               Team = 1
          }
          new players[32], num
          //This function will fill the players[32] variable
          // with valid player ids.  num will contain the number
          // of players that are valid.
          get_players(players, num)
          new i
          for (i=0; i<num; i++)
          {
               if (!Team)
               {
                    //Set this player's health
                    set_user_health(players[i], Health)
               } else {
                    if (get_user_team(players[i]) == Team)
                    {
                         set_user_health(players[i], Health)
                    }
               }
          }
     } else {
          //finds a player id that matches the partial name given
          //the 1 means that it will not target the player if he
          // has immunity access
          new player = cmd_target(id, Arg1, 1)
          if (!player)
          {
               //this will print a message to the user who tried the command
               //The format for this command is called "format()" style,
               // where the first string formats the message according
               // to any number of following parameters.
               //  %s means a string
               //  %d or %i means an integer
               //  %f means a float
               // so "Hello %s, I am %d years old" will
               //  require a string and integer to follow
               console_print(id, "Sorry, player %s could not be found or targetted!", Arg1)
               return PLUGIN_HANDLED
          } else {
               set_user_health(player, Health)
          }
     }

     return PLUGIN_HANDLED
}

So, our final stripped amx_hp plugin will look like:

#include <amxmodx>
#include <fun>

new PLUGIN[]="Change Health"
new AUTHOR[]="BAILOPAN"
new VERSION[]="1.00"

public plugin_init()
{
     register_plugin(PLUGIN, VERSION, AUTHOR)
     register_concmd("amx_hp", "cmd_hp", ADMIN_SLAY, "<target> <hp>")
}

public cmd_hp(id, level, cid)
{
     if (!cmd_access(id, level, cid, 3))
        return PLUGIN_HANDLED

     new Arg1[24]
     new Arg2[4]

     //Get the command arguments from the console
     read_argv(1, Arg1, 23)
     read_argv(2, Arg2, 3)

     //Convert the health from a string to a number
     new Health = str_to_num(Arg2)

     //Is the first character the @ symbol?
     if (Arg1[0] == '@')
     {
          new Team = 0
          if (equali(Arg1[1], "CT"))
          {
               Team = 2
          } else if (equali(Arg1[1], "T")) {
               Team = 1
          }
          new players[32], num
          get_players(players, num)
          new i
          for (i=0; i<num; i++)
          {
               if (!Team)
               {
                    set_user_health(players[i], Health)
               } else {
                    if (get_user_team(players[i]) == Team)
                    {
                         set_user_health(players[i], Health)
                    }
               }
          }
     } else {
          new player = cmd_target(id, Arg1, 1)
          if (!player)
          {
               console_print(id, "Sorry, player %s could not be found or targetted!", Arg1)
               return PLUGIN_HANDLED
          } else {
               set_user_health(player, Health)
          }
     }

     return PLUGIN_HANDLED
}

4. CVARs

CVARs are server-side storage keys. For example, "mp_startmoney" is the Counter-Strike CVAR to hold how much money people get when they join the game. You can make your own CVARs by registering them in plugin_init(). Let's replicate mp_startmoney.

#include <amxmodx>

public plugin_init()
{
     register_plugin("CVAR Test", "1.0", "BAILOPAN")
     //set default value to 500
     register_cvar("amx_startmoney", "500")
}

//this occurs when a client is put in game
public client_putinserver(id)
{
     if (get_cvar_num("amx_startmoney") > 0)
     {
          cs_set_user_money(id, get_cvar_num("amx_startmoney"))
     } else {
        cs_set_user_money(id, get_cvar_num("mp_startmoney"))
     }
}

(this plugin probably won't work, it's just a demonstration). You can set CVARs as floats, numbers, or strings, and you can modify just about any valid CVAR from the HL engine or mod.

5. Finding More

To learn more about scripting for AMX Mod X, you should look through the natives in the function reference or the include files. Include files generally follow two formats. They are named after a module or specific purpose. _const is appended if they contain pre-defined numbers or lists. _stocks is appended if they contain helper or useful wrapping functions. Remember, stocks are only compiled if you use them, so it is safe to include an include file with many stocks.

You can also visit the forums at http://www.amxmodx.org/ and ask questions, or read how other people achieved certain goals to learn and innovate.


Scripting Tutorial: Advanced Topics

4. Advanced Topics
Areas of Interest:
  1. Tasks/Timers
  2. Menus
  3. Events/Messages
  4. Catching Logs
  5. Multi-Lingual Support
  6. SQL Support
  7. Regular Expressions
  8. Entities
  9. FakeMeta
1. Tasks

Tasks are timers that let you run code at an interval, either once or repeated. They are useful for things like waiting a few seconds, setting objects to destroy themselves, or just repeating a task over and over.

A task can be set in a number of different ways. The actual function is set_task():
set_task(Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0)

The parameters break down as such:
  • Float:time - Interval of timer in seconds (minimum 0.1 seconds)
  • function[] - A string that contains the public function to run on the timer
  • id - A unique id to assign to the task
  • parameter - An array contain data to send to the timer function
  • len - Size of the array to send to the timer function
  • flags - One of the following:
    • "a" - Repeat task a specified number of times
    • "b" - Loop task infinitely
    • "c" - do task on time after a map timeleft
    • "d" - do task on time before a map timeleft
  • repeat - If flags is "a", specifies the number of times to repeat the task
An example of a task is below. It will slap a specified player 5 times, once per second.

//the timed function receives the parameter array and its task id
public slapTask(params[], id)
{
   new player = params[0]
   user_slap(player, 5)
}

public start_slapping(id)
{
   new params[1]
   params[0] = id
   //we don't need a specific id
   set_task(1.0, "slapTask", 0, params, 1, "a", 5)
}

Note that if you specify 0 for parameter length, then the task function should look like:

public slapTask(id)

2. Menus

Menus are HUD messages that give a player a choice of options to select. They are quite messy to deal with but can be very useful for things like voting and command selection.

Menus must be registered by two things - a set of "keys" that tells how many options to register and a string which identifies the menu as unique. This string must appear in the beginning of every menu you want to trigger your function. When you display a menu, you can show it to one or more players. Once they hit a key, the result of their key press will be sent to the function you registered the menu to.

For our example, we'll make a menu that displays a list of guns: AK47, M4A1, or AWP, to a player. Whichever he selects, he will be given.

#include <amxmodx>
#include <amxmisc>
#include <fun>
public plugin_init()
{
    register_plugin("Menu Demo", "1.0", "BAILOPAN")
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
    register_menucmd(register_menuid("Which Weapon?"), keys, "giveWeapon")
}

Two commands are apparent here - register_menuid and register_menucmd. register_menuid registers a short phrase that will appear at the beginning of the menu, then returns an id. This id is the first parameter to register_menucmd. The second parameter to register_menucmd is the key configuration. Our menu will have three options, so we've added three menu keys in. In actuality, these are bitwise flags totalling "7", but that's not important. The last parameter is the public function that will handle the menu results.

Next, how do we show the menu? Let's make a quick console command: "giveme".

public plugin_init()
{
    register_plugin("Menu Demo", "1.0", "BAILOPAN")
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
    register_menucmd(register_menuid("Which Weapon?"), keys, "giveWeapon")
    register_clcmd("giveme", "showWeaponMenu")
}

register_clcmd is similar to register_concmd, except it only takes two parameters. It's used to register any command a client can use (except for special ones, like +attack).

//The clcmd function will just give us the player id
public showWeaponMenu(id)
{
    new menu[192]
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2

    format(menu, 191, "Which Weapon?^n^n1. AK47^n2. M4A1^n3. AWP")
    show_menu(id, keys, menu)
    return PLUGIN_HANDLED
}

//Our menu function will get the player id and the key they pressed
public giveWeapon(id, key)
{
    //key will start at zero
    if (key == 0)
    {
         give_item(id, "weapon_ak47")
    } else if (key == 1) {
         give_item(id, "weapon_m4a1")
    } else if (key == 2) {
         give_item(id, "weapon_awp")
    }
}

And we're done! The format line may be a little confusing. The "^n" means "new line", so the menu looks nicely formatted. You can use other modifiers in VGUI2 mods, such as "\w" for white text, "\r" for red text, and "\y" for yellow text. When a player types the command, he will see the menu. When he hits a key, the giveWeapon function will receive his id and the key number he pressed. Then he will get a gun corresponding to what he chose.

3. Events/Messages

For this demonstration, we're going to extend the above example. Every time a player respawns, he will be shown the menu to choose a weapon (note - we're ignoring other things like blocking buying and removing buyzones, this is just a demonstration).

Messages are a way for Half-Life clients to talk to servers, and vice versa. They are specially formatted lists of parameters. For example, the message "DeathMsg" (message id 83) has three parameters: Attacker (byte), Victim (byte), and Weapon (string). You can either capture messages or send them. Here, we'll do a simple demonstration of both. First let's make it so a user gets their gun menu when they spawn.

public plugin_init()
{
    register_plugin("Menu Demo", "1.0", "BAILOPAN")
    new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
    register_menucmd(register_menuid("Which Weapon?"), keys, "giveWeapon")
    //flags - b means "sent to one target", e means "target is alive"
    //this event is sent when a player spawns
    register_event("ResetHUD", "hook_hud", "be")
}

public hook_hud(id)
{
    //since we specify no parameters to the task,
    //the task id will be given to the function
    //this is useful because we can reuse our old
    //show menu function which takes an id
    set_task(0.2, "showWeaponMenu", id)
}

Note that we've set a small delay when we receive the message - this is to make sure that the user has had time to respawn. register_event can take more parameters in order to help restrict the event you catch - for example only matching certain parameters. You can read more about this in the function reference.

Now, let's say we want to figure out when a player has died...

public plugin_init()
{
    register_plugin("Message Demo", "1.0", "BAILOPAN")
    //this message informs everyone of a death, so we use
    // flag "a" - global event
    register_event("DeathMsg", "hook_death", "a")
}

public hook_death()
{
    new Killer = read_data(1) //get the first message parameter
    new Victim = read_data(2) //get the second message parameter
    new headshot = read_data(3) //was this a headshot?
    new weapon[32]
    read_data(4, weapon, 31)  //get the weapon name
}

Or, let's say we want to make a simple function for generating a death message:

stock make_deathMsg(Killer, Victim, const weapon[])
{
    //message_begin starts a message.  NEVER start two messages at once.
    //MSG_ALL means send the message to everyone
    //get_user_msgid returns the id of a message name
    //{0,0,0} is the origin vector - not used here
    //0 is the target - no specific target here
    message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0)
    write_byte(Killer)
    write_byte(Victim)
    write_string(weapon)
    message_end()
}

To find more about messages, consult the HLSDK, AMX Mod X forums, HL-related programming sites, or other plugins. To list the messages a mod has, type "meta game" in the server console (with metamod loaded). You can also use register_message, the more advanced message disection method found in the Engine module.

4. Catching Log Messages

Catching log messages is not used heavily any more, but it's still good to know how to do it. As log messages are sent by the mod, AMX Mod X will be able to catch them and let you hook them. For our example, let's give everyone $16,000 on round start.

The log messages for rounds are sent like this: World triggered "Round_Start". AMX Mod X will consider "World_triggered" as the first parameter and "Round_Start" as the second parameter. So:
#include <amxmodx>

public plugin_init()
{
    register_plugin("Log Demo", "1.0", "BAILOPAN")
    //this will filter for two parameters
    //roundstart is the public function
    register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start")
}

public roundstart()
{
    //set a small delay to make sure everyone spawns
    set_task(1.0, "roundDelay")
}

public roundDelay(taskId)
{
    new players[32], num
    get_players(players, num)
    new i
    for (i=0; i<num; i++)
    {
         cs_set_user_money(players[i], 16000)
    }
}

You can also read specific log parameters with read_logdata(), which can only be used inside the "plugin_log()" forward:
//receives all log messages
public plugin_log()
{
    new data[32]
    read_logdata(data, 31)
}

5. Multi-Lingual Support

Adding multi-lingual support to a plugin can be difficult, but it's usually worth it if you have clients who are willing to translate your strings into their native language.

The first step is to identify what needs to be translated. Say you have a call like this:

new score = get_score()
client_print(id, print_chat, "[AMXX] Your score is %d", score)

This is a good candidate for being multi-lingual. First, create a .txt file (preferrably named after your plugin) and store it in addons\amxmodx\data\lang\. Let's use "myplugin.txt" for the example. For each language, add an entry to the file. Entries are set up as 'keys', which are matched to 'translation strings'. Observe:

(addons\amxmodx\data\lang\myplugin.txt)

[en]
SCORE_MSG = "Your score is %d"

[de]
SCORE_MSG = "Ihr Spielergebnis ist %d"

[es]
SCORE_MSG = "Su cuenta es %d"

[fr]
SCORE_MSG = "Votre score est %d"

Then, in plugin_init(), you must register the language keys:
public plugin_init()
{
    ...
    //assumes placed in amxmodx\data\lang
    register_dictionary("myplugin.txt")
}

Now, here comes the hard part. AMX Mod X's Multi-Lingual API is built into the format() style routines. For anything that looks like or uses format()-style strings, you can use the ML API.

    client_print(id, print_chat, "[AMXX] %L", id, "SCORE_MSG", get_score())

Let's break this down. For each %L that appears, we need at least two parameters. The first parameter is the TARGET. This must be a player id, LANG_SERVER (meaning show in the server's native language), or LANG_PLAYER. LANG_PLAYER is a special modifier that should only be used when sending a message to all players - it means "show in every player's native language". The second parameter is the key string that identifies the language phrase to translate. Lastly, if the translated string requires any parameters itself (ours needs %d, one integer), that must be added as well.

You can get very complicated designs with this, but it's recommended that you keep things simple for clarity. Here is a final example using a global message to all players, assuming the key HELLO is properly translated in all the languages available:

    client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "HELLO")

6. SQL Support

SQL support has greatly improved in AMX Mod X. There is a common set of natives that work with a single driver, so as long as one (and only one) SQL module is loaded, the SQL (or DBI) natives will work. Here is a short primer on how to use the DBI natives:

//Create a connection
    new Sql:mysql = dbi_connect("localhost", "dvander", "pass", "dbase")

//If the connection is less than 1, it is bad
    if (mysql < SQL_OK) {
        new err[255]
        new errNum = dbi_error(mysql, err, 254)
        server_print("error1: %s|%d", err, errNum)
        return 1
    }

    server_print("Connection handle: %d", mysql)
//Run a query
    new Result:ret = dbi_query(mysql, "INSERT INTO config (keyname, val) VALUES ('amx', 'yes')")

//If the query is less than 0, it failed
    if (ret < RESULT_NONE) {
        new err[255]
        new errNum = dbi_error(mysql, err, 254)
        server_print("error2: %s|%d", err, errNum)
        return 1
    }

//Do a select query
    new Result:res = dbi_query(mysql, "SELECT * FROM config")

//If the query is greater than 0, you got a handle to the result set
    if (res <= RESULT_NONE) {
        new err[255]
        new errNum = dbi_error(mysql, err, 254)
        server_print("error3: %s|%d", err, errNum)
        return 1
    }

    server_print("Result handle: %d", res)

//Loop through the result set
    while (res && dbi_nextrow(res)>0) {
        new qry[32]
//Get the column/field called "keyname" from the result set
        dbi_result(res, "keyname", qry, 32)
        server_print("result: %s", qry)
    }

//Free the result set
    dbi_free_result(res)

//Close the connection
    ret = dbi_close(mysql)
    if (ret <= RESULT_NONE) {
        new err[255]
        new errNum = dbi_error(mysql, err, 254)
        server_print("error4: %s|%d", err, errNum)
        return 1
    }

7. Regular Expressions

Regular Expressions let you describe ways in which to break down strings. They are extremely powerful. AMX Mod X uses the Perl Compatible RE library, you can read the specifics at their site. AMX Mod X offers regular expressions with the regex_amxx module. Here is a short example:

#include <amxmodx>
#include <regex>

public plugin_init()
{
    register_plugin("Regex", "1.0", "BAILOPAN")
    register_srvcmd("amx_regex", "cmdtest")
}

public cmdtest()
{
    new str[] = "It's Walky!"
    //this pattern will match any string which contains
    // two groupings of characters separated by a space
    // the two groupings are substrings 1 and 2
    new pattern[] = "(.+) (.+)"

    new num, error[128]
    //str = string
    //pattern = pattern to use
    //num = special return case code
    //error = if there's an error, it will go here
    //127 - error's max length
    new Regex:re = regex_match(str, pattern, num, error, 127)

    server_print("Result=%d, num=%d, error=%s", re, num, error)

    //REGEX_OK means there was a match
    if (re >= REGEX_OK)
    {
        new str2[64]
        new i
        //since it returned REGEX_OK, num has
        // the number of substrings matched by the pattern.
        //the first substring (0) seems to match the whole string.
        for (i=0; i<num; i++)
        {
            regex_substr(re, i, str2, 63)
            server_print("Substring %d: %s", i, str2)
        }
        //the regular expression matcher uses memory.
        //you must free it if you get REGEX_OK
        //This will also set re to 0.
        regex_free(re)
    }

    //note the invalid regular expression pattern
    //this will return REGEX_PATTERN_FAIL, -1
    re = regex_match("Bruno the Bandit", ".+(]", num, error, 127)

    server_print("Result=%d, num=%d, error=%s", re, num, error)
}

If you compile and run this script (amx_regex in server console) you will see the following output:

Result=1, num=3, error=
Substring 0: It's Walky!
Substring 1: It's
Substring 2: Walky!
Result=-1, num=4, error=missing )

Note that the third parameter to "regex_match()" is special. It's either the number of substrings, a match error code, or a pattern error position (depending on the return value).

8. Entities

Entities are basically any dynamic structure in Half-Life. Players, weapons, grenades, and other little objects laying around are entities. They have a unique "entity id" which you can use to change their values.

I won't go into this too deeply as it's a complicated subject, but the Engine module features natives that let you modify the properties of entities, or search for entities in game by their class/owner (class is the type of entity, such as "player").

For this example, we'll make an entity that looks like a fake player holding a gun.

    //create a basic entity
    entid = create_entity("info_target")
    //set its classname
    entity_set_string(entid, EV_SZ_classname, "some_guy")
    //set its model
    entity_set_model(entid, "models/w_suit.mdl")
    new Float:Vec[3] = {0.0,0.0,0.0}
    //set its origin
    entity_set_origin(entid, Vec)
    //set some basic properties
    entity_set_int(entid, EV_INT_solid, 1)
    entity_set_int(entid, EV_INT_movetype, 6)
    //create the weapon - thanks to pimp_daddy!
    entWeapon = create_entity("info_target")
    entity_set_string(entWeapon, EV_SZ_classname, weapString)
    //set to follow
    entity_set_int(entWeapon, EV_INT_movetype, MOVETYPE_FOLLOW)
    entity_set_int(entWeapon, EV_INT_solid, SOLID_NOT)
    entity_set_edict(entWeapon, EV_ENT_aiment, entid)
    entity_set_model(entWeapon, "models/p_m4a1.mdl")

You can also change other basic things, such as:
//how set_user_armor() works in the fun module
stock set_armor(player, Float:value)
{
    entity_set_int(player, EV_FL_armorvalue, value)
}

9. FakeMeta

FakeMeta is the next generation of Half-Life scripting. It essentially lets you write MetaMod plugins in Pawn. It is extremely powerful, and for this reason, it won't really be covered here. This is just to tell you what it is capable of.

  • Engine/DLL Calls
    There are two types of functions in the HL namespace - Engine functions and DLL functions (DLL functions are ones the game/mod library must export). Both of these can be called using the FakeMeta module using the dllfunc() and engfunc() natives. The parameters are directly passed on to MetaMod, so be careful! You could easily crash a server doing the wrong thing.
  • Engine/DLL Hooks
    As stated above, HL provides Engine and DLL functions. You can also hook/supercede these calls using register_forward. You can supercede these calls using fm_return() and return PLUGIN_HANDLED. Again, make sure you know what you are doing. Malformed hooks will cause crashes.
  • Easy entity manipulation
    FakeMeta replaces Engine's entity__() function with a natives called "pev()" and "set_pev()". They are a bit easier to use. For more information see the fakemeta includes.
  • Private Offset Hacking
    Private offsets are offsets into a block of memory called "pvPrivateData". The right offsets can often modify game-specific features, such as money in Counter-Strike, or resources in Natural-Selection. However, the wrong offsets can cause game crashes.


Scripting Tutorial: Debugging

6. Debugging
AMX Mod X features a greatly enhanced plugin debugger over AMX Mod. If your plugin is giving runtime errors, you should enable the debugger by opening amxmodx\configs\plugins.ini and appending " debug" to your plugin's entry, like so:

myplugin.amxx debug

When you get a runtime error, it will show a full trace of the problem:

L 09/15/2004 - 17:38:17: [AMXX] Run time error 4 (index out of bounds) on line 46 (file "debug.sma").
L 09/15/2004 - 17:38:17: [AMXX] Debug Trace =>
L 09/15/2004 - 17:38:17: [AMXX]       [0] Line 40, File "debug.sma"
L 09/15/2004 - 17:38:17: [AMXX]       [1] Line 25, File "debug.sma"
This type of error is called an AMX run time error - one that occured directly in the plugin interpreter. From this output, we know that this order of events happened:
  • Line 25 was called in debug.sma
  • Line 25 jumped to line 40 in debug.sma
  • Line 40 jumped to line 46 in debug.sma, where an error occured
This specific error is one of the three common errors. It means that an array was improperly indexed, for example:

new array[5]
new x = 500
array[x] = x

Will generate this message. Another common message is AMX_ERR_STACKERR, which means your plugin ran out of memory. The fix for this is to increase the default size from 16KB:

#pragma dynamic 32768

This will increase the memory allocated to 128KB. The dynamic size is measured in cells, which are four bytes each (eight bytes on AMD64). AMX_ERR_STACKLOW and AMX_ERR_HEAPLOW are similar. The most common error by far is AMX_ERR_NATIVE, which means a native function in the AMX Mod X core signaled an error message.

Native errors are usually caused by some error checking failure on the part of the script programmer. For example, supplying an invalid connection id to an SQL function, or trying to modify the data on a player that doesn't exist. These errors will usually give a more helpful error message along with the call trace, as well as the actual name of the native that failed.

For more information on debugging, it is recommended you post on the AMX Mod X forums at http://www.amxmodx.org. Often times people will have solved similar problems before and can help you easily.


Module Writing Guide

X. Module Writing
Content:
  • Introduction
  • Basic Module Layout
    1. Natives/Parameters
    2. Forwards/Callbacks
    3. Compiling
    4. Debugging
  • Function Reference
  • Porting AMX Mod Modules


Module Writing Guide: Introduction

1. Introduction

Before writing an AMX Mod X module, you should have a good understanding of C and pointers.

AMX Mod X modules are significantly more advanced than normal AMX Mod modules. Here are a few main differences:
  • API - AMX Mod X API is both backwards and forwards compatible. The actual attach interface and function prototypes will never change, what will change is what functions are available.
  • Metamod - AMX Mod X modules do not attach to Metamod. They attach to a Metamod abstraction layer called FakeMeta - the functionality, however, is the same.
  • M/SDK - AMX Mod modules are built by manually writing interfaces and including a module header. With AMX Mod X, you simply add an MDK to your project. This MDK includes the memory manager, struct headers, core include references, configuration details, and .def alignment procedures (so you don't need to make a .def file).
  • AMX Mod X API uses an important function which will return a function pointer from the core based on the request:
         void *ReqFuncPtr(cost char *name);
    This lets the module retrieve any internally exported function from the AMX Mod X core, so you don't have to recompile the module every time a new function is added to a struct.
To begin, add "amxxmodule.cpp" and "amxxmodule.h" to your project. You will never need to edit these. *

Add "moduleconfig.h". This will let you configure your module. There are a few important sections you should familiarize yourself with. Module Info: Edit the entries to personalize your module. Do not edit __DATE__, this is a macro.

Now you're ready to go onto the next section to see how a basic module works.

* Note - you can get these files from AMX Mod X CVS or by downloading the source code.


Module Writing Guide: Basics

2. Basic Module Layout
Sections:
  1. Natives/Parameters
  2. Forwards/Callbacks
  3. Compiling
  4. Debugging
1. Natives/Parameters

A native is a C or C++ function that can be used in Small scripts. They are one of the two ways to glue Small to your module. Take this sample native:

//my native
static cell AMX_NATIVE_CALL my_native(AMX *amx, cell *params)
{
    return 1;
}

This native simply returns 1 - it does nothing else. Let's analyze it.
  • static - You should know the static keyword.
  • cell - This is the base type for Small plugins. It is either a 4byte or 8byte unsigned integer depending on the architecture.
  • AMX_NATIVE_CALL - a macro for the calling convention (__cdecl).
  • AMX *amx - a pointer to the AMX structure for a plugin. This structure contains the virtual machine bytecode and state information - you rarely need to use this directly.
  • cell *params - an array of parameters that the plugin passed to your native. params[0] is the number of bytes following in the array, so *params/sizeof(cell) will be equal to the number of parameters. Then params[1] is the first parameter and so on.
  • return 1; - AMX functions should always return a value.
So, how do extract parameters? Let's say we wanted to make a simple math function that found the product of two numbers passed.

static cell AMX_NATIVE_CALL amx_biproduct(AMX *amx, cell *params)
{
    return params[1] * params[2];
}

Simple enough, right? Well, it gets more complicated. Small plugins follow a certain calling convention.

Integers and floats are passed by value. Arrays (including strings) are passed by reference. And lastly, variable arguments are always passed by reference. For example:

native sample_native(a, b, ...);
Everything after b will be by reference.

//native prototype: amx_product(...);
static cell AMX_NATIVE_CALL amx_product(AMX *amx, cell *params)
{
    int i = 0;
    int sum = 1;
    cell *addr = NULL;
    int numParams = *params/sizeof(cell);
    for (i=1; i<=numParams; i++)
    {
        addr = MF_GetAmxAddr(amx, params[i]);
        sum *= (int)(*addr);
    }
    return sum;
}

MF_GetAmxAddr is the first module function we will deal with. It takes two parameters, an AMX virtual machine and a by-reference offset in the machine. It will return the actual address where the data is stored. So here, we retrieve the cell address at which the parameter is stored and add it to our product.

What about floats? Let's say you want to make a function that multiplies two floats together.

//amx_fProduct(Float:a1, Float:a2)
static cell AMX_NATIVE_CALL amx_fProduct(AMX *amx, cell *params)
{
    REAL product;

    product = amx_ctof(params[1]) * amx_ctof(params[2]);

    return amx_ftoc(product);
}

Here we have the next two module functions. The AMX virtual machine has only one data type - the cell. So we have two natives to convert a cell to a float and vice versa. Because cells differ from platform to platform, we use REAL which is a float or a double depending on the cellsize. amx_ctof convers a cell to a REAL and amx_ftoc converts a REAL to a cell. Note we have to return the result as a cell, not a REAL.

Here is the variadic version using multiple parameters:

//native prototype: Float:amx_fProduct({Float}:...);
static cell AMX_NATIVE_CALL amx_product(AMX *amx, cell *params)
{
    int i = 0;
    REAL sum = 1;
    cell *addr = NULL;
    int numParams = *params/sizeof(cell);
    for (i=1; i<=numParams; i++)
    {
        addr = MF_GetAmxAddr(amx, params[i]);
        sum *= amx_ctof(*addr);
    }

    return amx_ftoc(sum);
}

Now, what about strings? There are two issues with strings. Strings are basically arrays, which means each character is a 32bit cell, not a char. To help convert there is a function called MF_GetAmxString:

char *MF_GetAmxString(AMX *amx, cell addr, int bufferId, int *length);

Buffer IDs are from 0 to 3. They copy the string to a static, non-reentrant buffer. This means you can only use this function with 4 string parameters, and that it is not thread safe!

Next, you can "set" strings using MF_SetAmxString. Let's wrap this section up with a super-example. This function will take in a vector (Float:vec[3]), a string, then multiply the vector by the integer value in the string, then set the result as a string and return a float:

//Float:amx_weird(Float:vec[3], const str[], result[], maxlen)
static cell AMX_NATIVE_CALL amx_weird(AMX *amx, cell *params)
{
    int len = 0;
    cell *vec = MF_GetAmxAddr(amx, params[1]);
    char *str = MF_GetAmxString(amx, params[2], 0, &len);
    REAL prod = amx_ctof(vec[0]) * amx_ctof(vec[1]) * amx_ctof(vec[2]);
    prod *= atoi(str);
    char buf[20];
    itoa((int)prod, buf, 10);
    //amx, dest addr, source, max length
    MF_SetAmxString(amx, params[3], buf, params[4]);
    return amx_ftoc(prod);
}

So how do you glue your natives to small scripts? This is a two step process.
First, go to moduleconfig.h and uncomment this line:

    // #define FN_AMXX_ATTACH OnAmxxAttach

Then add this somewhere into your module's main file (let's call it mymodule.cpp):

AMX_NATIVE_INFO my_Natives[] =
{
    {"amx_fproduct",	amx_fProduct},
    {"amx_weird",		amx_weird},
    {NULL,			NULL},
};

This creates a list describing what natives you want to add to Small plugins. The list is formatted as Name, Function, Name, Function, etc. Terminate the list with NULLs. Now create this function:

void OnAmxxAttach()
{
    MF_AddNatives(my_Natives);
}

Now your functions are available to plugins! The last step is to actually make an include file. Example mymodule.inc:

#if defined _mymodule_included
   #endinput
#endif
#define _mymodule_included

//Multiply all the float parameters passed and return the result.
native Float:amx_fproduct({Float}:...);

//This function is just weird!
native Float:amx_weird(Float:vec[3], const numStr[], retstr[], maxLen);

You're done!

2. Forwards/Callbacks

The second way to glue your module to plugins is to make callbacks, or forwards.

For example, let's say you want your module to have two new forwards for plugins: one so they can hook every time something is touched, another so they can hook every time an entity is created by name - but only if they register the call beforehand. The first example is a global forward. In an include, it would look like this:

forward mymodule_Touch(entToucher, entTouched);

To make a global forward is pretty simple. These examples will require Metamod activation in your module. Find these lines in moduleconfig.h and uncomment them:

// #define USE_METAMOD
// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
// #define FN_CreateNamedEntity CreateNamedEntity
// #define FN_DispatchTouch DispatchTouch

In your module header file (mymodule.h) add something like:

#include "CString.h"	//copy this file from AMX Mod X core
#include "CVector.h"	//copy this file from AMX Mod X core
#include "amxxmodule.h" //this is the SDK file

struct CreateForward    //We will use this to store some info
{
    int forwardID;
    String name;
};

extern int TouchForward;
extern CVector<CreateForward> CreateForwards;

In mymodule.cpp, you can now do:

int TouchForward = -1;	//-1 is an invalid forward so initiate this to that
CVector<CreateForward> CreateForwards;

void OnPluginsLoaded()
{
   //mymodule_Touch - the forward name
   //ET_IGNORE - means PLUGIN_HANDLED will be ignored (other option is ET_STOP)
   //FP_CELL - first parameter is a normal cell
   //FP_CELL - second parameter is a normal cell
   //FP_DONE - that's the end of the parameter descriptions
   TouchForward = MF_RegisterForward("mymodule_Touch", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE);
}

void DispatchTouch(edict_t *pfnToucher, edict_t *pfnTouched)
{
   if (TouchForward > -1)
   {
      MF_ExecuteForward(TouchForward, ENTINDEX(pfnToucher), ENTINDEX(pfnTouched));
   }

   //ignore metamod return value
   RETURN_META(MRES_IGNORED);
}

Now your module will call the forward in every plugin, every time two entities touch. The next part is trickier, we want a native that will register forwards, for example:

public plugin_info()
    register_create("createWeaponBox", "weaponbox")

public createWeaponBox(classname[], entId)
{
    //A weaponbox has been created!
}
This is a non-global, or Single Plugin forward. Here is an example of how to make one:

//register_native(func[], classname[])
static cell AMX_NATIVE_CALL register_create(AMX *amx, cell *params)
{
   int len = 0;
   //get function name
   char *func = MF_GetAmxString(amx, params[1], 0, &len);
   //get desired classname
   char *classname = MF_GetAmxString(amx, params[2], 1, &len);

   //new forward storage
   CreateForward sForward;
   //set the classname
   sForward.name.assign(classname);
   //note this time there is no ET_ value.  Also, FP_STRING is a special format option.
   //only use FP_STRING for valid char * zero terminated string pointers.
   //If you need to push an array, you must use FP_ARRAY and MF_PrepareCellArrray
   sForward.forwardID = MF_RegisterSPForwardByName(func, FP_STRING, FP_CELL, FP_DONE);

   if (sForward.forwardID == -1)
   {
      MF_LogError(amx, AMX_ERR_NOTFOUND, "Function \"%s\" was not found!", func);
      return 0;
   }

   //add this information to the main list
   CreateForwards.push_back(sForward);
   return 1;
}

//This is the MetaMod hook for catching when an entity is made.
edict_t *CreateNamedEntity(int iszClassname)
{
   //go through our list of forwards.  do any of the classes match?
   //STRING converts an HL engine isz string to an sz string
   const char *classname = STRING(iszClassname);
   int i = 0;
   edict_t *e = CREATENAMEDENTITY(iszClassname);
   for (i=0; i<CreateForwards.size(); i++)
   {
      if (CreateForwards[i].forwardID != -1)
      {
         if (CreateForwards[i].name.compare(classname) == 0)
         {
            MF_ExecuteForward(CreateForwards[i].forwardID, classname, ENTINDEX(e));
         }
      }
   }
   RETURN_META_VALUE(MRES_SUPERCEDE, e);
}

There! We've now made global and local forwards.

3. Compiling

Lastly, you must compile your module. For Windows, this is fairly easy. Microsoft makes some of the best development environments known - so we have some directions for Microsoft Visual C++ 6.0 and 7.0 (and gcc for Linux users)

Microsoft Visual C++ 6.0
  1. Create a new project from the File menu.
  2. Select Win32 Dynamic-Link Library.
  3. On the next page, select "An empty DLL project".
  4. Go to Projet, Add to Project, Files.
  5. Add amxxmodule.cpp, amxxmodule.h, moduleconfig.h, and the other files you have for your module.
  6. Go to Project, Settings. Change these settings for both Win32 Debug and Win32 Release options.
  7. Under C++ / Code Generation, it is recommended you do not make Multi-Threaded builds.
  8. Under Link, you should change the module name to conform to AMX Mod X standards: <modulename>_amxx.dll.
  9. Once you're done, go to Tools, Options, Directories.
  10. Make sure you have Metamod and HLSDK source code installed.
  11. Add the following directories above the already included ones:
    • in hlsdk/SourceCode or hlsdk/multiplayer/ folder: pm_shared, engine, common, dlls.
    • Metamod's source folder.
    • AMX Mod X's source folder if you include AMXXSTL files with #include <>.
  12. You're ready to build your module from the Build menu. Use Set Active Configuration to switch between Debug and Release.
Microsoft Visual C++ 7.0
  1. Go to File, New, Project.
  2. Select Visual C++ Projects, Win32 Application.
  3. Select Application Settings, DLL, Empty Project.
  4. Go to Project, Properties. For both Debug and Release, change these:
    • Linker->General should conform to AMX Mod X's naming scheme, _amxx.dll
    • C/C++->Code Generation->Runtime Library should never be Multi-Threaded (unless special circumstances need it).
  5. Lastly, in the Tools, Options, Projects, VC++ Directories, Include Files menu, make sure to include the same directories as shown above for VC++ 6.0
Linux (GNU C Compiler 2.95 and 3.30)
  1. AMX Mod X is distributed with perl Makefiles to assist you in building your modules. They are fairly easy to edit - you can just change the array containing the source files. For 32bit machines, you can use a GCC line like this:
    gcc -march=i386 -O3 -fomit-frame-pointer -s -Wall -fno-rtti    \
    -fno-exceptions -fPIC <list of source files> -ldl -shared  \
    -lm -o_i386.so

    For 64bit, it becomes:
    gcc -m64 -DSMALL_CELL_SIZE=64 -DHAVE_I64 -O3 -fomit-frame-pointer \
    -s -Wall -fno-rtti -fno-exceptions -fPIC <list of source files> \
    -ldl -shared -lm -o<modulename>_amd64.so
  2. If you use the Standard C++ Library, you may need to include -lstdc++, just be aware that not everyone may have your version of stdc++.
  3. To test if your module will load on linux, you can use the "dlsym" or "dlsym64" program that comes with AMX Mod X for Linux. It will either return an error message or success notification:
    cd amxmodx/scripting
./dlsym ~/mymodule/mymodule_i386.so

4. Debugging (crashes)

I'm not going to go into how to debug too in depth, as it's a complicated subject best learned by practice. But I will go over how to start and see a debugger and a call stack trace (showing what happened prior to the crash). Since MSVC 7.0's debugger is much easier to use than 6's, I will not cover 6's.

Microsoft Visual C++ 7.0
  1. Compile your module in debug mode. You may also want to compile and upload debug versionso of AMX Mod X and Metamod, incase the bug ends up being there.
  2. Start HLDS with -dev 1. This gives metamod a 10 second pause so you can attach to the HLDS process. You could also just use HLDS GUI and attach before you click "Start".
  3. In MSVC, go to Tools, Debug Process. Attach to the HLDS process.
  4. Cause your module to crash or hit a breakpoint.
  5. In MSVC, go to Debug, Windows, Call Stack.
Linux (GNU Debugger)
  1. Compile your module with only the following optimization flags:
      -ggdb3
   (or for AMD64:)
  -ggdb3 -DSMALL_CELL_SIZE=64 -DHAVE_I64
  2. Cd into the directory where hlds_run is located. Type the following line into your shell/command line:
    export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
  3. Make sure you have GDB (GNU Debugger installed). Enter the debugger:
    gdb hlds_i686
  (or on AMD64)
gdb hlds_amd64
  4. Load HLDS:
    run +maxplayers 16 +map de_dust -game cstrike -debug
  5. Cause your module to crash, or hit a previously specified breakpoint.
  6. Now you can use the GNU Debugger to view a call stack with any of these commands:
    bt
where
backtrace
  7. Or if you want a more advanced diagnostic:
    info all-registers
For both debuggers, there are many more options for powerful debugging. It is best to consult the manuals to see how to use them.


Module Writing Guide: Function Reference

3. Module Function Reference
  • amx_ctof
  • amx_ftoc
  • MF_AddNatives
  • MF_AmxAllot
  • MF_AmxExec
  • MF_AmxExecv
  • MF_AmxFindNative
  • MF_AmxFindPublic
  • MF_BuildPathname
  • MF_BuildPathnameR
  • MF_CopyAmxMemory
  • MF_ExecuteForward
  • MF_FindScriptByAmx
  • MF_FindScriptByName
  • MF_Format
  • MF_FormatAmxString
  • MF_GetAmxAddr
  • MF_GetAmxString
  • MF_GetAmxStringLen
  • MF_GetAmxAddr
  • MF_GetModname
  • MF_GetPlayerArmor
  • MF_GetPlayerCurweapon
  • MF_GetPlayerDeaths
  • MF_GetPlayerEdict
  • MF_GetPlayerFlags
  • MF_GetPlayerFrags
  • MF_GetPlayerHealth
  • MF_GetPlayerIP
  • MF_GetPlayerKeys
  • MF_GetPlayerMenu
  • MF_GetPlayerName
  • MF_GetPlayerPlayTime
  • MF_GetPlayerTeam
  • MF_GetPlayerTeamID
  • MF_GetPlayerTime
  • MF_GetScriptAmx
  • MF_GetScriptName
  • MF_IsPlayerAlive
  • MF_IsPlayerAuthorized
  • MF_IsPlayerBot
  • MF_IsPlayerConnecting
  • MF_IsPlayerHLTV
  • MF_IsPlayerIngame
  • MF_IsPlayerValid
  • MF_Log
  • MF_LogError
  • MF_PrepareCellArray
  • MF_PrepareCellArrayA
  • MF_PrepareCharArray
  • MF_PrepareCharArrayA
  • MF_PrintSrvConsole
  • MF_RaiseAmxError
  • MF_LogError
  • MF_RegisterFunction
  • MF_RegisterForward
  • MF_RegisterSPForward
  • MF_RegisterSPForwardByName
  • MF_RequestFunction
  • MF_AmxFindPublic
  • MF_SetAmxString
  • MF_UnregisterSPForward

    REAL	amx_ctof( cell x );
 Converts a cell to a REAL (float or double) value.

    REAL	amx_ftoc( float x );
 Converts a REAL (float or double) to a cell value.

    int	MF_AddNatives( const AMX_NATIVE_INFO *list );
 Adds an array of natives to the AMX Mod X core. Returns 1 for success and 0 for failure.

    int	MF_AmxAllot( AMX *amx, int cells, cell *amxAddr, cell **physAddr );
 Allocates memory in an AMX plugin, returning AMX_ERR_NONE on success. AmxAddr will contain the AMX offset and physAddr will contain the physical address.

    int	MF_AmxExec( AMX *amx, cell *retval, int index );
 Executes a public function by index on a specific plugin. The return code for the machine state is returned, and the actual plugin return value is stored in the cell pointed to by retval.

    int	MF_AmxExecv( AMX *amx, cell *retval, int index, int numparams, cell params[] );
 This function is deprecated and is no longer usable.

    int	MF_AmxFindNative( AMX *amx, const char *name, int *index );
 Same as MF_AmxFindPublic, except returns the index of a native instead of a public function.

    int	MF_AmxFindPublic( AMX *amx, const char *name, int *index );
 Finds a public function by name in a specific plugin. The function index is stored in the integer pointed to by index. On success, AMX_ERR_NONE is returned, otherwise AMX_ERR_NOTFOUND is returned.

    char*	MF_BuildPathname( const char *format, ... );
 Formats a series of strings in the style of sprintf(), converting the path tokens for the current operating system. The return pointer is a static buffer, currently set to 256 bytes.

    char*	MF_BuildPathnameR( char *buffer, size_t maxlength, const char *format, ... );
 Same as MF_BuildPathname, but re-entrant. Recommended usage over its predecessor.

    void	MF_CopyAmxMemory( cell *dest, const cell *src, int len);
 Copies a segment of memory from src to dest. Length is in cells, not bytes.

    int	MF_ExecuteForward( int id, ... );
 Executes a given forward (valid IDs are > -1). Each variable argument parameter must match the constructs used with MF_RegisterForward style functions.

    int	MF_FindScriptByAmx( const AMX *amx );
 Returns the integer id of an AMX Mod X loaded plugin matching the given AMX pointer.

    int	MF_FindScriptByName( const char *name );
 Returns the integer id of an AMX Mod X loaded plugin matching the given file name.

    const char * MF_Format( const char *format, ... );

Formats a string using the Language Translator in the AMX Mod X core.

    char*	MF_FormatAmxString( AMX *amx, cell *params, int bufferId, int *len);
 Formats a string using the parameters of a native call. You should always pass the params array directly, because the function expects the first cell to contain the parameter count. This function contains two buffer slots, 0 and 1. The return value is a pointer from one of these static buffers. The length of the final string is stored in the integer pointed to by "len".

    cell*	MF_GetAmxAddr( AMX *amx, cell offset );
 Returns the cell address of a parameter passed by reference, such as a variable argument, byref parameter, string, or array.

    char*	MF_GetAmxString( AMX *amx, cell amxAddr, int bufferId, int *len );
 Returns a null-terminated string constructed from an amx by-reference address. The pointer is to one of four buffer slots, 0-3. The length of the string is stored in the integer pointed to by "len".

    int	MF_GetAmxStringLen( const cell *ptr );
 Returns the length of a string stored as an array of cells (for example, a result from MF_GetAmxAddr()).

    const char*	MF_GetModname();
Returns a string containing the mod name.

    int	MF_GetPlayerArmor( int playerId );
 Returns the armorvalue of a player by id.

    int	MF_GetPlayerCurweapon( int playerId );
 Returns the id of the current weapon of a player by id.

    int	MF_GetPlayerDeaths( int playerId );
 Returns the death count of a player by id.

    int	MF_GetPlayerEdict( int playerId );
 Returns the edict_t pointer of a player by id.

int MF_GetPlayerFlags( int playerId );

Returns the flags set on player flag slot 0 by id.

    int	MF_GetPlayerFrags( int playerId );
 Returns the amount of frags of a player by id.

    int	MF_GetPlayerHealth( int playerId );
 Returns the health of a player by id.

    const char *	MF_GetPlayerIP( int playerId );
Returns a string containing a player's IP address by id.

    int	MF_GetPlayerKeys( int playerId );
 Returns a player's keys by id.

    int	MF_GetPlayerMenu( int playerId );
 Returns a player's current menu by id.

    const char *	MF_GetPlayerName( int playerId );
Returns a player's name by id.

    float	MF_GetPlayerPlayTime( int playerId );
 Returns a player's playtime by id.

    const char *	MF_GetPlayerTeam( int playerId );
Returns a player's team name by id.

    int	MF_GetPlayerTeamID( int playerId );
 Returns a player's team id by id.

    float	MF_GetPlayerTime( int playerId );
 Returns a player's total time by id.

    AMX*	MF_GetScriptAmx( int id );
 Returns a plugin's AMX structure by id.

    AMX*	MF_GetScriptName( const char *name );
 Returns a plugin's AMX structure by name.

    int	MF_IsPlayerAlive( int id );
 Returns 1 if a player is alive, 0 otherwise.

    int	MF_IsPlayerAuthorized( int id );
 Returns 1 if a player is Steam authorized, 0 otherwise.

    int	MF_IsPlayerBot( int id );
 Returns 1 if a player is a bot/fakeclient, 0 otherwise.

    int	MF_IsPlayerConnecting( int id );
 Returns 1 if a player is still connecting, 0 otherwise.

    int	MF_IsPlayerHLTV( int id );
 Returns 1 if a player is an HLTV, 0 otherwise.

    int	MF_IsPlayerIngame( int id );
 Returns 1 if a player is in-game, 0 otherwise.

    int	MF_IsPlayerValid( int id );
 Returns 1 if a player id is a valid id, 0 otherwise.

    void	MF_Log( const char *format, ... );
 Logs a message in the style of sprintf() to Half-Life. The module's name is prepended in the style of Metamod.

    void	MF_LogError( AMX *amx, int err, const char *format, ... );
 Logs a message using the generic error messenger (debug tracer). The error code should usually be AMX_ERR_NATIVE, and format is in the style of sprintf(). If you use this, you should not use MF_RaiseAmxError().

    cell	MF_PrepareCellArray( cell *ptr, unsigned int size );

    cell	MF_PrepareCellArrayA( cell *ptr, unsigned int size, bool copyBack);
 Allocates memory for a cell array for a forward. The AMX address offset is returned as a cell. If copyBack is true, any data changed in the array after the forward is executed is copied back to the original AMX address.

    cell	MF_PrepareCharArray( char *ptr, unsigned int size );

    cell	MF_PrepareCharArrayA( char *ptr, unsigned int size, bool copyBack );
 Same as PrepareCellArray, except the source is a null terminated string instead of a cell array.

    void	MF_PrintSrvConsole( char *format, ... );
 Prints text in the style of sprintf() to the server console.

    int	MF_RaiseAmxError( AMX *amx, int error );
 Obsolete - use MF_LogError() instead. Sets the error state in an AMX instance which will halt the machine and invoke a generic error message.

    void	MF_RegisterFunction( void *pfn, const char *name );
 Registers a function in the module funciton table, for use with MF_RequestFunction.

    int	MF_RegisterForward( const char *funcname, ForwardExecType exectype, ... );
 Registers a global forward throughout all plugins. "funcname" is the name of the function which must be public. ForwardExecType is either ET_STOP (halt on PLUGIN_HANDLED) or ET_IGNORE (ignore return value). The rest of the parameters should be an FP_DONE terminated list of parameter types, which are: FP_CELL (normal), FP_FLOAT (float), FP_STRING (null terminated string), FP_STRINGEX (copy back string), FP_ARRAY (use the return value of PrepareCellArray). The return value is the identifier which should be used with MF_ExecuteForward.

    int	MF_RegisterSPForward( AMX *amx, int func, ... );

    int	MF_RegisterSPForwardByName( AMX *amx, const char *func, ... );
 Registers a forward to a public function in a single plugin. Note that there is no ExecType value, as it is unnecessary. The return value is the identifier which should be used with MF_ExecuteForward. The integer func should be the value of MF_AmxFindPublic(), or use the function which registers by function name.

    void *	MF_RequestFunction( const char *name );
 Requests a function from the module function table.

    int	MF_SetAmxString( AMX *amx, cell amxAddr, const char *src, int max );
 Sets an AMX string. amxAddr should be an AMX offset that points to an array. Max is the maximum number of cells to copy.

    void	MF_UnregisterSPForward( int id );
 Unregisters a previously registered forward.


Module Writing Guide: Porting AMX Mod Modules

4. Porting AMX Mod Modules
Sections:
  1. New Include/Base Structure
  2. New API
  3. New Forward/Callback System
1. New Include/Base Structure

Instead of including <modules.h>, you should now include <amxxmodule.h> and add the M/SDK to your project (get the MDK from CVS or the packaged source code).

Then you should make the necessary moduleconfig.h configuration changes listed in the module writing guide to enable Metamod hooks, Native hooks, and your module's "personal" information struct.

You should remove any .def files, and also remove any Metamod or AMX Mod hooks, such as Meta_Attach() or Amx_Attach(). Instead, uncomment the appropriate hooks in moduleconfig.h - such as OnAmxxAttach for natives and OnPluginsLoaded for forwards. For Metamod, remove all of the engine hook sets and uncomment the appropriate hooks in moduleconfig.h. For example, if your old AMX Mod module had this:

C_DLLEXPORT int AMX_Attach(pfnamx_engine_g* amxeng,pfnmodule_engine_g* meng) {
   g_engAmxFunc = amxeng;
   g_engModuleFunc = meng;

   if(!gpMetaGlobals) REPORT_ERROR(1, "[AMX] fun is not attached to metamod (module \"%s\")\n", LOGTAG);

   ADD_AMXNATIVES(&module_info, fun_Exports);

   return(1);
}

This would simply become:

void OnAmxxAttach()
{
    MF_AddNatives(fun_Exports);
}

Likewise:

enginefuncs_t meta_engfuncs;
C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int interfaceVersion ) {
   meta_engfuncs.pfnTraceLine = TraceLine;
   memcpy(pengfuncsFromEngine, &meta_engfuncs, sizeof(enginefuncs_t));
   return(TRUE);
}

Is simply deleted, and #define FM_TraceLine is uncommented from moduleconfig.h.

Easy, huh? Other things, like global/external pointers used for MM/AMX should be removed. These are handled by the M/SDK.

2. Natives/Parameters

You should familiarize yourself with the new module functions available.

Here are some quick changes. The parameter count is listed as well. A * indicates the parameters changed.

  • ADD_AMXNATIVES(2) -> MF_AddNatives(1*)
  • AMX_RAISEERROR(2) -> MF_RaiseAmxError(2) or MF_LogError(...*)
  • GET_AMXADDR(2) -> MF_GetAmxAddr(2)
  • SET_AMXSTRING(4) -> MF_SetAmxString(4)
  • GET_AMXSTRING(4) -> MF_GetAmxString(4*)
3. New Forward/Callback System

AMX Mod modules are responsible for handling forwards their own way - in AMX Mod X the core does it for you.

Take this example from VexD, the way to manage a forward was:

struct AmxCall {
   plugin_t *pPlugin;
   int iFunctionIdx;
};

std::vector<AmxCall> vTouchCallList;

//Registering the forward:
   if (AMX_FINDPUBLIC(&pCurrent->amx, "vexd_pfntouch", &iFunctionIndex) == AMX_ERR_NONE) {
      AmxCall sNewCall;
      sNewCall.pPlugin = pCurrent;
      sNewCall.iFunctionIdx = iFunctionIndex;
      vTouchCallList.push_back(sNewCall);
   //...		}

//Calling the forward:
   for(std::vector<AmxCall>::iterator i = vTouchCallList.begin(); i != vTouchCallList.end(); i++) {
      cell iRetVal = 0;
      AMX_EXEC(&i->pPlugin->amx, &iRetVal, i->iFunctionIdx, 2, ENTINDEX(pToucher), ENTINDEX(pTouched));
   }

Rather than using the new API functions (MF_AmxFindPublic, MF_AmxExec), let's try using the new Forward system.

int TouchForward = -1;

//Registering the forward:
   TouchForward = MF_RegisterForward("vexd_pfntouch", ET_IGNORE, FP_CELL, FP_CELL, FP_DONE);

//Calling the forward:
   MF_ExecuteForward(TouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched));

Simple, clean, efficient. Have fun!


Appendix

XI. Appendix
Sections:
  • Frequently Asked Questions
  • Changelog
  • Credits
  • License


Appendix: Frequently Asked Questions

A. Frequently Asked Questions

Questions:
  • When does the next version come out?
  • What is Pawn? Isn't it Small?
  • Where is AMX Mod X for Half-Life 2 or Counter-Strike:Source?
  • Can I use bots with AMX Mod X?
  • Should I upgrade to the latest version?
  • I HAVE A BUG REPORT! What do I do with it?
  • Why didn't you accept my fix/idea/patch/bugreport?
  • Do you have a webpage that can compile plugins?
  • Can AMX Mod X run Admin-Mod plugins?
  • Can AMX Mod X run AMX Mod plugins?
  • Can AMX Mod X run AMX Mod modules?
  • Will AMX Mod X support AMX Mod 0.9.9?
  • Does AMX Mod X support mods other than Counter-Strike?
  • Can I run Admin-Mod and AMX Mod X at the same time?
  • Can I run AMX Mod and AMX Mod X at the same time?
  • What is/was MetamodX?
  • What is Metamod-p?
  • Can I be a moderator on IRC or the Forums?
  • Can I be a developer or join a portion of the project team?
  • Is OLO or dJeyL affiliated with AMX Mod X?
  • Does OLO approve of AMX Mod X?
  • Did AMX Mod X steal the AMX Mod source code?

Q: When does the next version come out?
A: When it's done. Don't ask. That's just annoying.

Q: What is Pawn? Isn't it Small?
A: As of version 3.0, ITB CompuPhase has renamed Small to Pawn because the name was too common.

Q: Where is AMX Mod X for Half-Life 2 or Counter-Strike:Source?
A: AMX Mod X is being rewritten from the ground up as SourceMod. You can check it out here: www.sourcemod.net

Q: Can I use bots with AMX Mod X?
A: Of course, read Admin-Mod's guide on how to do it. It applies here, too.
http://www.adminmod.org/help/online/Configuration/How_to_Use_Bots_with_MetaMod_AM_2.50_and_up.htm

Q: Should I upgrade to the latest version?
A: Only if you want to, or if there is a bug fix/optimization you need.
AMX Mod X 0.16 is almost identical to AMX Mod 0.9.8 and 0.9.9, so 0.20 is the first true "AMX Mod X" version that changes nearly everything. You should upgrade if you're sure everything will work. Don't fix what's not broken, unless you're like me and have to try the new thing.

Q: I HAVE A BUG REPORT! What do I do with it?
A: You can post in the forums about it or write a notice on the SF project page (http://www.sf.net/projects/amxmodx).

Q: Why didn't you accept my fix/idea/patch/bugreport?
A: Maybe we didn't get to it, maybe we didn't like it. Usually almost all patches/fixes are accepted but ideas or code that are broken or don't fit into a general theme will be rejected. Since AMX Mod X is GPL'd, you are always free to release your own fork of it (but not on the forums please).

Q: Do you have a webpage that can compile plugins?
A: We sure do! Go to www.amxmodx.org and click on "Compiler". It will use the AMX Mod X 0.20 compiler, "amxxsc". The backend is ITB CompuPhase's sc-2.5.1.

Q: Can AMX Mod X run Admin-Mod plugins?
A: No.

Q: Can AMX Mod X run AMX Mod plugins?
A: It can compile and run any plugin that is AMX Mod 0.9.8 compatible. You must recompile the plugin with AMX Mod X's compiler/include files.

Q: Can AMX Mod X run AMX Mod modules?
A: It can run any AMX Mod 0.9.8 compatible module. As of AMX Mod X 1.5, this feature was removed because of the Pawn upgrade breaking backwards compatibility.

Q: Will AMX Mod X support AMX Mod 0.9.9?
A: No. The module API for AMX Mod is not backwards or forwards compatible so it's not worth "keeping up" with AMX Mod from behind. The module API for AMX Mod X applies to all forward and backward versions, what changes is the Module Development Kit.

Q: Does AMX Mod X support mods other than Counter-Strike?
A: There is special support for Counter-Strike because, undeniably, it is the moving force of Half-Life today. For other mods AMX Mod X provides mod addon packages (TFC, DoD, NS, and TS). AMX Mod X will work on all other mods supported by Metamod but includes no special support.

Q: Can I run Admin-Mod and AMX Mod X at the same time?
A: Yes.

Q: Can I run AMX Mod and AMX Mod X at the same time?
A: Technically, yes. But it is highly recommended you do not do this.

Q: What is/was MetamodX?
A: MetamodX was a set of patches to Metamod after the project seemed to be dead. The set of patches were trivial and written by BAILOPAN, mainly as an effort to showing that if something was not done, Metamod would continue to be forked. Eventually Will Day named Florian Zschocke, the Admin-Mod maintainer, the new project maintainer for Metamod. Although Florian now maintains Metamod, Will Day is on the project as the wisened sage ;]

Q: What is Metamod-p?
A: This is a special version of Metamod designed by Jussi "hullu" Kivillina. It uses a dynamic link patching approach to make Metamod versatile enough to not need specific mod support - it can run on any mod without requiring predefined entity links. AMX Mod X supports running on this version.

Q: Can I be a moderator on IRC or the Forums?
A: Short answer: NO. Long answer: No, and for asking, you've just blown your chances.
Moderators arise naturally from the primordial chaos that are public forums. Be it IRC or a BBS, there are a few types of people: Trolls, OT Trolls, Well-Meaning Trolls, People-Who-Are-Actually-Insightful, and Moderators. They're a separate class of posters who, from what they've posted in the past, have an aura and resonance that says, "Not only can I be trusted, but I'm not an idiot. I'm patient, observant, and dedicated." If you're begging for mod/op, you're obviously none of these things.

Q: Can I be a developer or join a portion of the project team?
A: PM SniperBeamer with an application. Say who you are, what you've done, your experience, and what you'd like to do.

Q: Is OLO or dJeyL affiliated with AMX Mod X?
A: Dear me, I should hope not!

Q: Does OLO approve of AMX Mod X?
A: Who cares?

Q: Did AMX Mod X steal the AMX Mod source code?
A: Since the AMX Mod source code is under the GPL, it's not stolen if we also license it under the GPL. AMX Mod X was "forked" from the code-base. Even though we've rewritten a huge amount of the code from scratch, we always attach the following credit to each file, whether written by OLO or not:
"Originally developed by OLO"
After all, if it weren't for OLO, we wouldn't be writing this ;]

Q: Does AMX Mod X have some thing with turtles?
A: Turtles are really funny. Who doesn't like turtles? Errr, no, we don't have anything with turtles. I swear. Although I have heard rumours about cats.

Q: Yams!
A: yay


Appendix: Changelog

B. Changelog
Versions:
  • AMX Mod X:
  • 1.60 (September 18, 2005)
  • 1.55 (August 24, 2005)
  • 1.50 (August 1, 2005)
  • 1.01 (March 09, 2005)
  • 1.00 (November 14, 2004)
  • 0.20-RC7 (October 29, 2004)
  • 0.20-RC6 (September 20, 2004)
  • 0.20-RC5 (September 12, 2004)
  • 0.20-TP4 (September 2, 2004)
  • 0.20-TP3 (August 24, 2004)
  • 0.20-TP2 (August 22, 2004)
  • 0.16 (March 26, 2004)
  • 0.15 (March 15, 2004)
  • 0.10 (March 08, 2004)
  • AMX Mod:
  • 0.9.7
  • 0.9.6
  • 0.9.5
  • 0.9.4
  • 0.9.3
  • 0.9.2
  • 0.8.4
  • 0.7.3
  • 0.7
  • 0.6.1
  • 0.6
  • 0.5
  • 0.4
AMX Mod X 1.60 (September 18, 2005 - Codename "Rusty Mushroom")
  • Plugins can now query/retrieve client-side cvars (for example, to enforce CVAR rules).
  • Plugins can now use modules and natives without them being loaded. For example, plmenu will use the cstrike module only if it's available, and no recompile is necessary.
  • Plugins can now handle their own errors and look at their own debug traces.
  • Rewrote the debugger from scratch and, in some cases, greatly improved error message output.
  • Numerous other warnings and compiler bugs were removed and/or fixed in this release.
  • Fixed many bugs in AMXx Studio (bringing it to version 1.2).
  • Faluco has reformatted every single original, OLOcode AMX Mod X source code file to be readable! This was a herculean task and we thank him for his time.
  • Made some final improvements to Linux optimization flags.
  • Added is_string_num() (thanks azrael!)
  • Added abs() (requested by Brad Jones)
  • Language files can now have comments with ; or //
  • amx_addadmin in admin.sma will now also add to the SQL database if available (thanks Lazarus Long!)
  • Improved parameters to amx_addadmin so more admin types can be added (thanks Lazarus Long!)
  • Fixed nvault_open() crashing after nvault_close was called on the same file (atambo).
  • Fixed Linux compiler not being able to run from any directory (Lazarus Long).
  • Fixed get_distance_f not being in amxmodx.inc (Greenberet).
  • Fixed trim() function not removing whitespace properly (karlos).
  • Fixed many bugs in the compiler preprocessor and macro preprocessor.
  • Fixed bug in compiler where array indexes were improperly tag-checked.
  • Fixed various array bugs in register_native default style (Lord of Destruction).
  • Fixed dod_get_map_info breaking after a mapchange (FireStorm)..
  • Fixed/rewrote find_ent_by_model in Engine.
  • Fixed MySQL crashing on null fields (And One).
  • Fixed listen servers not getting admin access (jtp10181).
  • Fixed crash bugs in MySQL when querying and caching field names (Striker).
  • Fixed more memory deallocation mismatches with plugins (Zenith77).
  • Fixed get_user_gravity not returning a Float (vittu).
  • Fixed MySQL module not conforming to DBI, causing memory leaks and crashes.
  • Fixed build process and various minor errors in SQLite module (thanks Lazarus Long!)
  • Fixed AMXXRelease releasing no config files on Linux (Gonzo).
  • Fixed permissions problems with AMXXRelease on Linux (hondaman, Arnold).
  • Fixed/reverted functionality of stopping plugins for amx_pausecfg.
  • Fixed plmenu (Player Menu) not swapping or displaying teams correctly after Steam update (KWo)
  • Fixed name clashes in TSFun and TSX modules (Twilight Suzuka).
AMX Mod X 1.55 (August 24, 2005)
  • Changed the JIT to prevent possible crashing on pingboost/threading situations on linux (reported by hullu).
  • Compiled with gcc-3.4 instead of 2.95 - binaries should be smaller and faster (thanks hullu). AMX Mod X and the S/MDK will no longer compiler on gcc-2.95
  • Added human readable error messages to many core natives.
  • Added Czech language translation (thanks Fatty).
  • Replaced AMXX Edit with newer AMXX Studio.
  • Replaced ESF module with new ESF plugin from Corona-Bytes.
  • Fixed bug where set_task would run one extra time on "repeat" mode.
  • Fixed bug where plugins could not be unpaused.
  • Fixed bug where bots could not deal damage with Fun module.
  • Fixed linux compiler crashing on load.
  • Fixed crash bug in register_native.
  • Fixed alloc/dealloc mismatches in register_native.
  • Fixed three newmenu functions not being implemented (patched by Freecode).
  • Fixed a bug where CS team switching did not work with plmenu (Steam update consequence).
  • Fixed callfunc_push_str copying zero characters (reported by Lord of Destruction, Twilight Suzuka).
  • Fixed documentation errors about MF_AmxExec* (Twilight Suzuka).
AMX Mod X 1.50 (August 1, 2005 - Codename "Schnappi Kitten")
  • Updated Small to version 3.0. Note: ITB CompuPhase has changed the name of Small to "Pawn". This includes an improved and more powerful compiler. You can now return arrays, simulate "structs", and the optimizer has been improved.
  • Large reduce in CPU usage for non-Metamod-p users. AMX Mod X now requires Metamod 1.18 or Metamod-p. Note: this is because we have removed the internal mini-Metamod that was added in 0.20.
  • Added new system for automating multi-page menus.
  • Added module for ESF (Earth's Special Forces), thanks to Lynx.
  • Rewrote installer from scratch, now a much more improved interface that actually works.
  • Added an official "AMX Mod X Editor", AMXX-Edit. To be expanded as AMX Mod X Studio in the future.
  • Rewrote MySQL module (again) - now can be used by other modules.
  • Added new plugin debugging system from Small 3.0. Old plugins need to be recompiled to be debugged.
  • Added "register_native", plugins can now create natives that other plugins can use. This was first conceptualized by dJeyL and added on request of T(+)rget.
  • Changed the plugin file format to be a tad more flexible. Old plugins will still work.
  • Added a module for dealing with binary vaults (nVault).
  • Added another The Specialists module (TSFUN).
  • Deprecated AMX Mod module support, which was incompatible with Small 3.0.
  • Require_module is deprecated. Module detection is now done automatically when you compile plugins.
  • Fixed a serious memory leak in set_task (reported by fysh).
  • Fixed a serious memory leak in entity_set_model (reported by EKS).
  • Fixed deallocation errors in engine and core (reported by theqizmo, OneEyed, and fysh).
  • Added module API changes that require a sync of the SDK. This was to make sure modules had the right Small 3.0 headers. Modules compiled with the old SDK will refuse to load.
  • Added inter-module communication to complement AMX Mod X's inter-plugin communication.
  • Deprecated read_dir, added much faster open_dir natives.
  • Fixed a bug where language settings were mishandled (thanks faluco).
  • Fixed a good deal of language translation-related errors (thanks faluco).
  • Added Spanish, Brazilian translations (thanks faluco, AlucarD_fOx).
  • Fixed bug where repeated tasks actually repeated one less than their given amount (reported by EKS).
  • Fixed bug where bad language translation files could corrupt build_pathname (reported by Kamikaze).
  • Fixed is_user_hltv (thanks Wallslide).
  • Fixed mishandling of user input strings (potential security bug). Reported and diagnosed by Stan Bubrouski.
  • Fixed log_to_file so it logs to the right file (reported by karlos).
  • Fixed bug in the JIT where a lone default case would crash (reported by twistedeuphoria).
  • Fixed bug where client_print to console would not insert newlines (reported by azrael).
  • Added dir_exists (requested by twistedeuphoria).
  • Fixed memory leaks on plugin unload.
  • Deprecated most fget/fput natives (they have been removed), due to improper implementation.
  • Fixed problems with weapon ids in DoDX
  • Fixed problem with setting and retrieving strings with set_pev/pev
  • Updated Regex library from PCRE 4.5 to 6.1.
  • Updated GeoIP database to July 2005
  • Updated Natural-Selection module for latest NS release.
  • Fixed bugs and added new natives to DoDFun.
  • Fixed various bugs in the documentation.
  • Fixed potential problems in register_message, reduced memory usage a bit.
  • Added in_viewcone and can_see, at the request of v3x.
  • Fixed bug in MySQL module where a port could not be added to the connect string (reported by azrael).
  • Added trace_forward at the request of, and by, twistedeuphoria.
  • Added get_distance_f to core at the request of twistedeuphoria.
AMX Mod X 1.01 (March 09, 2005)
  • Updated NS module for Natural Selection 3.0.
  • Added new package to maintain unsupported SQL/DBI modules.
  • Added a module for SQL Lite.
  • Added a tool for viewing stats (CS addon).
  • Added optimizations for when using Metamod-p (evilspy).
  • Added mkdir native.
  • Added cs_set/get_user_armor.
  • Added callfunc_begin_i and get_func_id.
  • Added more client menu functionality to menufront.
  • Added a new MySQL module for version 4.1.
  • Updated get_stats to work with authids.
  • Updated and cleaned the funcwiki. (thanks, Avalanche).
  • Fixed logging bug in SDK.
  • Fixed bugs with bots disconnecting.
  • Fixed bugs with uninitialized players disconnecting.
  • Fixed parse bug in strbreak.
  • Fixed typos in config files.
  • Fixed installer when using Condition-Zero.
  • Fixed custom weapons in xmod stuff.
  • Fixed grenade problem in CSX.
  • Fixed mistakes in documentation (breaddawson).
  • Fixed compiling error in adminslots (Firestorm).
  • Fixed a hitzones problem with Fun.
  • Snyced language files.
AMX Mod X 1.00 (November 14, 2004 - Codename "Kaiserpinguin")
  • Added an installer.
  • Completed documentation.
  • Added fakemeta_stocks include file.
  • Added PM OnoTo's XS Library.
  • Added natives to array_amxx to check lists for values.
  • Admin.sma will now immediately exec amxx.cfg to make plugin_cfg more useful.
  • Synced language files and added Dutch (thanks Devilion).
  • Increased write-file buffer.
  • Fixed a bug that caused the JIT to crash with a kernel option in 2.6.x.
  • Fixed many Counter-Strike native offsets in Cstrike module.
  • Fixed a crash bug in hooking MESSAGE_BEGIN in Fakemeta_amxx
  • Fixed a bug where admin_sql would not reset admins on fallback to users.ini.
  • Fixed range checking in set_user_hitzones.
  • Fixed read_data() float return method.
  • Fixed version and file info in some modules and core.
AMX Mod X 0.20-RC7 (October 29, 2004)
  • Improved plugin error output and debugging greatly.
  • Run time errors of type 10 (AMX_ERR_NATIVE) now display the native's name for clarity.
  • If debug is not enabled and an RTE occurs, instructions on enabling debug mode are printed.
  • Rewrote error reporting for all modules to use new debug trace API.
  • Added get_user_msgname().
  • Added custommenuitems.cfg to standard cfg files.
  • Added ability for plugins to dynamically add items to amxmodmenu.
  • Fixed compiler generating very long file paths for debug information.
  • Fixed error causing amx_client_languages to reverse effects.
  • Fixed error causing floats passed in forwards to mess up everything.
  • Fixed menu mistakes in StatsX.
  • Fixed vote map menu.
  • Fixed missing weapon status in restmenu.
  • Fixed serious bug in forwards that use floats.
  • Fixed bug where message_begin could not send MSG_PAS_R and MSG_PVS_R (Damaged Soul).
  • Fixed crash bug in get_msg_origin (Damaged Soul).
  • Fixed bugs in entity_set_byte and entity_set_edict.
  • Fixed a small bug in mapchooser mapcycle reader (Damaged Soul).
  • Fixed a bug in CSX where get_weaponname was overridden incorrectly.
  • Fixed some bugs in pev() natives in fakemeta module.
  • Fixed client_built forward in NS module.
  • Fixed last hit being ignored in StatsX (JC Denton).
  • Fixed miscstats playing sounds to connecting players.
  • Renamed cs_get_weapon_type to cs_get_weapon_id.
AMX Mod X 0.20-RC6 (September 20, 2004)
  • Added AMD64 support for Cstrike module.
  • Added TraceResult and TraceLine manipulation to fakemeta_amxx.
  • Added new API calls for module SDK.
  • Added new debug trace system to JIT and C core.
  • Added universal error handling API to Core (modules not yet implemented).
  • Removed extraneous packages from DoD, TFC, and TS packages.
  • Fixed a bug in get_user_astats for CSSTATS.
  • Fixed remaining bugs in remove_task().
  • Fixed bug where reloadadmins would not reset flasg (mrhunt).
  • Fixed bug where amxxsc failed on -o <file>.
  • Fixed logging typo in core.ini.
  • Fixed wrong kills and deaths in CSSTATS.
  • Fixed string formatting in mapsmenu, admincmd.
  • Fixed restmenu run time error.
  • Fixed adminslots not calculating slots immediately.
  • Fixed crash bug in amx_modules.
  • Fixed parsing bug in string trim routine.
  • Fixed bug where language files were not closed.
  • Compiler is now set to debug level 2 and compaction is disabled.
AMX Mod X 0.20-RC5 (September 12, 2004)
  • Fixed a bug related to the JIT headers that was causing stats modules to crash.
  • Removed MMGR from default builds.
  • Removed MMGR from default SDK options.
  • Added optimizations to format() routines.
  • Added amx_debug to control plugin run levels.
  • Added ability for plugins to tell Core which modules are needed (requested by mahnsawce).
  • Added new SDK module functions MNF_GetPlayerEdict, MNF_GetPlayerFlags.
  • Added better support for Natural-Selection 3 Beta 5 (mahnsawce, CheesyPeteza, et al).
  • Fixed a bug where %c would not be recognized.
  • Fixed a bug where SQL connections were not disconnected on mapchange (UgLyPuNk).
  • Fixed a bug where MySQL connections could not have a specified port (Mugwump).
  • Fixed a bug where float computations were incorrect on AMD64 (UgLyPuNk).
  • Fixed a bug where entity validation routines in Engine/Fakemeta were incorrect (JJKiller).
  • Fixed a bug where the fakemeta engine could bootstrap a module twice.
  • Fixed a crash bug relating to forward re-registration (fsfod).
  • Fixed a compile bugs in some modules that prevented AMD64 compatibility (UgLyPuNk).
  • Fixed a memory leak related to Engine not unregistering forwards (mahnsawce).
  • Fixed bugs in find_ent* natives which choked on 0 indices (Pimp Daddy).
  • Fixed CVector assertions (fsfod).
  • Fixed get_keyvalue not being a valid native in Engine (Vortox).
  • Fixed include files so formatting Sql or Res variables won't give a tag mismatch (Pimp Daddy).
  • Fixed many include files.
  • Fixed "amx_client_languages" cvar.
  • The command "amxx plugins" will now report plugin load errors that occurred (requested by mahnsawce).
  • The command "amxx version" will now report whether your Core build is normal, ASM, or JIT.
  • Admin_sql now reverts to users.ini on failure (requested by QwertyAccess).
  • SQL configuration CVARs are now enabled by default (Gonzo).
  • Changed is_jit_enabled(): now reports 1 for JIT, 0 for safe, -1 for ASM.
  • Added module load simulator to default linux packages.
  • Module names listed in modules.ini can now be loaded independently of their extension (for example _i386 will search for _amd64 on AMD64, et cetera) (requested by UgLyPuNk).
AMX Mod X 0.20-TP4 (September 2, 2004)
  • Changed amxx_mm.* to amxmodx_mm.*
  • Changed "amxx" to "amxmodx" for addons folder.
  • Switched from 2.6.0 compiler to 2.5.1 (2.6.0 is much too buggy).
  • Enabled the JIT on Linux (sorry - Makefile bug showed we hadn't been doing this).
  • Rewrote task system to use Forward API.
  • Added CVAR to multilingual plugin to disable client side options - "amx_client_languages".
  • Fixed a bug in forward API where parameters would be garbage.
  • Fixed crash bugs in Forward API.
  • Fixed many string format crash bugs in amxmodx core.
  • Fixed other string formatting issues such as %% and % being parsed improperly. (reported by Gonzo)
  • Fixed a memory leak on loading amxx plugins.
  • Fixed a bug in the Module SDK header file where structs could be misaligned. (reported by fsfod)
  • Fixed many crash bugs in the MySQL module. (reported by Gonzo)
  • Fixed memory leaks in both Engine and MySQL.
  • Fixed bugs in Engine that caused crashes in DoD and prevented optimization.
  • Fixed message capturing in Engine so it can work with multiple plugins. (reported by fsfod)
  • Fixed plmenu and get_user_team bugs in DoD package and TFC package.
  • Fixed top15 display problems in DoD package.
  • Fixed bug where amx_say would use the ML system.
  • Fixed bug where remove_task() could cause a server crash on shutdown. (reported by Pimp_Daddy)
  • Fixed bug where client_command was not a blockable forward.
  • Fixed bug where radians were not converted properly. (malex)
  • Fixed buffer overflow security holes in string formatting routine (legacy code from AMX Mod)
  • Removed pvPrivateData functions from Engine and placed into Fakemeta_amxx.
  • Added NewDLL HLAPI functions to FakeMeta. (reported by mahnsawce)
  • Greatly improved error reporting for both MySQL and Engine.
AMX Mod X 0.20-TP3 (August 24, 2004)
  • Changed .amxx plugin format - changed compression from LZO to GZ
    -Note on the above - old .amxx files will not work, recompile with the new compiler.
    -The compression will be 30-80% better, but that's not the reason for the switch (which was licensing issues)
  • Fixed include files to be more backwards compatible
  • Fixed bad compiling options in both AMD64 and Linux compiles (stdc++ dependencies)
  • -This also fixes a crash bug in the cstrike package and load errors
  • Fixed a very ubiquitous crash bug in MySQL
  • Fixed a crash bug in Core when resolving certain strings
  • Increased compiler line buffer
AMX Mod X 0.20-TP2 (August 22, 2004 - Codename "Tiger")
  • Packages
    • AMX Mod X is now packaged as mod independent. You can download mod packages which enhance
    • Strike (this
    • Zero), Day of Defeat, Natural Selection, The Specialists, and Team Fortress Classic.
    • If you would like to be the maintainer of a mod package, please contact the AMX Mod X Team. Mod
    • The custom dir has been removed. Use the configs folder. get_customdir() will use configs.
    • A "data" folder has been added for binary files. "data/lang" holds language translations.
  • Modules
    • Modules are no longer loaded through Metamod. AMXx acts as a Metamod wrapper for all HL engine
    • The above functionality is called FakeMeta. AMXx in fact treats its own engine calls as an internal Fakemeta plugin.
    • Modules have a new, more complete, Application Programming Interface (API). It is an SDK which allows developers
    • AMXx now loads modules in three formats: amxx, amx, and amx&mm. The configuration file "modules.ini"
    • Listenservers have been finicky with Steam ever since an update which broke AMX 0.9.6j+ API
    • Modules no longer use a specific struct of function pointers. A function request system makes modules,
  • Core
    • The Just In Time Compiler (JIT) is now enabled by default. It translates AMX plugins to native
    • AMX Mod X is fully 64bit compatible. Plugins now end in ".amxx" to reflect a new, 64bit compatible
    • For debuggers/developers, there is now a Memory Test build which will log all memory usage to peroidic
    • There is also a special optimization build for newer processors (not default in packages).
    • Many, many portions of the AMX Mod X core were rewritten from the ground up. This includes various
  • Multi-Lingual
    • AMX Mod X now features an API for multi-lingual development. An intuitive system lets you add language
    • Language definitions are retrieved as multi-layered formatted strings in a system that crosses between
    • The AMX Mod X Plugins have been translated into over 10 languages! Hats off to the translators.
  • MySQL Module
    • SQL support has been heavily changed. The MySQL module was completely rewritten from scratch. Known
    • There is now a universal Database Interface (DBI) which allows for more advanced scripting using
    • such as per-query results, resource handles, and better error
    • The new interface can break backwards compatibility. Old plugins may or may not work, and it's best to
    • There is now a module for PostgreSQL support and Microsoft SQL Server support (Windows only).
  • Engine Module
    • The Engine module was completely rewritten from scratch for a more organized code base.
    • Many natives were merged in from NS2AMX when it was split to form n2_amxx.
    • Engine has been optimized to no longer strain servers like it's original VexD base.
  • CSStats Module
    • Known CSStats issues have been fixed in AMXx's rewrite of CSStatus "CSStats2".
  • NS_amxx Module
    • Mahnsawce has continued his excellent Natural Selection work to port his NS module to AMX Mod X.
  • DoD Modules
    • AMX Mod X comes with DoDX for Day of Defeat Statistics and DoDFun for Day of Defeat scripting.
  • TFCx Module
    • AMX Mod X comes with a Team Fortress Classic statistical package.
  • GeoIP Module
    • The GeoIP module has been ported to AMX Mod X, written from scratch and updated.
  • Array Module
    • A module for advanced array manipulation is now included.
  • Sockets Module
    • A module for network socket manipulation is now included (kenterfie).
  • Fakemeta Module
    • Almost all metamod functionality has been captured into a module for use in Small.
    • Fakemeta module can call, hook, supercede, or block almost every Half-Life engine and DLL function.
    • It also has simplified natives for accessing player private data and edict properties.
    • Fakemeta features the same optimizations as Engine. It won't lag from being idle.
  • Plugins
    • The Admin and Admin_mysql plugins have been merged into one plugin, with a preprocessor directive
    • The Stats plugin has been replaced with XAD's StatsX.
    • Admin_mysql is now admin_sql.
    • All base plugins that detect Counter-Strike will now work on Condition-Zero automatically.
    • Per-map configuration files can be stored as .cfg files on configs/maps, which will be auto-executed on
    • up (admin base).
    • Anti-Flood now more intelligently flood protects (internal increment and decrement counters).
    • The new multi-lingual plugin allows clients to set their own languages for real-time translation.
    • Plugins are now compressed into a new plugin format called ABL - the new extension to reflect this is
    • Normal .amx plugins will not work on the AMD64 version of AMX Mod X - you need to use .amxx
    • A new compiler - amxxsc.exe - is being used. It's a hybrid Small/AMXx compiler.
    • A new batch compiler has been made - compiler.exe for windows.
    • You can now write plugins in AMX Assembly (sasm.exe).
  • Configuration
    • mysql.cfg is now sql.cfg
    • amx_mysql_ CVARs are now named amx_sql_ instead.
    • Slot reservation is no longer default
    • Counter-Strike specific modules, plugins, and settings are no longer default.
    • modules.ini and plugins.ini are now a tad more descriptive.
    • amx_client_languages allows you to select whether clients can use the multilingual system.
  • The list of new natives was removed because it was too long.
  • Core
    • No longer crashes on bad modules
    • Fixed license (GPL now reports properly).
    • Better Condition-Zero support.
    • read_data(0) returns the msgid in events.
    • Removed amx_version cvar.
    • New internal function forwarding system.
    • New Module API fixes old idiosyncracies.
    • Removed many warnings in gcc.
    • New floating point module from ITB Compuphase.
    • Rewrote many portions of the core from scratch.
    • Upgraded to latest abstract machine and added AMD64 compatibility.
  • Cstrike
    • Fixed rare crash bug in all natives (being used before players are initialized).
  • Engine
    • Rewritten from scratch.
    • Fixed memory leaks
    • Fixed message natives.
    • Imported many natives from NS2AMXx.
    • Fixed crash bugs.
  • Fun
    • Now uses the correct, original set_user_hitzones functionality.
  • MySQL
    • Rewritten from scratch, contains a new codebase and operation style.
    • Fixed crash bugs.
  • Plugins
    • Fixed typos in various includes.
    • Added second parameter to amx_help.
    • Changed amx_mode to 1 by default.
    • Fixed access level bugs.
    • Added multi-lingual settings.
  • Core
    • Fixed a possible crash bug where Cmd_Args would return NULL.
    • Fixed type "Dettach" to "Detach".
    • Fixed crash bug on invalid plugin path.
    • Added memory allocation failure checks.
    • Fixed file handles staying open on error.
    • Fixed get_module.
    • Added amxmodx_modules cvar.
    • get_user_weapons sets the third parameter to 0 before counting.
    • cs_set_user_team now updates models/scoreboards right away.
    • cs_set_user_vip changes to the VIP model/updates scoreboard right away.
    • Fixed cs_set_hostage_foll
    • Fixed engclient_cmd.
    • Added md5() functionality.
    • Added some string manipulation.
    • Fixed memory leaks.
  • Fun
    • Added TFC support for give_item.
  • Plugins
    • Fixed a small bug in make_deathmsg.
    • Fixed localinfo for users.ini
    • Fixed if NO_STEAM is defined for adminslots.sma
    • March 15, 2004
    • We are using the old SC 2.1 small compiler.
    • March 08, 2004
    • game stats theme
    • Selection
    • Strike 1.6 maps to maps.ini
    • Strike module and added functions:
AMX Mod X 0.16 (March 26, 2004 - Codename "Rockzilla")
  • amx.cfg is now amxx.cfg, in configs dir
  • New folder - custom, for custom configs from 3rd party plugins
  • Fixed conditional event bug in core.
  • Fixed engine get/set_offset_float
  • Fixed engine to have get/set_speak
  • Added jghg2 into engine (with jghg2.inc)
  • Fixed give_item for all mods
  • Fixed amx_plugins command
  • Fixed access levels being random
  • Fixed include files
  • Fixed cstrike having long native lengths
  • Fixed maxspeeds
  • Fixed call_think in engine
  • Added cstrike natives cs_get_weapon_ammo, cs_set_weapon_ammo
  • Cstrike now animates with cs_set_weapon_silen
  • localinfos are back (addons/amxx/core.ini too)
  • Plugins now use localinfo with get_basedir and get_configsdir
  • amx_version / amxmodx_version cvar fixed
  • get_modulesnum native fixed
  • reading from files with weird line breaks should work now
  • NOTE! Plugin writers should store their files in get_configsdir()
AMX Mod X 0.15 (March 15, 2004 - Codename "Bugzilla")
  • Fixed event related bugs such as incorrect timing and crashes.
  • Removed all std:: code and lstdc++ requirement.
  • Moved messaging functions back into core from ENGINE
  • Many documentation fixes
  • Added xtrafun support backwards support.
  • TEMPORARY - We are using the old SC 2.1 small compiler.
  • Removed .amx from logging plugin names.
  • Hardcoded directory names into core.
  • get_module also returns status.
  • Fixed logging crashes.
  • Removed get_user_wonid.
  • cs_set_user_vip and cs_get_user_vip fixed.
  • cs_set_user_deaths now updates scoreboard.
  • Fixed ENGINE memory leaks.
  • Fixed register_message argument functions.
  • Fixed controller and blending values.
  • Reduced set_view lag.
  • It is now possible to shoot and break func_breakables.
  • Removed fun cvars and engine cvars and amx_version cvar.
  • Removed FUN debug messages.
  • Added set_user_hitzones and get_user_hitzones.
  • Removed set_hitzones.
AMX Mod X 0.10 (March 08, 2004 - Codename "Xerocks")
  • Imported the initial AMX Mod code base.
  • updated to new Small Abstract Machine and Small Compiler
  • added welcome message for Steam (replaces the default motd)
  • kicking/banning reason is displayed on target player
  • changed amx_ban, amx_banid and amx_banip command
  • mysql table is automatic created
  • mapchange obeys mp_chattime
  • updated in-game stats theme
  • fixed say @... and say_team @... under Natural-Selection
  • only admins can view amx_who
  • added Counter-Strike 1.6 maps to maps.ini
  • added native functions:
    • log_amx( ... )
    • is_module_loaded( ... )
    • get_module( ... )
    • get_modulesnum( ... )
    • is_plugin_loaded( ... )
    • callfunc_begin( ... )
    • callfunc_push_...( ... )
    • callfunc_end( ... )
  • added commands:
    • amx_reloadadmins
    • amx_plugins
    • amx_modules
  • moved some native functions to new Counter-Strike module and added functions:
    • cs_get_hostage_follow( ... )
    • cs_set_hostage_follow( ... )
    • cs_get_hostage_id( ... )
    • cs_get_user_backpackammo( ... )
    • cs_set_user_backpackammo( ... )
    • cs_get_user_defusekit( ... )
    • cs_set_user_defusekit( ... )
    • cs_get_user_inside_buyzone( ... )
    • cs_get_user_model( ... )
    • cs_set_user_model( ... )
    • cs_reset_user_model( ... )
    • cs_get_user_nvgoggles( ... )
    • cs_set_user_nvgoggles( ... )
    • cs_get_user_plant( ... )
    • cs_set_user_plant( ... )
    • cs_set_user_team( ... )
    • cs_get_user_vip( ... )
    • cs_set_user_vip( ... )
    • cs_get_weapon_burstmode( ... )
    • cs_set_weapon_burstmode( ... )
    • cs_get_weapon_silenced( ... )
    • cs_set_weapon_silenced( ... )
  • moved some native functions to new Engine module and added functions:
    • register_message( ... )
    • get_msg_...( ... )
    • set_msg_...( ... )
    • get_offset_...( ... )
    • set_offset...( ... )
    • precache_generic( ... )
    • entity_get_...( ... )
    • entity_set_...( ... )
    • create_entity( ... )
    • find_entity_...( ... )
    • call_think( ... )
    • is_valid_ent( ... )
    • entity_set_origin( ... )
    • entity_set_model( ... )
    • remove_entity( ... )
    • entity_count( ... )
    • fake_touch( ... )
    • DispatchKeyValue( ... )
    • DispatchSpawn( ... )
    • RadiusDamage( ... )
    • VelocityByAim( ... )
    • PointContents( ... )
    • trace_line( ... )
    • trace_normal( ... )
    • vector_to_angle( ... )
    • vector_length( ... )
    • vector_distance( ... )
    • get_grenade_id( ... )
    • halflife_time( ... )
    • set_lights( ... )
    • set_msg_block( ... )
    • get_msg_block( ... )
    • attach_view( ... )
    • set_view( ... )
    • pfn_touch( ... )
    • server_frame( ... )
    • client_kill( ... )
    • client_PreThink( ... )
    • client_PostThink( ... )
AMX Mod 0.9.7
  • added support for listenservers, all you need is
    "loopback" "" "abcdefghijkmnopqrstu" "de" entry in users.ini file
  • added read_datanum() native function
  • added CS_DeathMsg event which fixes last damage issue
  • added amx_csay command; you can now specify if you want to show
    names with hud messages (to set in plugin sources)
  • added forward client_authorized() called when a client get valid steam id
  • added formating to MOTD window for top15, statsme and rank
  • made adminslots, admin, admin_mysql using client_authorized()
  • removed support for amx_real_res_slots (for HLSW)
  • rebuilded adminslots, fixed hide slots issue; now there is only one
    cvar - amx_reservation (see plugin comments for more details)
  • modules used by AMX don't have to be put in the
  • made that stats in rank are not saved if get_score returns cellmin
  • made read_data() to return values in a requested format
    (should help in debugging since all values can be returned as string)
  • made that on a module error a server exits with a proper message
  • improved commands handling, now high number of commands/AMX plugins
    shouldn't affect a server overload
  • fixed force_unmodified() for files different from "wav" and "mdl"
  • fixed crashes caused by missing plugins with left entries in plugins.ini
  • fixed that register_cvar() didn't set an initial string for a cvar
  • fixed weapon restriction plugin (now can block buy commands in CS 1.6)
  • removed get_user_wonid() native function
  • for custom rank's points calculation (by default: kills - deaths) you
    must set "csstats_score" localinfo (f.e. to "addons/amx/csstats.amx")
AMX Mod 0.9.6
  • fixed entry in "amxmisc.inc" file about a command access
  • fixed admin access when an account was set for an IP
  • fixed cancel vote report in admin vote plugin
  • fixed say /hp and killer displaying in stats plugin
  • brought back old compiler and initializing local variables by default
  • improved compile plugins script for linux
  • fixed parsing names containing '<' and '>' chars with parse_loguser(...)
AMX Mod 0.9.5
  • fixed reserved slots, also not used are hidden now
  • fixed boundary checks
  • fixed pause( ... ) and unpause( ... ) which crash on unknown plugin name
  • fixed pause plugins plugin
  • added stock functions to "amxmisc.inc" and new constants to "amxconst.inc"
    • get_basedir( ... )
    • build_path( ... )
    • show_activity( ... )
    • get_logfile( ... )
  • admin command "amx_plugin" is changed to "amx_pausecfg"
  • added "amx_banid", "amx_banip" and changed "amx_ban"
  • fixed admin logging when name is changed
  • by default compiler doesn't initialize local variables to zero
    (option can be turned on with -z flag)
  • general rewrite/tweak for all default plugins
  • server commands "amx cmds" and "amx cvars" give now more detailed info
  • admin must now have all flags of command to gain an access to it
  • added amx_logdir localinfo which specifies logging directory for
    log_to_file(...) (default plugins has been updated to obey that setting)
  • added "amx_basedir" localinfo by which plugins know a path
    to configuration files (resolves problem with running the same AMX on
    different ports with different settings, accounts and plugins)
  • modified admin, admin_mysql and slots reservation
    plugins to work also on CS 1.6 (you have to edit source first)
  • extended functionality of file_size(...) native
  • added native functions to support public variables (introduced them
    with stats and stats configuration plugins)
    • xvar_exists( ... )
    • get_xvar_id( ... )
    • get_xvar_num( ... )
    • get_xvar_float( ... )
    • set_xvar_num( ... )
    • set_xvar_float( ... )
    • isalpha(...)
    • isdigit(...)
    • isalnum(...)
    • isspace(...)
  • added Miscellaneous Stats plugin for Counter-Strike which constains
    • multikill announcement
    • bomb events
    • killing streak
    • enemy remaining
    • round counter
    • italy bonus kill
    • knife kill
    • headshot kill
    • greanade kill
    • last man
    • double kill
    • player name
  • added some stats to Stats plugin
    • most damage
    • most kills
    • team score
    • rank info
AMX Mod 0.9.4
  • fixed that stats are not shown if you survive a round
  • fixed get_user_money(...) under linux in fun module
  • fixed issue with amx_nextmap when mp_chattime was set to 0
  • plugin nextmap chooser uses now maps.ini as configuration file
  • admin_mysql.amx is now a seperate plugin (disable admin.amx)
  • name admin.cfg is changed to amx.cfg
  • admin accounts are moved to users.ini (there is no amx_admin command)
  • logd and udp modules are no more in default package
  • moved changelog.txt to readme.txt
  • replaced adminmenu.amx (amx_menu cmd) with several menus (amxmodmenu cmd)
  • changed nextmap plugin to obey mapcycle (you can still use the old style)
  • in register_menuid(...) you can specify if a menu from outside plugin
    can be grabed by a menu command (fixes serveral problems with voting)
  • added weaponstats2, latency and time logging to stats logging plugin
  • added amx_cancelvote command (removes all tasks with 99889988 id)
  • added "say @ ..." commands to adminchat plugin (CM like)
  • changed amx_ppause command to main amx_plugin (with several options)
  • added two new flags for set_task(...)
  • added cvar csstats_maxsize (by default set to 3500) which
    resets stats when number of entries is reached
  • combined console and menu version of restrict weapons plugin
  • fixed bug in fun module with give_item(...) (thx EJ)
  • added amx_statscfg and amx_statscfgmenu (affects menu front end)
    commands to stats configuration plugin
  • moved amx_dpause and amx_addoption to the main commands amx_plugin and
    amx_statscfg (plugins which use one of these commands have to be edited)
  • added native functions:
    • format_time(...)
    • parse_time(...)
    • get_systime(...)
    • task_exists(...)
    • power(...)
    • sqroot(...)
    • time(...)
    • date(...)
    • tickcount(...)
    • vaultdata_exists(...)
    • get_vaultdata(...)
    • set_vaultdata(...)
    • remove_vaultdata(...)
AMX Mod 0.9.3
  • fixed imessage plugin which spamed the server with
    hudmessages when amx_freq_imessage was set to 0
  • fixed pausing first plugin when "amx pause" was called from server console
  • fixed format-string bug in log_message native function which could
    be used to gain a remote shell for people who have access to rcon
  • added get last bullet hit to get_user_origin(...) (added by Mike Cao)
  • added format_args(...) native which formats arguments
    of function to one string
  • cvar csstats_rank sets mode of ranking: 0 by nick, 1 by authid and 2 by ip
  • improved Pause Plugins plugin (added amx_ppause and amx_pausemenu cmds.)
  • added Stats Settings plugin for better server managment
    (use amx_statscfg command from that plugin to enable proper stats)
  • made amx_psay command to be HLSW tool compatible
  • added native functions:
    • is_user_hltv( ... )
    • is_linux_server()
    • is_dedicated_server()
    • read_dir( ... )
    • read_logdata( ... )
    • read_logargc()
    • read_logargv( ... )
    • parse_loguser( ... )
    • register_logevent( ... )
  • added forward function plugin_log() called on log message
  • you can now specify connecting port in mysql module (added by BigDog)
  • fixed stats plugin which could not display all players in top15 list
  • made admin base plugin to check user access on name change
  • added random direction of slaping in user_slap(...) native
AMX Mod 0.9.2
  • added inconsistent file checking for sounds and models to AMX
  • improved searching for target in admin commands
  • removed timeleft/nextmap flood exploit (changed order in plugins.ini)
  • fixed bug with gathering information from user at last slot
  • added cvar csstats_reset to reset stats on map change
  • fixed issue with get_user_team(...) in DOD
  • fixed option under flag "f" in get_players(...)
  • fixed option under flag "k" in find_player(...)
  • improved scrolling messaging (no overflows)
  • fixed bug when task was self-removing during execution
  • moved logs to new folder and changed theirs format (edited plugins are:
    admin, adminchat, admincmd, adminslots, adminvote, mapextend)
  • new plugin: information messages (see admin.cfg for more details)
  • fixed issue in mapextend plugin when on server were no players
  • added more cvars settings to admin.cfg from default plugins
  • fixed admin slots plugin and added new option to it
  • fixed timeleft plugin to not hang up during counting down
  • reduced frequency of notifing by fun module
  • added notifing for health, armor and frags changes
  • new native functions:
    • set_cvar_flags(const cvar[], flags)
    • get_cvar_flags(const cvar[])
    • remove_cvar_flags(const cvar[], flags = -1)
  • new natives for strings:
    • strtolower(string[]) - converts string to lower case
    • strtoupper(string[]) - converts string to upper case
  • combined AMX with MetaSmall so there is only AMX Mod
  • Strings, files and floats modules has been moved to AMX Mod code
  • plugin adminvote uses now cvar to set voting session, so other plugins
    can check if it is still in progress or when was the last vote
  • made admin commands to accept also '#userid' as target
  • amx_ban command works now also on LAN servers
  • changed cfg in menu.cfg to perform an action on player by '#userid'
  • amx_nextmap and amx_timeleft now are visible in server status
  • added amx_show_activity cvar to admincmd plugin and adminvote
  • compiled AMX with newest metamod 1.14 (so it works with CS 1.6)
  • removed execution of amx_vote results
  • added to fun module (only for Counter-Strike):
    • get_user_money(...)
    • set_user_money(...)
  • replaced mapextend plugin with more powerful mapchooser plugin
    (configuration for that plugin is in admin.cfg)
  • added to csstats module
    • get_user_wrstats(...)
  • changed name of function get_user_lstats(...) to get_user_rstats(...)
  • added some constants to amxconst.inc file
  • added amx_unban command to admincmd plugin
  • fixed issue in adminmenu when there were diff. access flags set for
    cvars and server commands
  • fixed fun module to reset rendering on client respawn
AMX Mod 0.8.4
  • moved 19 natives, like give_item(...), set_user_rendering(...)
    or set_user_godmode(...), to seperate "fun" module
  • added localinfo for metasmall which specifies metasmall.ini
    (+localinfo ms_metasmall metasmall.ini)
  • removed "Fixed" module from default package
  • changed localinfo amx_plugins and localinfo csstats to be
    specified only by filename and not by full path
  • added csstats.amx plugin by which you can rank players in top15
  • fixed issue with lenght protection on replace native in string module
  • fixed issue with get_clcmd(...) when flag was set to 0
  • you can now specify if modules for metasmall have to be loaded
    only once or initialized on every map change
  • moved operations on files to seperate module for metasmall
  • new flags for function get_players(...):
    • "f" - match with part of name.
    • "g" - ignore case sensitivity.
  • added new functions for metasmall engine:
    • build_pathname
    • get_modname
    • print_console
  • in function get_user_time(...) you may now specify playing time
  • function get_playersnum(...) can now also count connecting players
  • new native functions
    • is_user_connecting(...)
    • get_srvcmd(...)
    • console_print(,...)
    • console_cmd(...)
    • register_concmd(...)
    • get_concmd(...)
    • get_srvcmdsnum(...)
    • get_flags(...)
  • added new include file amxmisc.inc
  • made mysql module to not open new connection each time if such
    already exists but return just its id to use with sql natives
  • fixed reset stats on player connection issue in CSStats module
  • fixed get_pluginsnum() function
  • added "amx cmds" command, displaying server commands registered by plugins
  • made registered server commands case insensitive
  • many improvments and some fixes in default scripts:
    • stats : new cmds say /stats and say /statsme
    • adminvote : fixed bug with votes counting and changed keys
    • welcomemsg : added to default package
    • stats_logging : added to default package
    • adminhelp : added to default package
    • timeleft : timeleft and thetime is announced by voice
    • admincmd : added amx_who, amx_slap, amx_pause and amx_leave
    • adminchat : added server commands and improved amx_chat
    • admin : added amx_default_access
    • adminslots : rebuilded plugin
    • ppause : pause and unpause plugins on the fly
    • general clean up
AMX Mod 0.7.3
  • made menus to be mod independent
  • added "amx cvars" command, displaying CVars registered by plugins
  • fixed bug in string module with native add(...)
  • changed way of dealing with no MetaSmall (plugins are just unloaded
    from MetaMod with some info) in AMXMod and CSStats modules
  • fixed crash on calling get_clcmd for command with empty description
  • added localinfo amx_plugins where you can specify filename with
    plugins list to load on HLDS command line
    f.e. +localinfo amx_plugins addons/amx/plugins/plugins.ini
  • added localinfo csstats to specify stats data file:
    +localinfo csstats addons/metasmall/csstats.dat
  • fixed server crash when using plugin_end
  • fixed native remove_task (sometimes not removing tasks properly)
  • moved CS stats to a MetaMod plugin & MetaSmall module
    (has to be defined in addons/metamod/plugins.ini AND in
    addons/metasmall/modules.ini, like AMX)
  • plugins adminchat, admincmd and adminvote can accept WONIDs
  • fixed a syntax error in menu.cfg
AMX Mod 0.7
  • added MetaSmall 0.1 engine and modules :
    • string
    • fixed
    • float
    • mysql
  • changed AMX to be both a MetaMod plugin and MetaSmall module
  • changes and fixes in plugins :
    • adminslots : now kicks properly
    • adminvote : added amx_vote_delay cvar (min. time between votes)
    • mapextend : fixed divide by zero
    • admincmd : fixed amx_ban command
    • some other fixes :-)
  • added natives :
    • get_user_godmode(index)
    • set_user_noclip(index)
    • get_user_noclip(index)
    • get_user_wonid(index)
    • mysql_connect(host[],user[],pass[],dbname[],error[],maxlength)
  • new flag in function find_player(...):
    • "l" - ignores case sensitivity
  • fixed natives headers in amxmod.inc :
    • get_stats(index,stats[8],bodyhits[8],name[],len)
    • get_statsnum()
AMX Mod 0.6.1
  • fixed linux cvar & float issues that broke many things in 0.6
  • removed avlist plugin
  • added menu.cfg file for adminmenu plugin
  • fixed admin_sql plugin when mysql query couldn't be performed
AMX Mod 0.6
  • added forward plugin_end(), which is called just before
  • added formatting in functions like format(dest[],len,text[],...)
  • added native log_to_file(file[])
  • added native get_user_deaths(index)
  • added stats natives :
    • get_user_wstats(index,wpnindex,stats[8],bodyhits[8])
    • get_user_stats(index,stats[8],bodyhits[8])
    • get_user_vstats(index,vic,stats[8],body[8],wpnname[]="",len=0)
    • get_user_astats(index,wpn,stats[8],body[8],wpnname[]="",len=0)
    • reset_user_wnstats(index)
    • get_stats(index,stats[8],bodyhits[8])
    • get_statsnum(index,stats[8],bodyhits[8])
  • added mysql support :
    • native sql_query(query[])
    • native sql_newquery(sql,query[])
    • native sql_nextrow(sql)
    • native sql_getfield(sql,fieldnum,dest[],maxlength)
    • native sql_free(sql)
  • native get_user_team(index, team[]="", len=0) now
  • native get_user_attacker(index,...) also returns hit body part
  • changed parameters list in native set_task(...)
  • changed parameters list in native read_file(...)
  • copied values will always be trunked to given length
  • last parameter in native get_user_ip(index,ip,[],len,p=0) sets
  • if there is less arg to set from parse the error is not raised
AMX Mod 0.5
  • added native get_user_weapon(index,&clip,&ammo)
  • added native get_user_ammo(index,weapon,&clip,&ammo)
  • added native get_weaponname(weapon_id,weapon[],iLen)
  • added native get_user_listening(iReceiver,iSender)
  • added native set_user_listening(iReceiver,iSender,bListen)
  • added native get_clcmdsnum( flags = 0)
  • added native get_clcmd(index, flag, cmd[], iLen1, info[], iLen2)
  • added native replace(text[],iLen,what[],with[])
  • added native get_maxplayers()
  • added native get_pluginsnum()
  • added native get_plugin(index,filename[], iLen1, name[],iLen2,
    version[],iLen3,author[],iLen4,status[],iLen5)
  • changed native get_user_weapons(index,iwpns[32],&inum)
  • changed native get_user_attacker(index,&weapon)
  • changed native get_user_origin(index,origin[3],mode=0)
  • changed ADMIN flags in amxconst.inc
  • replaced user_glow with set_user_rendering (more options to set)
  • now when bots join to server, natives client_connect and
    client_putinserver are called
  • native show_motd can now display files (send filename as body parameter)
  • fixed bug in checking length of parameter in read_data
  • fixed bug in parse native where arguments weren't 0 terminated
  • added many administrating/managment scripts
AMX Mod 0.4
  • added native engclient_print(id,type,message[], ...)
  • added native parse(text[], ... )
  • added native random_float(Float:a,Float:b)
  • added native random_num(a,b)
  • added native remove_quotes(text[])
  • added native file_exists(text[])
  • added native delete_file(text[])
  • added native read_file(file[],line,text[],iLen)
  • added native write_file(file[],text[],line=-1)
  • added native get_user_attacker(index)
  • added native Float:get_user_aiming(index,&id,&body,dist=9999)
  • added native cvar_exists(cvarname[])
  • added native register_plugin(title[],version[],author[])
  • added server command: amx < command > [ parameter ]
  • changed parameters for native function user_glow(...)
  • changed parameters for native function register_cvar(...)
  • changed flags for find_player(...)
  • changed flags for get_players(...)
  • fixed set_cvar_string/float natives
  • removed native check_user_flags(...)
  • more examples of plugins: admin, mirror damage, last man


Appendix: Credits

C. Credits
Sections:
  • The Team
  • Supporting Cast
  • Donors
AMX Mod X Team Developers and their Accomplishments
  • Felix "SniperBeamer" Geyer
    • Project Manager and Founder
    • Plugin Maintenance
    • Language Translations and Foreign Relations
    • Web, IRC, and Forum Administrator
  • David "BAILOPAN" Anderson
    • System Administrator
    • Development/Maintenance of Core and Modules
    • Packaging/Releases
    • Publicist/Documentation
    • API for DBI, Plugin Debugging, GeoIP, RegEx
  • Pavol "PM OnoTo" Marko
    • Core Developer
    • AMX/Small Technician
    • "0.20" Module API
    • FakeMeta Engine
    • Multi-Lingual API
    • "0.20" Forward Execution System
  • Jonny "Got His Gun" Bergström
    • Fun Module
    • Counter-Strike Module
    • Valiantly finding many new CS offsets
    • Beta-testing all the mistakes we made :)
    • Counter-Strike Plugins Maintenance
  • Lukasz "SidLuke" Wlasinski
    • Statistical Plugins Maintenance
    • Statistical and Add-On Packages for
      • Day of Defeat
      • Counter-Strike
      • The Specialists
      • Team Fortress Classic
  • Christian "Basic-Master" Hammacher
    • AMXx Edit, the AMX Mod Editor
    • The Wonderful new AMX Mod X Installer
Other Supporters, Contributers, and Cool People
  • XAD
    • StatsX (based on stats by OLO).
    • Much insight into the future of AMX Mod X - FakeMeta.
  • Steve "mahnsawce" Duddenhoeffer
    • Official Natural-Selection Module
    • FakeMeta Module, revolutionary to HL Scripting
    • WTF Module, for adding new weapons
    • Putting up with BAILOPAN :)
  • Mike "Freecode" Vvedenskiy
    • Long-time supporter and forum theme designer
  • Andreas "AssKicR" Caspers
    • Long-time supporter and popular plugin developer
  • fsfod, Ugly Punk, Damaged Soul, Gonzo, jtp10181, Pimp Daddy, qizmo, fysh
    • Beta testing and code patches that greatly helped track down bugs.
  • Brian "Devicenull" Rak, Isaac "twistedeuphoria" Edwards
    • Our trust-worthy forum moderators and plugin list maintainers.
  • Peter "CheesyPeteza" Holcroft
    • Natural-Selection package maintainer.
  • Borja "faluco" Ferrer
    • Diligently fixing bugs and translating things for the Multi-Lingual system.
  • -=HaXoMaTiC=-
    • The wonderful NSIS installer script.
  • DecemberX
    • Web-Site design and layout
  • Thiadmer Riemersma from ITB CompuPhase
    • For fixing our bug reports and general help, and of course, for his AMX/Small, and now Pawn maintenance.
  • Beta Testers
    • QwertyAccess, Zor, pendragon, KilledWithStyle, SirTiger
  • OLO
    • If it weren't for this strange guy, we wouldn't have had an AMX Mod to begin with.
  • And lastly, a thanks to all who used and contributed to AMX Mod X. Without the supportive and active community, AMX Mod X would not have been possible. Thank you!
Donors who contributed money to AMX Mod X
  • =X=
  • AssKicR
  • azure
  • BigBaller
  • Burnzy
  • DopeFish
  • Dubie
  • Kamikaze
  • KiN | SuicideDog
  • Krin
  • pimp daddy
  • Ryan
  • StreetProphet
  • Striker
  • WeeWeeSlap
  • willyumyum
  • [KORT] IRON
  • {NM}JRBLOODMIST


Appendix: License

D. License
GNU GENERAL PUBLIC LICENSE

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA  02111-1307, USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.

b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS


Function Reference

IV. Function Reference
Modules:
  • Core
  • Cstrike
  • DoDFun
  • DoDX
  • Engine
  • ESF
  • Fakemeta
  • Fun
  • GeoIP
  • NS
  • nVault
  • Regex
  • Sockets
  • SQL
  • TFCX
  • TSFUN
  • TSX


Core
Content:
  • Notes
  • Functions
  • User Contributed Notes
Notes
The AMX Mod X core contains the native and "essential" scripting functions. Functions are rarely added to the core unless they fit into a specific category. The AMXx Core is maintained by PM OnoTo.

The core is broken up into multiple sections. By including "amxmodx.inc", you automatically include the subsections.
  • amxmodx.inc (AMX Mod X Core Functions)
  • core.inc (Machine Core)
  • file.inc (File input/output.)
  • float.inc (Floating point operations and advanced math.)
  • string.inc (String manipulation.)
  • vault.inc (Vault (key/value pair table operation).)
  • amxconst.inc (AMX Mod X Constants)
  • amxmisc.inc (Often used script functions.)

There are a number of constants in the Core, listed here:
  • "Variable" Constants
  • Admin Level Constants
  • Return Constants
  • Message Constants

  • CVAR Constants
  • Sound Constants
  • HI Weapon Constants
  • Menu Key Constants

  • Print Type Constants
  • Unmodified Constants
  • Module Constants
  • AMX Flag Constants

"Variable" Constants:
AMXX_VERSION		//AMXx Version
AMXX_VERSION_STRN	//AMXx Version as string

Admin Level Constants:
ADMIN_ALL		0	//Everyone
ADMIN_IMMUNITY		1	//Flag "a", immunity
ADMIN_RESERVATION	2	//Flag "b", reservation
ADMIN_KICK		4	//Flag "c", kick
ADMIN_BAN		8	//Flag "d", ban
ADMIN_SLAY		16	//Flag "e", slay
ADMIN_MAP		32	//Flag "f", map change
ADMIN_CVAR		64	//Flag "g", cvar change
ADMIN_CFG		128	//Flag "h", config execution
ADMIN_CHAT		256	//Flag "i", chat
ADMIN_VOTE		512	//Flag "j", vote
ADMIN_PASSWORD		1024	//Flag "k", sv_password
ADMIN_RCON		2048	//Flag "l", rcon access
ADMIN_LEVEL_A		4096	//Flag "m", custom
ADMIN_LEVEL_B		8192	//Flag "n", custom
ADMIN_LEVEL_C		16384	//Flag "o", custom
ADMIN_LEVEL_D		32768	//Flag "p", custom
ADMIN_LEVEL_E		65536	//Flag "q", custom
ADMIN_LEVEL_F		131072	//Flag "r", custom
ADMIN_LEVEL_G		262144	//Flag "s", custom
ADMIN_LEVEL_H		524288	//Flag "t", custom
ADMIN_MENU		1048576	//Flag "u", menus
ADMIN_ADMIN		16777216	//Flag "y", default admin
ADMIN_USER		33554432	//Flag "z", default user

FLAG_KICK		1	//Auth flag "a", kick if no auth
FLAG_TAG		2	//Auth flag "b", auth by tag
FLAG_AUTHID		4	//Auth flag "c", auth by WON/Steam ID
FLAG_IP			8	//Auth flag "d", auth by IP address
FLAG_NOPASS		16	//Auth flag "e", don't require password

Return Codes:
//Plugin passes through operation.  Whatever called it continues.
PLUGIN_CONTINUE		0
//Plugin halts continued operation (plugins following in the plugins.ini won't be called).
//Whatever called it will eventually supercede.
PLUGIN_HANDLED		1
//Continue calling plugins but halt the operation
PLUGIN_HANDLED_MAIN	2

Message Constants:
MSG_BROADCAST		0	//Unreliable message to everyone
MSG_ONE			1	//Reliable message to one client
MSG_ALL			2	//Reliable message to everyone
MSG_INIT		3	//Write to the init string
MSG_PVS			4	//Ents in PVS of origin
MSG_PAS			5	//Ents in PAS of origin
MSG_PVS_R		6	//Reliable to PVS
MSG_PAS_R		7	//Reliable to PAS
MSG_ONE_UNRELIABLE	8	//Unreliable to one client
MSG_SPEC		9	//Send to spectator proxies

SVC_TEMPENTITY		23
SVC_INTERMISSION	30
SVC_CDTRACK		32
SVC_WEAPONANIM		35
SVC_ROOMTYPE		37
SVC_ADDANGLE		38
SVC_NEWUSERMSG		39
SVC_HLTV		50

CVAR Constants:
FCVAR_ARCHIVE		1	//Gets saved to vars.rc
FCVAR_USERINFO		2	//Changes client's info string
FCVAR_SERVER		4	//Notifies players when changed
FCVAR_EXTDLL		8	//Defined by external DLL
FCVAR_CLIENTDLL		16	//Defined by client DLL
FCVAR_PROTECTED		32	//Contains a password/private info
FCVAR_SPONLY		64	//Cannot be changed by clients in multiplayer
FCVAR_PRINTABLEONLY	128	//Cannot contain unprintable characters
FCVAR_UNLOGGED		256	//Don't log changes if FCVAR_SERVER

Sound Constants:
//Sound Channels
CHAN_AUTO		0
CHAN_WEAPON		1
CHAN_VOICE		2
CHAN_ITEM		3
CHAN_BODY		4
CHAN_STREAM		5	//Stream channel from static or dynamic area
CHAN_STATIC		6	//Channel from the static area
CHAN_NETWORKVOICE_BASE	7	//Voice data coming across the network
CHAN_NETWORKVOICE_END	500	//Network voice data reserves slots

//Attenuation values
ATTN_NONE		0.00
ATTN_NORM		0.80
ATTN_IDLE		2.00
ATTN_STATIC		1.25

//Pitch values
PITCH_NORM		100
PITCH_LOW		95
PITCH_HIGH		120

//Volume values
VOL_NORM		1.0

HI Weapon Constants:
#define HIW_BERETTA		1
#define HIW_SPAS12		2
#define HIW_M4A1		3
#define HIW_MP5A4		4
#define HIW_MP5SD5		5
#define HIW_AK47		6
#define HIW_AKS74U		7
#define HIW_GLOCK		8
#define HIW_M11			9
#define HIW_M11SD		10
#define HIW_PSG1		11
#define HIW_ZASTAVA		12
#define HIW_M16A2		13
#define HIW_REMINGTON		14
#define HIW_NATOGREN		15
#define HIW_TANGOGREN		16
#define HIW_FLASHBANG		17

Menu Key Defines:
/* Menu keys */
#define MENU_KEY_1		(1<<0)
#define MENU_KEY_2		(1<<1)
#define MENU_KEY_3		(1<<2)
#define MENU_KEY_4		(1<<3)
#define MENU_KEY_5		(1<<4)
#define MENU_KEY_6		(1<<5)
#define MENU_KEY_7		(1<<6)
#define MENU_KEY_8		(1<<7)
#define MENU_KEY_9		(1<<8)
#define MENU_KEY_0		(1<<9)

Print Types:
/* Destination types for client_print() */
enum {
    print_notify = 1,
    print_console,
    print_chat,
    print_center,
}

/* Destination types for engclient_print() */
enum {
    engprint_console = 0,
    engprint_center,
    engprint_chat,
}

Unmodified Constants:
/* Type for force_unmodified() */
enum {
    force_exactfile = 0,		/* File on client must exactly match server's file */
    force_model_samebounds,		/* For model files only, the geometry must fit in the same bbox */
    force_model_specifybounds,	/* For model files only, the geometry must fit in the specified bbox */
}

Module Constants:
/* Status for get_module() */
enum {
    module_none = 0,
    module_query,
    module_badload,
    module_loaded,
    module_noinfo,
    module_noquery,
    module_noattach,
    module_old,
};

AMX Flag Constants:
#define AMX_FLAG_DEBUG    0x02  /* symbolic info. available */
#define AMX_FLAG_COMPACT  0x04  /* compact encoding */
#define AMX_FLAG_BYTEOPC  0x08  /* opcode is a byte (not a cell) */
#define AMX_FLAG_NOCHECKS 0x10  /* no array bounds checking; no STMT opcode */
#define AMX_FLAG_NTVREG 0x1000  /* all native functions are registered */
#define AMX_FLAG_JITC   0x2000  /* abstract machine is JIT compiled */
#define AMX_FLAG_BROWSE 0x4000  /* busy browsing */
#define AMX_FLAG_RELOC  0x8000  /* jump/call addresses relocated */
#define INVALID_PLUGIN_ID	-1

//These are for the new menu system
//Specifies which "magic/special" item was selected
#define MENU_EXIT	-3
#define	MENU_BACK	-2
#define MENU_MORE	-1
//Returns the state of an item in an item display callback
#define	ITEM_IGNORE	0
#define	ITEM_ENABLED	1
#define ITEM_DISABLED	2
Functions
access - Checks if the player has a specific admin flag.
add - Adds one string to another.
AddMenuItem - Add a menu item to Menus Front-End plugin.
callfunc_begin - Call a function in this / an another plugin by name.
callfunc_begin_i - Call a function in this / an another plugin by id.
callfunc_end - Make the actual call. Return value of the function called.
callfunc_push_float - Pushes a floating point number to a function call.
callfunc_push_floatrf - Pushes a floating point number to a function call by reference.
callfunc_push_int - Pushes a normal number to a function call.
callfunc_push_intrf - Pushes a variable by reference onto a function call.
callfunc_push_str - Pushes a string to a function call.
change_task - Changes the time of a task.
clamp - Returns value if it is in the range min-max, min if value is lower than min, max if higher than max.
client_authorized - Called when a player has authenticated with Steam
client_cmd - Executes command on a player
client_command - Called when a client sends a command.
client_connect - Called when a client connects
client_disconnect - Called when a player disconnects
client_infochanged - Called when a user's client info struct is changed
client_print - Sends a message to a player.
client_putinserver - Called when a player is initialized into the game.
close_dir - Closes a directory handle.
cmd_access - Checks if a user has access for that command.
cmd_target - Locates a player id by specific parameters.
colored_menus - Checks if the current mod supports colored menus.
console_cmd - Sends a command to a player's console
console_print - Sends a message to a player's console
contain - Returns position of string found inside of source, or -1 on failure.
containi - Returns position of string found inside of source, or -1 on failure. Case insensitive.
copy - Copies one string to another for a maximum for len characters.
copyc - Copies one string to another for a maximum for len characters, UNTIL ch is found.
cstrike_running - Checks if a Counter-Strike version is the current mod.
cvar_exists - If a cvar exists returns 1, in other case 0
date - Retrieves the date.
delete_file - Deletes a file. Returns 0 on failure, 1 on success.
dir_exists - Checks if a directory exists
emit_sound - Emits sound. Sample must be precached.
engclient_cmd - This is an emulation of a client command (commands aren't send to client!).
engclient_print - Sends a message to a player through the engine.
equal - Checks if two strings are equal.
equali - Checks if two strings are equal, case insensitively.
fclose - Closes a file handle.
feof - Returns if a file handle is at the end of the file or not.
fflush - Flushes a file by file handle.
fgetc - Reads a char (1 byte) from a file handle.
fgetf - Reads a float (4 bytes, 8 on AMD64) from a file handle.
fgeti - Reads an integer (4 bytes) from a file handle.
fgetl - Reads a long (4 bytes) from a file handle.
fgets - Reads a short (2 bytes) from a file handle.
file_exists - Checks if a file exists (returns 1 on success, 0 on failure).
file_size - Returns the size of a file.
find_player - Find player
find_plugin_byfile - Finds a plugin by filename
float - Returns the floating point value of the given number.
floatabs - Returns the absolute value as a float.
floatacos - Arccosine
floatadd - Returns two floats added together, as a float.
floatasin - Arcsine
floatatan - Arctangent
floatatan2 -
floatcmp - Compares two floats.
floatcos - Returns the cosine of a value.
floatdiv - Returns a quotient as a float.
floatfract - Returns the fractional portion of a float.
floatlog - Returns the logarithm of a value. Base defaults to 10.0.
floatmul - Returns two floats multiplied, as a float.
floatpower - Returns the value raised to the power of the exponent, as a float.
floatround - Rounds a float into an integer value.
floatsin - Returns the sin of a value.
floatsqroot - Returns the square root of the value as a float.
floatstr - Converts a string into a floating point value.
floatsub - Subtract two floats as a float.
floattan - Returns the tangent of a value as a float.
float_to_str - Converts float to string
fopen - Returns a file handle for advanced file functions.
force_unmodified - Forces the client and server to be running with the same version of the specified file ( e.g., a player model )
format - Format a string with a given format and parameters.
format_args - Gets parameters from a function as a formatted string.
format_time - Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S"
fputc - Writes a char (1 byte) to a file handle.
fputf - Writes a float (4 bytes, 8 on AMD64) to a file handle.
fputi - Writes an integer (4 bytes) to a file handle.
fputl - Writes a long (4 bytes) to a file handle.
fputs - Writes a short (2 bytes) to a file handle.
fread - Reads from a file handle.
fseek - Seeks a position in a file.
ftell - Returns the current file position pointer by file handle
funcidx - Returns the index of a named public function.
fwrite - Writes to a file handle.
getarg - Retrieve an argument from an argument list
get_array - Retrieves an array from a calling plugin.
get_array_f - Retrieves a float array from a calling plugin.
get_basedir - Outputs the AMXx basedir.
get_clcmd - Gets info about client command.
get_clcmdsnum - Returns number of registered client commands.
get_concmd - Gets info about console command.
get_concmdsnum - Returns number of registered console commands
get_configsdir - Outputs the AMXx configsdir.
get_cvar_flags - Returns a cvar flags.
get_cvar_float - Gets a cvar float
get_cvar_num - Gets a cvar integer value
get_cvar_string - Reads a cvar value
get_datadir - Outputs the AMXx datadir.
get_distance - Returns distance between two vectors.
get_distance_f - Finds the distance between two vectors
get_flags - Converts a sum of bits into a string.
get_float_byref - Returns a by-reference float from a calling plugin.
get_func_id - Returns the id of {funcName} in {plugin}
get_gametime - Returns a game time
get_localinfo - Gets an info value (
get_mapname - Returns a name of currently played map
get_maxplayers - Returns maxplayers setting
get_modname - Outputs the name of the currently played mod.
get_module - Gets info about a module.
get_modulesnum - Returns number of currently registered modules
get_param - Returns a parameter from a calling function.
get_param_byref - Returns a by-reference parameter from a calling plugin.
get_param_f - Returns a float parameter from a calling plugin.
get_players - Returns a list of player indices.
get_playersnum - Returns the number of players put in server.
get_plugin - Gets info about plugin by given index. Function returns -1 if plugin doesn't exist with given index
get_pluginsnum - Returns number of all loaded plugins.
get_srvcmd - Gets info about server command.
get_srvcmdsnum - Returns number of registered server commands
get_string - Retrieves a string from a calling plugin
get_systime - Returns system time in seconds elapsed since 00:00:00 on January 1, 1970.
get_time - Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S".
get_timeleft - Returns time remaining on map in seconds
get_user_aiming - Traces where a player is aiming for a maximum distance defaulted to 9999.
get_user_ammo - Stores the clip and backpack ammo amounts from a player's weapon (by index).
get_user_armor - Returns a player's armor.
get_user_attacker - Returns the index of an attacking player.
get_user_authid - Finds the authentication id of a player.
get_user_deaths - Returns a player's death count.
get_user_flags - Gets flags from player. Set index to 0 if you want to read flags from server.
get_user_frags - Returns a player's frag count
get_user_health - Gets a user's health
get_user_index - Returns a player's index (lookup by name).
get_user_info - Gets an info string from a player
get_user_ip - Returns a player's IP.
get_user_menu - Gets what menu the player is watching and what keys for menu he have.
get_user_msgid - Returns id of client message
get_user_name - Finds the name of a player.
get_user_origin - Gets a player's origin.
get_user_ping - Returns the ping and loss at the current time
get_user_team - Returns the id of a team.
get_user_time - Returns a player's playing time in seconds.
get_user_userid - Returns a player's userid.
get_user_weapon - Returns id of a player's currently carried weapon.
get_user_weapons - Returns a list of all the carried weapons of a player.
get_vaultdata - Reads a key from the vault.
get_weaponname - Stores the name of a weapon (by index) for a maximum length of len characters.
get_xvar_float - Returns a float value of a public variable. Id is a value
get_xvar_id - Returns an unique id for public variable specified by name.
get_xvar_num - Returns an integer value of a public variable
heapspace - Returns the free space on the heap.
inconsistent_file - Called on inconsistent file. You can put any text into reason to change an original message
isalnum - Returns true when value is a letter or digit.
isalpha - Returns true when value is a letter.
isdigit - Returns true when value is digit.
isspace - Returns true when value is a space character.
is_dedicated_server - Returns 1 if the server is dedicated, 0 otherwise.
is_linux_server - Returns 1 if the server is running Linux/FreeBSD, 0 if windows.
is_map_valid - Returns 1 if a map is valid, 0 otherwise.
is_module_loaded - Checks whether a module is loaded.
is_plugin_loaded - Checks whether a plugin is loaded.
is_running - Checks if the given mod is running.
is_user_admin - Checks if a user is admin.
is_user_alive - Returns 1 if a player is alive, 0 if dead.
is_user_bot - Returns 1 if a user is a bot, 0 otherwise.
is_user_connected - Returns 1 if a player is connected, 0 otherwise.
is_user_connecting - Returns 1 if a player has not yet connected, 0 otherwise.
is_user_hltv - Returns 1 if a player is an HLTV, 0 otherwise.
jit_enabled - Returns 1 if JIT is enabled, otherwise it returns 0.
log_amx - Logs something to the current AMXx logfile.
log_error - Logs an error from a dynamic native.
log_message - Logs something to the current HL log file.
log_to_file - Logs something to a specified file.
max - Returns the higher value of val1 and val2.
md5 - Calculates the md5 keysum of a string.
md5_file - Calculates the md5 keysum of a file.
menu_additem - Adds an item to a menu. When displayed, the name will be shown.
menu_create - Creates a menu.
menu_display - Displays a menu to a player.
menu_find_id - Given a page on a menu and a keypress on that page, returns the item id selected.
menu_items - Returns how many items are in a menu.
menu_item_getinfo - Gets/sets info about a menu option.
menu_item_setcall - Set the call back on an item in a menu.
menu_item_setcmd - Set a command for a given menu and item.
menu_item_setname -
menu_makecallback - Creates a menu item callback handler.
menu_pages - Returns how many pages are in a menu.
message_begin - These functinos are used to generate client messages.
message_end - Used to end a message
min - Returns the lower value of val1 and val2.
next_file - Reads the next file in a directory handle.
numargs - Returns the number of arguments passed to the current function.
num_to_str - Converts a number to a string.
num_to_word - Converts numbers from 0-999 into English words.
open_dir - Opens a directory for reading.
param_convert - Converts a parameter's address space
parse - Splits parameters into strings.
parse_loguser - Parses log data about a user.
parse_time - Returns time in input and additionaly fills missing information
pause - Pauses function or plugin so it won't be executed.
plugin_cfg - Called after plugin_init has been called
plugin_end - Called at a plugin's end
plugin_flags - Returns plugin flags
plugin_init - Forward for plugin initialization
plugin_log - Called on a log message
plugin_modules - Module check routine - DEPRECATED
plugin_natives - Called when register_native can be used.
plugin_pause - Called when the plugin is paused.
plugin_precache - Actually first called forward
plugin_unpause - Called when the plugin is unpaused.
power - Raises a value to a power.
precache_model - Precaches a model file
precache_sound - Precaches a sound file
query_client_cvar - Dispatches a client cvar query
random - Returns a pseudo-random number in the range of 0 to max-1.
random_float - Generates random floating point number from a to b
random_num - Generates random integer from a to b.
read_argc - Returns the number of parameters/arguments in a command.
read_args - Returns the entire parameter line of a command.
read_argv - Reads an argument from a command.
read_data - Gets arguments/values from client messages.
read_datanum - Returns the number of values in a client message.
read_dir - Reads content from a directory.
read_file - Reads a line from a file.
read_flags - Converts a string into a sum of bits.
read_logargc -
read_logargv - Gets a log argument.
read_logdata - Gets a log message.
register_clcmd - Registers function which will be called from client console
register_concmd - Registers function which will be called from any console
register_cvar - Registers new cvar for HL engine.
register_dictionary - Registers a dictionary file
register_event - Registers an event on which a given function will be called
register_library - Registers your plugin as a library.
register_logevent - Registers a function to be called on a log event
register_menu - Registers a menu.
register_menucmd - Calls function when player uses specified menu and proper keys.
register_menuid - Gets unique id of menu.
register_native - Declares a native that other plugins can use.
register_plugin - Sets a plugin's info
register_srvcmd - Registers function which will be called from server console.
remove_cvar_flags - const cvar[],flags = -1
remove_quotes - Removes quotes from sentence.
remove_task - Removes all tasks with given id.
remove_user_flags - Removes flags for player
remove_vaultdata - Removes a key from the vault.
replace - Replaces a contained string
require_module - Sets a requirement for a module - DEPRECATED
rewind - Resets a file's internal position (by file handle).
server_cmd - Executes command on a server console
server_exec - Forces server to execute sent server command at current time. Very useful for map changes, setting cvars and other activities.
server_print - Prints a message to the server console.
setarg - Set the value of an argument from an argument list.
setc - Sets a string with a given character.
set_array - Copies a local array into the one given by a calling plugin.
set_array_f - Copies a float array into the one given by a calling plugin.
set_cvar_flags - Sets a cvar flags (not allowed for amx_version, fun_version and sv_cheats cvars)
set_cvar_float - Sets a cvar to given float.
set_cvar_num - Sets a cvar with integer value
set_cvar_string - Sets a cvar to given value
set_error_filter - Allows you to trap error messages that occur in your plugin.
set_float_byref - Sets a float into the byreference parameter in a calling plugin.
set_hudmessage - Sets the format for a HUD message
set_localinfo - Sets info ("localinfo") on the server
set_param_byref - Sets a byreference value into the parameter given by a calling plugin.
set_string - Sets a string in a calling plugin
set_task - Calls function on specified time.
set_user_deaths - Sets a player's death count.
set_user_flags - Sets flags for player.
set_user_frags - Set's a player's frag count.
set_user_info - Sets an info value on a player
set_vaultdata - Sets a value for a key in the vault.
set_xvar_float - Sets a float value of a public variable
set_xvar_num - Sets a value of a public variable.
show_activity - Shows admin activity.
show_hudmessage - Displays a HUD message to a player
show_menu - Shows a list of menu options to a client.
show_motd - Displays an MOTD style window to a user.
sqroot - Approximates the integer square root of value.
strbreak - Gets parameters from text one at a time.
strcat - Concatenates a string.
strcmp - Compares two strings, C-style. Returns 0 on equal.
strfind - Finds a string in another string. Returns -1 if not found.
strlen - Returns the length of a zero terminated string.
strpack - Copy a string from source to dest, in packed format.
strtolower - Converts all characters in string to lower case.
strtoupper - Converts all characters in string to upper case.
strunpack - Copy a string from source to dest in unpacked format.
str_to_float - Converts a string to a float
str_to_num - Returns a string converted to a number
swapchars - Returns the value of c where all the bytes in the cell are swapped (low bye becomes high).
task_exists - Returns 1 if task under given id exists.
tickcount - Unknown
time - Retrives the time.
tolower - Returns the lower case character code of c, or if not available, returns c.
toupper - Returns the upper case character code of c, or if not available, returns c.
trim - Strips spaces from the beginning and end of a string.
ucfirst - Make a string's first character uppercase
unlink - Deletes a file.
unpause - Unpauses function or plugin.
user_has_weapon - Returns if a player has the weapon or not.
user_kill - Kills a player.
user_slap - Slaps a player for variable damage (power).
vaultdata_exists - Checks if a key exists in the vault.
write_angle - Writes an angle entry to a message.
write_byte - Writes a single byte to a message.
write_char - Writes a single character to a message.
write_coord - Writes a coordinate entry to a message.
write_entity - Writes an entity index to a message.
write_file - Writes a line to a file.
write_long - Writes a single number to a message (long).
write_short - Writes a single number to a message (short).
write_string - Writes a string to a message.
xvar_exists - Checks if public variable with given name exists in loaded plugins.
User Contributed Notes
bailopan at amxmodx dot org Jun-02-04 23:41:14
The old include for AMX Mod 0.9.x is "amxmod.inc". If you include this instead, you will also include amxmodx.inc and forward compatible stocks add AMXx compatibility to any AMX plugin.


access
Core (amxmisc.inc)
Description
access - Checks if the player has a specific admin flag.
Syntax
access ( id, level )
Type
Stock
Notes
id is the player index.
level is the admin flag (like ADMIN_KICK).


add
Core (string.inc)
Description
add - Adds one string to another.
Syntax
add ( dest[], len, const src[], [ max ] )
Type
Native
Notes
Returns the number of characters merged. If max is supplied, it specifies how many chars to add.


AddMenuItem
Core (amxmisc.inc)
Description
AddMenuItem - Add a menu item to Menus Front-End plugin.
Syntax
AddMenuItem ( const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS[], const MENU_PLUGIN[] )
Type
Stock
Notes
MENU_TEXT: Text that will be shown for this item in menu
MENU_CMD: Command that should be executed to start menu
MENU_ACCESS: Access required for menu
MENU_PLUGIN: The exact case-insensitive name of plugin holding the menu command


callfunc_begin
Core (amxmodx.inc)
Description
callfunc_begin - Call a function in this / an another plugin by name.
Syntax
callfunc_begin ( const function[], [ const plugin[] ] )
Type
Native
Notes
This function works by pushing parameters onto a stack and then executing the target - like the message functions.

Parameters:
plugin - plugin name; if "", the caller plugin is used.
If specified, it has to be the exact name (for example stats.amxx)
func - function name
Return value:
1 - Success
0 - Runtime error (=never)
-1 - Plugin not found
-2 - Function not found

This function uses the following functions: callfunc_end, callfunc_push_float, callfunc_push_floatrf, callfunc_push_int, callfunc_push_intrf, callfunc_push_str

This function must be ended with callfunc_end before being used again, and the function must be public.

If plugin is not specified, the current plugin is used.

User Contributed Notes
pavolmarko at pobox dot sk Sep-12-04 21:18:32
Some notes: 1) Don't forget to make the funcs that should be called public 2) In previous versions of the inc files, the function and plugin parameters were swapped, it's right the way it is here.


callfunc_begin_i
Core (amxmodx.inc)
Description
callfunc_begin_i - Call a function in this / an another plugin by id.
Syntax
callfunc_begin_i ( func, [ plugin ] )
Type
Native
Notes
plugin - plugin id; the id you would pass to get_plugin
If lower than 0, the caller plugin is taken
func - function id

Return value:
1 - Success
-1 - Plugin not found
-2 - Function not executable

Use get_func_id (amxmodx.inc) to get the func id and is_plugin_loaded (amxmodx.inc) or find_plugin_bydesc (amxmisc.inc) / find_plugin_byname (amxmisc.inc) to get plugin id.


callfunc_end
Core (amxmodx.inc)
Description
callfunc_end - Make the actual call. Return value of the function called.
Syntax
callfunc_end ( )
Type
Native
Notes
Check callfunc_begin for more information


callfunc_push_float
Core (amxmodx.inc)
Description
callfunc_push_float - Pushes a floating point number to a function call.
Syntax
callfunc_push_float ( Float: value )
Type
Native
Notes
Check callfunc_begin for more information


callfunc_push_floatrf
Core (amxmodx.inc)
Description
callfunc_push_floatrf - Pushes a floating point number to a function call by reference.
Syntax
callfunc_push_floatrf ( Float: value )
Type
Native
Notes
Check callfunc_begin for more information


callfunc_push_int
Core (amxmodx.inc)
Description
callfunc_push_int - Pushes a normal number to a function call.
Syntax
callfunc_push_int ( value )
Type
Native
Notes

Check callfunc_begin for more information


callfunc_push_intrf
Core (amxmodx.inc)
Description
callfunc_push_intrf - Pushes a variable by reference onto a function call.
Syntax
callfunc_push_intrf ( &value )
Type
Native
Notes
Check callfunc_begin for more information


callfunc_push_str
Core (amxmodx.inc)
Description
callfunc_push_str - Pushes a string to a function call.
Syntax
callfunc_push_str ( value[] )
Type
Native
Notes
Check callfunc_begin for more information


change_task
Core (amxmodx.inc)
Description
change_task - Changes the time of a task.
Syntax
change_task ( id = 0, Float:newTime=1.0, outside = 0 )
Type
Native


clamp
Core (core.inc)
Description
clamp - Returns value if it is in the range min-max, min if value is lower than min, max if higher than max.
Syntax
clamp ( value, min=cellmin, max=cellmax )
Type
Native


client_authorized
Core (amxmodx.inc)
Description
client_authorized - Called when a player has authenticated with Steam
Syntax
client_authorized ( id )
Type
Forward
Notes
Until a player has authenticated on Steam, their authid from get_user_authid will be STEAM_ID_PENDING.

id is a player index from 1 to 32.


client_cmd
Core (amxmodx.inc)
Description
client_cmd - Executes command on a player
Syntax
client_cmd ( index, const command[], {Float,...} )
Type
Native
Notes
Index is a player index from 1 to 32. A zero index executes a command on all players.

The command is formatted in the style of format.


client_command
Core (amxmodx.inc)
Description
client_command - Called when a client sends a command.
Syntax
client_command ( id )
Type
Forward
Notes
Called on ClientCommand().

id is a player index from 1 to 32.

You can retrieve the command and its parameters with read_argv, read_args, and read_argc.


client_connect
Core (amxmodx.inc)
Description
client_connect - Called when a client connects
Syntax
client_connect ( id )
Type
Native
Notes
Called on ClientConnect().

id is a player index from 1 to 32.


client_disconnect
Core (amxmodx.inc)
Description
client_disconnect - Called when a player disconnects
Syntax
client_disconnect ( id )
Type
Forward
Notes
Called on ClientDisconnect().

id is a player index from 1 to 32.


client_infochanged
Core (amxmodx.inc)
Description
client_infochanged - Called when a user's client info struct is changed
Syntax
client_infochanged ( id )
Type
Forward
Notes
This function is commenly used to catch when a player changes his nick.

public client_infochanged(id)

    new newname[32],oldname[32]
    get_user_info(id, "name", newname,31)
    get_user_name(id,oldname,31)
    client_print(0,3,"%s has changed his name to %s",oldname,newname)
    }

id,is a player index from 1 to 32.


client_print
Core (amxmodx.inc)
Description
client_print - Sends a message to a player.
Syntax
client_print ( index, type, const message[], ... )
Type
Native
Notes
id is a player index from 1 to 32. If 0, the message will be sent to all players.

The type is one of three types:
print_chat - chat text
print_console - console message
print_notify - console in dev mode
print_center - center say

message can be a formatted string in the style of format.


client_putinserver
Core (amxmodx.inc)
Description
client_putinserver - Called when a player is initialized into the game.
Syntax
client_putinserver ( id )
Type
Forward
Notes
id is a player index from 1 to 32.

The pvPrivateData structure is not initialized until this ClientPutInServer() forward is called, so many "hack" commands like cs_get_user_money or anything that modified private offsets will crash or do nothing before this point.

You should never toy with private client variables before a player or entity is put in game.


close_dir
Core (file.inc)
Description
close_dir - Closes a directory handle.
Syntax
close_dir ( dirh )
Type
Native
Notes
Make sure to call this on a valid handle passed by open_dir.


cmd_access
Core (amxmisc.inc)
Description
cmd_access - Checks if a user has access for that command.
Syntax
cmd_access ( id, level, cid, num )
Type
Stock
Notes
You usually use it like this:
  if (!cmd_access(id,level,cid,1))
    return PLUGIN_HANDLED

The last parameter (num) is the number of arguments.
Note that the first parameter is the command name so if you expect one param set it to 2.

This will automatically print out messages such as "You have no access to that command" and "Usage: <soandso".


cmd_target
Core (amxmisc.inc)
Description
cmd_target - Locates a player id by specific parameters.
Syntax
cmd_target ( id, const arg[], flags = 1 )
Type
Stock
Notes
id is the player who called the command.
arg is the argument the player input.

Flags:
1 - obey immunity
2 - allow yourself
4 - must be alive
8 - can't be bot


colored_menus
Core (amxmisc.inc)
Description
colored_menus - Checks if the current mod supports colored menus.
Syntax
colored_menus ( )
Type
Stock


console_cmd
Core (amxmodx.inc)
Description
console_cmd - Sends a command to a player's console
Syntax
console_cmd ( id, const cmd[], ... )
Type
Native
Notes
id is a player index from 1 to 32. 0 will send to all players.

cmd can be a formatted string in the style of format.


console_print
Core (amxmodx.inc)
Description
console_print - Sends a message to a player's console
Syntax
console_print ( id, const message[], ... )
Type
Native
Notes
id is a player index from 1 to 32. 0 will send to all consoles.

message can be a formatted string in the style of format.


contain
Core (string.inc)
Description
contain - Returns position of string found inside of source, or -1 on failure.
Syntax
contain ( const source[], const string[] )
Type
Native


containi
Core (string.inc)
Description
containi - Returns position of string found inside of source, or -1 on failure. Case insensitive.
Syntax
containi ( const source[], const string[] )
Type
Native


copy
Core (string.inc)
Description
copy - Copies one string to another for a maximum for len characters.
Syntax
copy ( dest[], len, const src[] )
Type
Native
Notes
Returns the number of copied chars.


copyc
Core (string.inc)
Description
copyc - Copies one string to another for a maximum for len characters, UNTIL ch is found.
Syntax
copyc ( dest[], len, const src[], ch )
Type
Native


cstrike_running
Core (amxmisc.inc)
Description
cstrike_running - Checks if a Counter-Strike version is the current mod.
Syntax
cstrike_running ( )
Type
Stock


cvar_exists
Core (amxmodx.inc)
Description
cvar_exists - If a cvar exists returns 1, in other case 0
Syntax
cvar_exists ( const cvar[] )
Type
Native
User Contributed Notes
sniperbeamer at amxmodx dot org Jun-27-04 02:47:43
When you register a cvar you don't have to use cvar_exists. The native register_cvar checks that already.


date
Core (core.inc)
Description
date - Retrieves the date.
Syntax
date ( [ &year, &month, &day ] )
Type
Native
Notes
The parameters, passed by reference, will have the corresponding parts of the date stored inside.


delete_file
Core (file.inc)
Description
delete_file - Deletes a file. Returns 0 on failure, 1 on success.
Syntax
delete_file ( const file[] )
Type
Native


dir_exists
Core (file.inc)
Description
dir_exists - Checks if a directory exists
Syntax
dir_exists ( const dir[] )
Type
Native
Notes
Returns 1 if the directory exists, 0 otherwise.


emit_sound
Core (amxmodx.inc)
Description
emit_sound - Emits sound. Sample must be precached.
Syntax
emit_sound ( index, channel, sample[], Float:vol, Float:att,flags, pitch )
Type
Native
Notes
index,is a player index from 1 to 32.
User Contributed Notes
blkjackel at yahoo dot com Dec-16-04 13:00:23
This apparently does not suppoer .mp3 format


engclient_cmd
Core (amxmodx.inc)
Description
engclient_cmd - This is an emulation of a client command (commands aren't send to client!).
Syntax
engclient_cmd ( index,const command[],arg1[]= )
Type
Native
Notes
It allows to execute some commands on players and bots. Function is excellent for forcing to do an action related to a game (not settings!). The command must stand alone but in arguments you can use spaces.

index is a player index from 1 to 32.
User Contributed Notes
pavolmarko at pobox dot sk Sep-12-04 21:21:08
This actually tells the server (the gamedll) that the client has issued a command. This is the reason why it won't work on stuff like "bind a xD". For normal players, only use it for game-specific server-handled commands (=also won't work with +attack because that is handled clientside).


engclient_print
Core (amxmodx.inc)
Description
engclient_print - Sends a message to a player through the engine.
Syntax
engclient_print ( index, type, const message[], ... )
Type
Native
Notes
index is a player index from 1 to 32. If 0, the message will be sent to all players.

The type is one of three types:
engprint_chat - chat text
engprint_console - console message
engprint_center - center say

message can be a formatted string in the style of format.


equal
Core (string.inc)
Description
equal - Checks if two strings are equal.
Syntax
equal ( const a[], const b[], [ c ] )
Type
Native
Notes
If c is specified, c characters are compared only.


equali
Core (string.inc)
Description
equali - Checks if two strings are equal, case insensitively.
Syntax
equali ( const a[], const b[], [ c ] )
Type
Native
Notes
If c is specified, c characters are compared only.


fclose
Core (file.inc)
Description
fclose - Closes a file handle.
Syntax
fclose ( file )
Type
Native


feof
Core (file.inc)
Description
feof - Returns if a file handle is at the end of the file or not.
Syntax
feof ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fflush
Core (file.inc)
Description
fflush - Flushes a file by file handle.
Syntax
fflush ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fgetc
Core (file.inc)
Description
fgetc - Reads a char (1 byte) from a file handle.
Syntax
fgetc ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fgetf
Core (file.inc)
Description
fgetf - Reads a float (4 bytes, 8 on AMD64) from a file handle.
Syntax
Float: fgetf ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fgeti
Core (file.inc)
Description
fgeti - Reads an integer (4 bytes) from a file handle.
Syntax
fgeti ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fgetl
Core (file.inc)
Description
fgetl - Reads a long (4 bytes) from a file handle.
Syntax
fgetl ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fgets
Core (file.inc)
Description
fgets - Reads a short (2 bytes) from a file handle.
Syntax
fgets ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


file_exists
Core (file.inc)
Description
file_exists - Checks if a file exists (returns 1 on success, 0 on failure).
Syntax
file_exists ( const file[] )
Type
Native


file_size
Core (file.inc)
Description
file_size - Returns the size of a file.
Syntax
file_size ( const file[], [ flag ] )
Type
Native
Notes
If flag is 0, size is returned in bytes.
If flag is 1, the number of lines is returned.
If flag is 2, 1 is returned if the file ends in a line feed.
If the file doesn't exist, -1 is returned.


find_player
Core (amxmodx.inc)
Description
find_player - Find player
Syntax
find_player ( const flags[], ... )
Type
Native
Notes
Find player.
Flags:
"a" - with given name.
"b" - with given part of name.
"c" - with given authid.
"d" - with given ip.
"e" - with given team name.
"f" - don't look in dead players.
"g" - don't look in alive players.
"h" - skip bots.
"i" - skip real players.
"j" - return index of last found player.
"k" - with given userid.
"l" - ignore case sensitivity.


find_plugin_byfile
Core (amxmisc.inc)
Description
find_plugin_byfile - Finds a plugin by filename
Syntax
find_plugin_byfile ( pname[], [ ignorecase = 1 ] )
Type
Native
Notes
Iterates through the plugins. When {pname} is equal to plugin filename, returns plugin id. If ignorecase is true, equali is used to compare; otherwise, equal is used.

If no plugin is found, returns INVALID_PLUGIN_ID.

This function was added in AMX Mod X 1.1.
User Contributed Notes
anonymous Aug-09-05 21:02:09
Thats because it was added for 1.50 :P

harbu88 at hotmail dot com Apr-17-05 12:22:44
This dosen't seem to exist or work in 1.01 ?


float
Core (float.inc)
Description
float - Returns the floating point value of the given number.
Syntax
Float: float ( value )
Type
Native


floatabs
Core (float.inc)
Description
floatabs - Returns the absolute value as a float.
Syntax
Float: floatabs ( Float:value )
Type
Native


floatacos
Core (float.inc)
Description
floatacos - Arccosine
Syntax
Float: floatacos ( Float:angle, radix )
Type
Native


floatadd
Core (float.inc)
Description
floatadd - Returns two floats added together, as a float.
Syntax
Float: floatadd ( Float:oper1, Float:oper2 )
Type
Native


floatasin
Core (float.inc)
Description
floatasin - Arcsine
Syntax
Float: floatasin ( Float:angle, radix )
Type
Native


floatatan
Core (float.inc)
Description
floatatan - Arctangent
Syntax
Float: floatatan ( Float:angle, radix )
Type
Native


floatatan2
Core (float.inc)
Description
floatatan2 -
Syntax
Float: floatatan2 ( Float:x, Float:y, radix )
Type
Native


floatcmp
Core (float.inc)
Description
floatcmp - Compares two floats.
Syntax
floatcmp ( Float:fOne, Float:fTwo )
Type
Native
Notes
If equal, returns 0.
If fOne > fTwo, returns 1.
If fOne < fTwo, returns -1.


floatcos
Core (float.inc)
Description
floatcos - Returns the cosine of a value.
Syntax
Float: floatcos ( Float:value, [ mode ] )
Type
Native
Notes
Angle mode can be one of three types:
radian
degrees //Default
grades


floatdiv
Core (float.inc)
Description
floatdiv - Returns a quotient as a float.
Syntax
Float: floatdiv ( Float:dividend, Float:divisor )
Type
Native
Notes


floatfract
Core (float.inc)
Description
floatfract - Returns the fractional portion of a float.
Syntax
Float: floatfract ( Float:value )
Type
Native


floatlog
Core (float.inc)
Description
floatlog - Returns the logarithm of a value. Base defaults to 10.0.
Syntax
Float: floatlog ( Float:value, [ Float:base ] )
Type
Native


floatmul
Core (float.inc)
Description
floatmul - Returns two floats multiplied, as a float.
Syntax
Float: floatmul ( Float:oper1, Float:oper2 )
Type
Native


floatpower
Core (float.inc)
Description
floatpower - Returns the value raised to the power of the exponent, as a float.
Syntax
Float: floatpower ( Float:value, Float:exponent )
Type
Native


floatround
Core (float.inc)
Description
floatround - Rounds a float into an integer value.
Syntax
floatround ( Float:value, [ method ] )
Type
Native
Notes
The methods of rounding that can be supplied are:

floatround_round //This is default
floatround_floor
floatround_ceil
floatround_tozero
User Contributed Notes
anonymous Jul-12-05 03:03:33
Methods _round : rounds to the nearest integer _floor : rounds down to the nearest integer _ceil : rounds up to the nearest integer Not sure what zero does


floatsin
Core (float.inc)
Description
floatsin - Returns the sin of a value.
Syntax
Float: floatsin ( Float:value, [ mode ] )
Type
Native
Notes
Angle mode can be one of three types:
radian
degrees //Default
grades


floatsqroot
Core (float.inc)
Description
floatsqroot - Returns the square root of the value as a float.
Syntax
Float: floatsqroot ( Float:value )
Type
Native
Notes
This is the same as:

floatpower(value, 0.5)


floatstr
Core (float.inc)
Description
floatstr - Converts a string into a floating point value.
Syntax
Float: floatstr ( const string[] )
Type
Native
Notes


floatsub
Core (float.inc)
Description
floatsub - Subtract two floats as a float.
Syntax
Float: floatsub ( Float:oper1, Float:oper2 )
Type
Native


floattan
Core (float.inc)
Description
floattan - Returns the tangent of a value as a float.
Syntax
Float: floattan ( Float:value, [ mode ] )
Type
Native
Notes
Angle mode can be one of three types:
radian
degrees //Default
grades


float_to_str
Core (string.inc)
Description
float_to_str - Converts float to string
Syntax
float_to_str ( Float:fl, string[], len )
Type
Native
Notes
The native has the same effect as calling

format(string, len, "%f", fl);

(but should have a slightly higher performance)

Example:

new str[16];
float_to_str(1337.0987654321, str, 15);

// str will be "1337.098755" (it will have a higher precision when running on amd64,
// this was tested on a 32 bit system)


fopen
Core (file.inc)
Description
fopen - Returns a file handle for advanced file functions.
Syntax
fopen ( filename[], mode[] )
Type
Native
Notes
Returns 0 on failure.

Mode uses the standard C library of mode types.
The first character can be:
"a" - append
"r" - read
"w" - write

The second character can be:
"t" - text
"b" - binary

You can also append a "+" to specify both read and write.


force_unmodified
Core (amxmodx.inc)
Description
force_unmodified - Forces the client and server to be running with the same version of the specified file ( e.g., a player model )
Syntax
force_unmodified ( force_type, mins[3] , maxs[3], const filename[] )
Type
Native
Notes
The force_type is one of three types:
force_exactfile - File on client must exactly match server's file
force_model_samebounds - For model files only, the geometry must fit in the same bbox
force_model_specifybounds - For model files only, the geometry must fit in the specified bbox


format
Core (string.inc)
Description
format - Format a string with a given format and parameters.
Syntax
format ( output[], len, const format[], ... )
Type
Native
Notes
Fills output for a maximum of length characters, with a string formatted by a list of parameters. Returns the number of copied characters.

The available formatting codes are:
%s - String
%f - Floating point number
%d - Integer

This formatting code is found in many other functions, for example, client_print:
client_print(id, print_chat, "Message[%d]: %s", id, message)

Example:
new dest[21]
format(dest, 20, "Hello %s. You are %d years old", "Tom", 17)
//Dest will contain "Hello Tom.  You are 17 years old.
User Contributed Notes
grimm at clanlad dot com Nov-16-04 17:13:37
Actually it will only fill the string with the first 20 characters.

jblaise dot cs at tele2 dot fr Aug-27-04 04:29:12
Hmm I think there is an error... "//Dest will contain "Hello Tom. You are 17 years old." I think : "//Dest will contain "Hello Tom. You are 17 years old." This is a little error but now it s perfect ;)


format_args
Core (string.inc)
Description
format_args - Gets parameters from a function as a formatted string.
Syntax
format_args ( output[], len, [ pos ] )
Type
Native
Notes
Fills output for a maximum of len characters. Pos is the argument position.


format_time
Core (amxmodx.inc)
Description
format_time - Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S"
Syntax
format_time ( output[],len, const format[],time = -1 )
Type
Native


fputc
Core (file.inc)
Description
fputc - Writes a char (1 byte) to a file handle.
Syntax
fputc ( file, num )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fputf
Core (file.inc)
Description
fputf - Writes a float (4 bytes, 8 on AMD64) to a file handle.
Syntax
fputf ( file, Float:num )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fputi
Core (file.inc)
Description
fputi - Writes an integer (4 bytes) to a file handle.
Syntax
fputi ( file, num )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fputl
Core (file.inc)
Description
fputl - Writes a long (4 bytes) to a file handle.
Syntax
fputl ( file, num )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fputs
Core (file.inc)
Description
fputs - Writes a short (2 bytes) to a file handle.
Syntax
fputs ( file, num )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


fread
Core (file.inc)
Description
fread - Reads from a file handle.
Syntax
fread ( file, ret[], len )
Type
Native
Notes
Reads into ret for a maximum length of len.


fseek
Core (file.inc)
Description
fseek - Seeks a position in a file.
Syntax
fseek ( file, pos, type )
Type
Native
Notes
Possible seek types are:
SEEK_SET
SEEK_CUR
SEEK_END

This function is deprecated as of AMX Mod X Version 1.1.


ftell
Core (file.inc)
Description
ftell - Returns the current file position pointer by file handle
Syntax
ftell ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


funcidx
Core (core.inc)
Description
funcidx - Returns the index of a named public function.
Syntax
funcidx ( const name[] )
Type
Native
Notes
If no function exists, -1 is returned.


fwrite
Core (file.inc)
Description
fwrite - Writes to a file handle.
Syntax
fwrite ( file, const str[], ... )
Type
Native
Notes
Writes a string of data to a file handle. The string can be formatted in the style of format.

This function is deprecated as of AMX Mod X Version 1.1.


getarg
Core (core.inc)
Description
getarg - Retrieve an argument from an argument list
Syntax
getarg ( arg, [ index ] )
Type
Native
Notes
If the argument is an array, specify index to get an index into the array.


get_array
Core (amxmodx.inc)
Description
get_array - Retrieves an array from a calling plugin.
Syntax
get_array ( param, dest[], size )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.

See get_string for more details.


get_array_f
Core (amxmodx.inc)
Description
get_array_f - Retrieves a float array from a calling plugin.
Syntax
get_array_f ( param, Float:dest[], size )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.

See get_string for more details.


get_basedir
Core (amxmisc.inc)
Description
get_basedir - Outputs the AMXx basedir.
Syntax
get_basedir ( name[], len )
Type
Stock


get_clcmd
Core (amxmodx.inc)
Description
get_clcmd - Gets info about client command.
Syntax
get_clcmd ( index, command[], len1, &flags, info[], len2, flag )
Type
Native


get_clcmdsnum
Core (amxmodx.inc)
Description
get_clcmdsnum - Returns number of registered client commands.
Syntax
get_clcmdsnum ( flag )
Type
Native


get_concmd
Core (amxmodx.inc)
Description
get_concmd - Gets info about console command.
Syntax
get_concmd ( index,cmd[],len1,&flags, info[],len2, flag, id = -1 )
Type
Native
Notes
If id is set to 0, then the function returns only server cmds, if positive then it returns only client cmds. In any other case it returns all console commands.


get_concmdsnum
Core (amxmodx.inc)
Description
get_concmdsnum - Returns number of registered console commands
Syntax
get_concmdsnum ( flag,id = -1 )
Type
Native


get_configsdir
Core (amxmisc.inc)
Description
get_configsdir - Outputs the AMXx configsdir.
Syntax
get_configsdir ( name[], len )
Type
Stock


get_cvar_flags
Core (amxmodx.inc)
Description
get_cvar_flags - Returns a cvar flags.
Syntax
get_cvar_flags ( const cvar[] )
Type
Native


get_cvar_float
Core (amxmodx.inc)
Description
get_cvar_float - Gets a cvar float
Syntax
Float: get_cvar_float ( const cvarname[] )
Type
Native


get_cvar_num
Core (amxmodx.inc)
Description
get_cvar_num - Gets a cvar integer value
Syntax
get_cvar_num ( const cvarname[] )
Type
Native


get_cvar_string
Core (amxmodx.inc)
Description
get_cvar_string - Reads a cvar value
Syntax
get_cvar_string ( const cvarname[],output[],iLen )
Type
Native
Notes

new hostname[64]
get_cvar_string("hostname",hostname,63)


get_datadir
Core (amxmisc.inc)
Description
get_datadir - Outputs the AMXx datadir.
Syntax
get_datadir ( name[], len )
Type
Stock


get_distance
Core (amxmodx.inc)
Description
get_distance - Returns distance between two vectors.
Syntax
get_distance ( origin1[3],origin2[3] )
Type
Native


get_distance_f
Core (amxmodx.inc)
Description
get_distance_f - Finds the distance between two vectors
Syntax
Float: get_distance_f ( Float:vec1[3], Float:vec2[3] )
Type
Native
Notes
Floating point version of get_distance.


get_flags
Core (amxmodx.inc)
Description
get_flags - Converts a sum of bits into a string.
Syntax
get_flags ( flags, output[], len )
Type
Native
Notes
This is the opposite of read_flags.

The result is stored in output for a maximum length of len characters.


get_float_byref
Core (amxmodx.inc)
Description
get_float_byref - Returns a by-reference float from a calling plugin.
Syntax
Float: get_float_byref ( param )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.


get_func_id
Core (amxmodx.inc)
Description
get_func_id - Returns the id of {funcName} in {plugin}
Syntax
get_func_id ( const funcName[], [ pluginId ] )
Type
Native
Notes
Parameters:
* funcName: function name
* pluginId: id of the plugin; if lower than 0, the caller plugin is taken (=> the function behaves exactly like funcidx (core.inc))

Return value is -1 when the function / the plugin could not be found.


get_gametime
Core (amxmodx.inc)
Description
get_gametime - Returns a game time
Syntax
Float: get_gametime ( )
Type
Native


get_localinfo
Core (amxmodx.inc)
Description
get_localinfo - Gets an info value (
Syntax
get_localinfo ( const info[], output[], len )
Type
Native
Notes
Result is stored in the output array for a maximum length of len characters.

example:

get_localinfo("amxx_basedir",name,len)

Type "localinfo" in the hlds console to see a list the information can can be retrived


get_mapname
Core (amxmodx.inc)
Description
get_mapname - Returns a name of currently played map
Syntax
get_mapname ( name[],len )
Type
Native


get_maxplayers
Core (amxmodx.inc)
Description
get_maxplayers - Returns maxplayers setting
Syntax
get_maxplayers ( )
Type
Native


get_modname
Core (amxmodx.inc)
Description
get_modname - Outputs the name of the currently played mod.
Syntax
get_modname ( name[], len )
Type
Native
Notes
The output is the short modname like "cstrike", "dod", ...


get_module
Core (amxmodx.inc)
Description
get_module - Gets info about a module.
Syntax
get_module ( id, name[], nameLen, author[], authorLen, version[], versionLen, &status )
Type
Native
Notes
Parameters:
id - the id of the module
name[] - The name of the module will be stored here
nameLen - maximal length of the name
author[] - the author will be stored here
authorLen - maximal length of the author
version[] - the version of the module will be stored here
versionLen - maximal length of the version
status - the status of the module will be stored here
Return value:
id - success
-1 - module not found

status can be:
module_none
module_query
module_badload
module_loaded
module_noinfo
module_noquery
module_noattach
module_old


get_modulesnum
Core (amxmodx.inc)
Description
get_modulesnum - Returns number of currently registered modules
Syntax
get_modulesnum ( )
Type
Native


get_param
Core (amxmodx.inc)
Description
get_param - Returns a parameter from a calling function.
Syntax
get_param ( num )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.


get_param_byref
Core (amxmodx.inc)
Description
get_param_byref - Returns a by-reference parameter from a calling plugin.
Syntax
get_param_byref ( param )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.


get_param_f
Core (amxmodx.inc)
Description
get_param_f - Returns a float parameter from a calling plugin.
Syntax
Float: get_param_f ( param )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.


get_players
Core (amxmodx.inc)
Description
get_players - Returns a list of player indices.
Syntax
get_players ( players[32], &num, const flags = )
Type
Native
Notes
If specified, you can constrain which players are returned by flags:
"a" - Don't return dead players
"b" - Don't return alive players
"c" - Skip bots
"d" - Skip real players
"e" - Match with passed team
"f" - Match with part of name
"g" - Ignore case sensitivity

Example, Get dead players:
new Players[32]
new playerCount, i, player
get_players(Players, playerCount, "b")
for (i=0; i<playerCount; i++)
   player = Players[i]


get_playersnum
Core (amxmodx.inc)
Description
get_playersnum - Returns the number of players put in server.
Syntax
get_playersnum ( [ flag ] )
Type
Native
Notes
If flag is specified as 1, players connecting are also returned.


get_plugin
Core (amxmodx.inc)
Description
get_plugin - Gets info about plugin by given index. Function returns -1 if plugin doesn't exist with given index
Syntax
get_plugin ( index,filename[],len1,name[],len2,version[],len3,author[],len4,status[],len5 )
Type
Native
User Contributed Notes
pavol at markovci dot de Oct-23-04 22:09:06
If id is negative, info about the calling plugin will be returned.


get_pluginsnum
Core (amxmodx.inc)
Description
get_pluginsnum - Returns number of all loaded plugins.
Syntax
get_pluginsnum ( )
Type
Native
Notes
Example:

new myint = get_pluginsnum()


get_srvcmd
Core (amxmodx.inc)
Description
get_srvcmd - Gets info about server command.
Syntax
get_srvcmd ( index,server_cmd[],len1,&flags, info[],len2, flag )
Type
Native


get_srvcmdsnum
Core (amxmodx.inc)
Description
get_srvcmdsnum - Returns number of registered server commands
Syntax
get_srvcmdsnum ( flag )
Type
Native


get_string
Core (amxmodx.inc)
Description
get_string - Retrieves a string from a calling plugin
Syntax
get_string ( param, string[], maxlen )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.

It will copy the argument passed by the calling plugin into your buffer, as a string.


get_systime
Core (amxmodx.inc)
Description
get_systime - Returns system time in seconds elapsed since 00:00:00 on January 1, 1970.
Syntax
get_systime ( offset = 0 )
Type
Native


get_time
Core (amxmodx.inc)
Description
get_time - Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S".
Syntax
get_time ( const format[],output[],len )
Type
Native
Notes
Example

new CurrentTime[9]
get_time("%H:%M:%S",CurrentTime,8)
client_print(0,3,"The current time is: %s",CurrentTime)


get_timeleft
Core (amxmodx.inc)
Description
get_timeleft - Returns time remaining on map in seconds
Syntax
get_timeleft ( )
Type
Native
Notes
Example:

new MyInt = get_timeleft()


get_user_aiming
Core (amxmodx.inc)
Description
get_user_aiming - Traces where a player is aiming for a maximum distance defaulted to 9999.
Syntax
Float: get_user_aiming ( index, &id, &body, [ distance ] )
Type
Native
Notes
If the player's aim doesn't hit anything, 0.0 is returned.

If the player is aiming at another player, then the id and part of the body is set into the second and third parameters (passed by reference).

Otherwise, the distance between the hit point and the player is returned.

index,is a player index from 1 to 32.


get_user_ammo
Core (amxmodx.inc)
Description
get_user_ammo - Stores the clip and backpack ammo amounts from a player's weapon (by index).
Syntax
get_user_ammo ( index, weapon, &clip, &ammo )
Type
Native
Notes
index,is a player index from 1 to 32.


get_user_armor
Core (amxmodx.inc)
Description
get_user_armor - Returns a player's armor.
Syntax
get_user_armor ( index )
Type
Native
Notes
index is a player index from 1 to 32.


get_user_attacker
Core (amxmodx.inc)
Description
get_user_attacker - Returns the index of an attacking player.
Syntax
get_user_attacker ( index, [ &weapon, &hitzone ] )
Type
Native
Notes
index is a player index from 1 to 32.

If a second or third parameter is supplied, information about the weapon and hitzone is stored in the variables (passed byref).

If no player is attacking the indexed player, get_user_attacker will return 0.


get_user_authid
Core (amxmodx.inc)
Description
get_user_authid - Finds the authentication id of a player.
Syntax
get_user_authid ( index, authid[], len )
Type
Native
Notes
index is a player index from 1 to 32.

Stores the authid for a maximum length of len characters.

On WON, this is the WONID. On Steam, it is the SteamID. WONIDs are large integers, SteamIDs look like: STEAM_0:x:yyyyyy.
The max lenght of a STEAM`id is 34 bytes.


get_user_deaths
Core (amxmodx.inc)
Description
get_user_deaths - Returns a player's death count.
Syntax
get_user_deaths ( index )
Type
Native
Notes
index is a player index from 1 to 32.


get_user_flags
Core (amxmodx.inc)
Description
get_user_flags - Gets flags from player. Set index to 0 if you want to read flags from server.
Syntax
get_user_flags ( index,id=0 )
Type
Native
Notes

index,is a player index from 1 to 32.


get_user_frags
Core (amxmodx.inc)
Description
get_user_frags - Returns a player's frag count
Syntax
get_user_frags ( id )
Type
Native
Notes
id is a player index from 1 to 32.

Example:

new Frags = get_user_frags(id)


get_user_health
Core (amxmodx.inc)
Description
get_user_health - Gets a user's health
Syntax
get_user_health ( id )
Type
Native
Notes
id is a player index between 1 and 32

User Contributed Notes
Dygear at gnyso-strike dot com Jul-04-04 14:59:02
get_user_health - Sets a user's health. Should be get_user_health - Gets a user's health.


get_user_index
Core (amxmodx.inc)
Description
get_user_index - Returns a player's index (lookup by name).
Syntax
get_user_index ( const name[] )
Type
Native
Notes
The index returned is a player index from 1 to 32.


get_user_info
Core (amxmodx.inc)
Description
get_user_info - Gets an info string from a player
Syntax
get_user_info ( index, const info[], output[], len )
Type
Native
Notes
index is a player index from 1 to 32.

The result is stored in output for a maximum length of len characters.

Example:
new name[32]
get_user_info(id, "name", name, 31)

A list that contains some of the information you can retrive:
get_user_info(index,"cl_updaterate",MyString,8)
get_user_info(index,"rate",MyString,8)
get_user_info(index,"name",MyString,8)
get_user_info(index,"model",MyString,8)
get_user_info(index,"_vgui_menus",MyString,8);
get_user_info(index,"team",MyString,8);
User Contributed Notes
djschwartz at adelphia dot net Aug-22-04 03:59:08
A good way to look at this get_user_info(who, command, variable, howmany) new name[32] - declaring variable name with a buffer of 32 id - This is the id of the client you would like to get the name of.. This could also be a number! "name" - This is basicly in short the command you would like info back on. name - Assigns the clients username to the variable name. So how do you use this:

public client_connect(id)
{
     new name[32]
     get_user_info(id, "name", name, 31)
     set_hudmessage(200, 0, 0, 0.05, 0.65, 2, 0.02, 30.0, 0.03, 0.3, 2)
     show_hudmessage(0, "%s has Entered",name)
}

When the Client connects it will send a hud message "{clan}playername has Entered"

Other uses might be to get a user's rates.  A couple commands for that would be.

new rate[32]
get_user_info(id, "rate", rate, 31)
      OR
get_user_info(id, "cl_rate", rate, 31)
      OR
get_user_info(id, "cl_cmdrate", rate, 31)

//One more example
new getfps[32]
get_user_info(id, "fps_max", getfps, 31)

If I made any typos sorry you guys BillyTheKid


get_user_ip
Core (amxmodx.inc)
Description
get_user_ip - Returns a player's IP.
Syntax
get_user_ip ( index, ip[], len, [ without_port ] )
Type
Native
Notes
index is a player index from 1 to 32.

The result is stored in ip for a maximum length of len characters.

If without_port is set to 1, the port is not included in the string (defaults to 0).


get_user_menu
Core (amxmodx.inc)
Description
get_user_menu - Gets what menu the player is watching and what keys for menu he have.
Syntax
get_user_menu ( index,&id,&keys )
Type
Native
Notes
When there is no menu the index is 0. If the id is negative then the menu is VGUI in other case the id is from register_menuid() function.


get_user_msgid
Core (amxmodx.inc)
Description
get_user_msgid - Returns id of client message
Syntax
get_user_msgid ( const name[] )
Type
Native
Notes
Example: get_user_msgid("TextMsg")


get_user_name
Core (amxmodx.inc)
Description
get_user_name - Finds the name of a player.
Syntax
get_user_name ( index, name[], len )
Type
Native
Notes
index is a player index from 1 to 32.

Stores the name for a maximum of len characters.
User Contributed Notes
weecka at stablebeast dot com Aug-28-05 19:54:11
example of using it:
new name[18]
get_user_name(id, name, 17)
client_print(id, print_chat, "Your name is: %s", name)


get_user_origin
Core (amxmodx.inc)
Description
get_user_origin - Gets a player's origin.
Syntax
get_user_origin ( index, origin[3], [ mode ] )
Type
Native
Notes
index is a player index from 1 to 32.

The origin is stored in the vector (3 member array) passed as the second parameter.
origin[0] = X coordinate
origin[1] = Y coordinate
origin[2] = Z coordinate

If mode is passed, the origin changes:
1 - Position from eyes (weapon aiming)
2 - End position from player position
3 - End position from eyes (hit point for weapon)
4 - Position from last bullet hit (only CS)

public MovePlayer(id)

    new origin[3]
    get_user_origin(id, origin, 0)  // Gets the current location the player is at
    origin[2] = origin[2] + 10    // Adds + 10 to the player's height
    set_user_origin(id, origin)   // Moves the player to the location stored in origin
}


get_user_ping
Core (amxmodx.inc)
Description
get_user_ping - Returns the ping and loss at the current time
Syntax
get_user_ping ( index, &ping, &loss )
Type
Native
Notes
index is a player index from 1 to 32.

ping and loss are filled with the results (passed byref).


get_user_team
Core (amxmodx.inc)
Description
get_user_team - Returns the id of a team.
Syntax
get_user_team ( index, [ team[], len ] )
Type
Native
Notes
index is a player index from 1 to 32.

If supplied, the team string name is stored in team for a maximum length of len characters.


get_user_time
Core (amxmodx.inc)
Description
get_user_time - Returns a player's playing time in seconds.
Syntax
get_user_time ( index, [ flag ] )
Type
Native
Notes
index is a player index from 1 to 32.

If the flag is set, the result is returned minus the connection time.
User Contributed Notes
anonymous Jul-14-05 17:50:41
what are the flags?


get_user_userid
Core (amxmodx.inc)
Description
get_user_userid - Returns a player's userid.
Syntax
get_user_userid ( index )
Type
Native
Notes
index is a player index from 1 to 32.

A userid is incremented on each connect to the server. It's not an index into an edict list, like a player index (from 1-32).

Example:

new userid = get_user_userid(index)
server_cmd("kick #%d Follow the server rules",userid)


get_user_weapon
Core (amxmodx.inc)
Description
get_user_weapon - Returns id of a player's currently carried weapon.
Syntax
get_user_weapon ( index, &clip, &ammo )
Type
Native
Notes
index is a player index from 1 to 32.

clip and ammo will contain the amount of ammo in the clip and backpack (passed byref).


get_user_weapons
Core (amxmodx.inc)
Description
get_user_weapons - Returns a list of all the carried weapons of a player.
Syntax
get_user_weapons ( index, weapons[32], &num )
Type
Native
Notes
index is a player index from 1 to 32.

The weapons array passed as the second parameter is filled with a list of weapon indices, from 0 to num-1. num will be filled with the number of weapons found (passed byref).

Example:
new Weapons[32]
new numWeapons, i, weapon
get_user_weapons(id, Weapons, numWeapons)
for (i=0; i<numWeapns; i++)

   weapon = Weapons[i]
}
User Contributed Notes
slayerized at gmail dot com Jul-15-05 12:35:48
new Weapons[32]
new numWeapons, i, weapon
get_user_weapons(id, Weapons, numWeapons)
for (i=0; i<numWeapons; i++)
{
   weapon = Weapons[i]
} Just fixing a little typo in the example.


get_vaultdata
Core (vault.inc)
Description
get_vaultdata - Reads a key from the vault.
Syntax
get_vaultdata ( const key[], [ data[] = "", len = 0 ] )
Type
Native
Notes
If length is not specified, the result is returned as a number.

If lengh is specified, the result is copied into data for len maximum characters.
User Contributed Notes
ferret at gamehavoc dot com Mar-31-05 05:00:24
The vault code does not appear to like vaultkey strings that begin with a number. Best to make sure you prefix all keys with a character string, such as your plugin name. Say a plugin named Attack Watch.. AW_ to be safe.


get_weaponname
Core (amxmodx.inc)
Description
get_weaponname - Stores the name of a weapon (by index) for a maximum length of len characters.
Syntax
get_weaponname ( id, weapon[], len )
Type
Native
Notes
index is a weapon index.


get_xvar_float
Core (amxmodx.inc)
Description
get_xvar_float - Returns a float value of a public variable. Id is a value
Syntax
Float: get_xvar_float ( id )
Type
Native
Notes
returned by get_xvar_id


get_xvar_id
Core (amxmodx.inc)
Description
get_xvar_id - Returns an unique id for public variable specified by name.
Syntax
get_xvar_id ( const name[] )
Type
Native
Notes
If the variable doesn't exist then the returned value is -1.


get_xvar_num
Core (amxmodx.inc)
Description
get_xvar_num - Returns an integer value of a public variable
Syntax
get_xvar_num ( id )
Type
Native
Notes
Id is a value returned by get_xvar_id


heapspace
Core (core.inc)
Description
heapspace - Returns the free space on the heap.
Syntax
heapspace ( )
Type
Native
Notes
This is useful for finding memory leaks.


inconsistent_file
Core (amxmodx.inc)
Description
inconsistent_file - Called on inconsistent file. You can put any text into reason to change an original message
Syntax
inconsistent_file ( id,const filename[], reason[64] )
Type
Forward


isalnum
Core (string.inc)
Description
isalnum - Returns true when value is a letter or digit.
Syntax
isalnum ( ch )
Type
Native


isalpha
Core (string.inc)
Description
isalpha - Returns true when value is a letter.
Syntax
isalpha ( ch )
Type
Native


isdigit
Core (string.inc)
Description
isdigit - Returns true when value is digit.
Syntax
isdigit ( ch )
Type
Native


isspace
Core (string.inc)
Description
isspace - Returns true when value is a space character.
Syntax
isspace ( ch )
Type
Native
Notes
Space characters are CR, LF, HT, VT, and Space (0x20).


is_dedicated_server
Core (amxmodx.inc)
Description
is_dedicated_server - Returns 1 if the server is dedicated, 0 otherwise.
Syntax
is_dedicated_server ( )
Type
Native


is_linux_server
Core (amxmodx.inc)
Description
is_linux_server - Returns 1 if the server is running Linux/FreeBSD, 0 if windows.
Syntax
is_linux_server ( )
Type
Native


is_map_valid
Core (amxmodx.inc)
Description
is_map_valid - Returns 1 if a map is valid, 0 otherwise.
Syntax
is_map_valid ( const mapname[] )
Type
Native


is_module_loaded
Core (amxmodx.inc)
Description
is_module_loaded - Checks whether a module is loaded.
Syntax
is_module_loaded ( const name[] )
Type
Native
Notes
Checks whether a module is loaded.
If it is not, the return value is -1, otherwise the return value is the module id.
The function is case insensitive.


is_plugin_loaded
Core (amxmodx.inc)
Description
is_plugin_loaded - Checks whether a plugin is loaded.
Syntax
is_plugin_loaded ( const name[] )
Type
Native
Notes
Checks whether a plugin is loaded.
If it is not, the return value is -1, otherwise the return value is the plugin id.
The function is case insensitive.
User Contributed Notes
jtp at jtpage dot net Dec-04-04 14:51:28
Just wanted to add that this function requires the plugins name as used in register_plugin. I thought it was unclear if I should use the filename or the actual "name" of the plugin. Using the filename will not work.


is_running
Core (amxmisc.inc)
Description
is_running - Checks if the given mod is running.
Syntax
is_running ( const mod[] )
Type
Stock
User Contributed Notes
sikkepitje at hotmail dot com Aug-22-04 15:10:27
for example
  if (is_running("cstrike")) {
    ..
  }


is_user_admin
Core (amxmisc.inc)
Description
is_user_admin - Checks if a user is admin.
Syntax
is_user_admin ( id )
Type
Stock
Notes
id is the player index.


is_user_alive
Core (amxmodx.inc)
Description
is_user_alive - Returns 1 if a player is alive, 0 if dead.
Syntax
is_user_alive ( index )
Type
Native
Notes
index is a player index from 1 to 32.


is_user_bot
Core (amxmodx.inc)
Description
is_user_bot - Returns 1 if a user is a bot, 0 otherwise.
Syntax
is_user_bot ( index )
Type
Native
Notes
index is a player index from 1 to 32.


is_user_connected
Core (amxmodx.inc)
Description
is_user_connected - Returns 1 if a player is connected, 0 otherwise.
Syntax
is_user_connected ( index )
Type
Native
Notes
index is a player index from 1 to 32.


is_user_connecting
Core (amxmodx.inc)
Description
is_user_connecting - Returns 1 if a player has not yet connected, 0 otherwise.
Syntax
is_user_connecting ( index )
Type
Native
Notes
index is a player index from 1 to 32.


is_user_hltv
Core (amxmodx.inc)
Description
is_user_hltv - Returns 1 if a player is an HLTV, 0 otherwise.
Syntax
is_user_hltv ( index )
Type
Native
Notes
index is a player index from 1 to 32.


jit_enabled
Core (amxmodx.inc)
Description
jit_enabled - Returns 1 if JIT is enabled, otherwise it returns 0.
Syntax
jit_enabled ( )
Type
Native
Notes


log_amx
Core (amxmodx.inc)
Description
log_amx - Logs something to the current AMXx logfile.
Syntax
log_amx ( const string[], [ ... ] )
Type
Native
Notes
string can be formatted according to format.


log_error
Core (amxmodx.inc)
Description
log_error - Logs an error from a dynamic native.
Syntax
log_error ( error, const fmt[], [ ... ] )
Type
Native
Notes
You can only use this in a function registered as a dynamic native.

It will log the error as if the plugin using your native was faulty. This function also forces a backtrace output for the parent plugin (the debugger).

A list of error codes are available in amxconst.inc.


log_message
Core (amxmodx.inc)
Description
log_message - Logs something to the current HL log file.
Syntax
log_message ( const message[], [ ... ] )
Type
Native
Notes
Message can be formatted according to format.


log_to_file
Core (amxmodx.inc)
Description
log_to_file - Logs something to a specified file.
Syntax
log_to_file ( const file[], const message[], [ ... ] )
Type
Native
Notes
Message can be formatted according to format.

Note: if no path is specified, the file is put into the amxmodx logs folder.


max
Core (core.inc)
Description
max - Returns the higher value of val1 and val2.
Syntax
max ( val1, val2 )
Type
Native


md5
Core (amxmodx.inc)
Description
md5 - Calculates the md5 keysum of a string.
Syntax
md5 ( const szString[], md5buffer[34] )
Type
Native


md5_file
Core (amxmodx.inc)
Description
md5_file - Calculates the md5 keysum of a file.
Syntax
md5_file ( const file[], md5buffer[34] )
Type
Native


menu_additem
Core (amxmodx.inc)
Description
menu_additem - Adds an item to a menu. When displayed, the name will be shown.
Syntax
menu_additem ( menu, const name[], const command[], paccess=0, callback=-1 )
Type
Native
Notes
If the player does not have the access it is disabled. If you set callback, the callback will be called before the item is printed on the screen. This lets you change it real time based on conditions.


menu_create
Core (amxmodx.inc)
Description
menu_create - Creates a menu.
Syntax
menu_create ( title[], handler[], ml=0 )
Type
Native
Notes
WILL BE AVAILABLE IN AMXx 1.5

If you set ml to 1, everything will be preformatted with the multilingual system.

NOTE: ml=1 is not currently enabled.

handler[] will be called when someone presses a key on your menu.


menu_display
Core (amxmodx.inc)
Description
menu_display - Displays a menu to a player.
Syntax
menu_display ( id, menu, page )
Type
Native
Notes
Page of the menu starts at 0. There are seven items to a page. Back/Exit/Next are automatically added as needed. You cannot use this to show a menu to everyone at once.


menu_find_id
Core (amxmodx.inc)
Description
menu_find_id - Given a page on a menu and a keypress on that page, returns the item id selected.
Syntax
menu_find_id ( menu, page, key )
Type
Native
Notes
If the item is less than 0, a special option was chosen such as MENU_EXIT.


menu_items
Core (amxmodx.inc)
Description
menu_items - Returns how many items are in a menu.
Syntax
menu_items ( menu )
Type
Native


menu_item_getinfo
Core (amxmodx.inc)
Description
menu_item_getinfo - Gets/sets info about a menu option.
Syntax
menu_item_getinfo ( menu, item, &access, command[], cmdlen, name[]="", namelen=0, &callback )
Type
Native


menu_item_setcall
Core (amxmodx.inc)
Description
menu_item_setcall - Set the call back on an item in a menu.
Syntax
menu_item_setcall ( menu, item, callback=-1 )
Type
Native


menu_item_setcmd
Core (amxmodx.inc)
Description
menu_item_setcmd - Set a command for a given menu and item.
Syntax
menu_item_setcmd ( menu, item, cmd[] )
Type
Native


menu_item_setname
Core (amxmodx.inc)
Description
menu_item_setname -
Syntax
menu_item_setname ( menu, item, name[] )
Type
Native


menu_makecallback
Core (amxmodx.inc)
Description
menu_makecallback - Creates a menu item callback handler.
Syntax
menu_makecallback ( function[] )
Type
Native
Notes
The callback handler is passed the playerid, menuid, and itemid. It can return ITEM_IGNORE, ITEM_ENABLED, or ITEM_DISABLED.


menu_pages
Core (amxmodx.inc)
Description
menu_pages - Returns how many pages are in a menu.
Syntax
menu_pages ( menu )
Type
Native


message_begin
Core (amxmodx.inc)
Description
message_begin - These functinos are used to generate client messages.
Syntax
message_begin ( dest, msg_type, origin[3]={0,0,0},player=0 )
Type
Native
Notes
You may generate menu, smoke, shockwaves, thunderlights, intermission and many many others messages. See HL SDK for more examples.

Other function related: message_end, write_byte, write_char, write_short, write_long, write_entity, write_angle, write_coord, write_string

Before calling another message_begin you must call message_end(). Sending a new message before another is complete or sending an invalid message number (such as 0) will cause the server to crash.


message_end
Core (amxmodx.inc)
Description
message_end - Used to end a message
Syntax
message_end ( )
Type
Native
Notes
Read message_end for more information


min
Core (core.inc)
Description
min - Returns the lower value of val1 and val2.
Syntax
min ( val1, val2 )
Type
Native
Notes


next_file
Core (file.inc)
Description
next_file - Reads the next file in a directory handle.
Syntax
next_file ( dirh, buffer[], length )
Type
Native
Notes
Returns 0 on failure, 1 on success.


numargs
Core (core.inc)
Description
numargs - Returns the number of arguments passed to the current function.
Syntax
numargs ( )
Type
Native


num_to_str
Core (string.inc)
Description
num_to_str - Converts a number to a string.
Syntax
num_to_str ( num, string[], len )
Type
Native
Notes
Fills string for a max length of len.

This can be written as:
format(string, len, "%d", num)


num_to_word
Core (amxmodx.inc)
Description
num_to_word - Converts numbers from 0-999 into English words.
Syntax
num_to_word ( num, output[], len )
Type
Native
Notes
Stores the result in output for a maximum of len characters.


open_dir
Core (file.inc)
Description
open_dir - Opens a directory for reading.
Syntax
open_dir ( dir[], buffer[], length )
Type
Native
Notes
Returns a handle to read the directory. Stores the first file found in the buffer.

Returns 0 on failure. If successful, you must call close_dir on the handle when done.


param_convert
Core (amxmodx.inc)
Description
param_convert - Converts a parameter's address space
Syntax
param_convert ( param )
Type
Native
Notes
This function is the same as "lib_convert" from dJeyL's "lib" module. It is only usable if you registered your native with style 1.

param_convert is necessary to use any array, string, or by-reference parameter given to your native. For example:
public mynative(str[])

   param_convert(1)
}

Arguments to natives begin at 1.


parse
Core (string.inc)
Description
parse - Splits parameters into strings.
Syntax
parse ( const text[], ... )
Type
Native
Notes
Example: to split text: "^"This is^" the best year",
parse(text,arg1,len1,arg2,len2,arg3,len3,arg4,len4)
You will get: "This is", "the", "best", "year"
Function returns number of parsed parameters.

For a more advanced version, see strbreak.


parse_loguser
Core (amxmodx.inc)
Description
parse_loguser - Parses log data about a user.
Syntax
parse_loguser ( const text[], name[], nameLen, [ &userid, authid[], authidLen, team[], teamLen ] )
Type
Native
Notes
Example:
Text[] = "Butcher<5<bot<terrorist"

name will contain for a maximum of nameLen characters, "Butcher".
userid will have 5 stored into it.
authid will contain for a maximum of authidLen characters, "BOT".
team will contain, for a maximum of teamLen characters, TERRORIST.


parse_time
Core (amxmodx.inc)
Description
parse_time - Returns time in input and additionaly fills missing information
Syntax
parse_time ( const input[],const format[], time = -1 )
Type
Native
Notes
Example:

parset_time( "10:32:54 04/02/2003", "%H:%M:%S %m:%d:%Y" )

For more information see strptime(...) function from C libraries. */


pause
Core (amxmodx.inc)
Description
pause - Pauses function or plugin so it won't be executed.
Syntax
pause ( flag[], const param1[]= )
Type
Native
Notes
Note: As of AMX Mod X 1.1, the "b" flag has been deprecated and no longer works. The implementation was poor and a proper version would be a great performance hit. Instead, use your own internal variables to switch function bodies on and off.

In most cases param1 is name of function and
param2 name of plugin (all depends on flags).
Flags:
"a" - pause whole plugin.
"b" - pause function.
"c" - look outside the plugin (by given plugin name).
"d" - set "stopped" status when pausing whole plugin.
"e" - set "locked" status when pausing whole plugin.
In this status plugin is unpauseable.
Example: pause("ac","myplugin.amxx")
pause("bc","myfunc","myplugin.amxx")


plugin_cfg
Core (amxmodx.inc)
Description
plugin_cfg - Called after plugin_init has been called
Syntax
plugin_cfg ( )
Type
Forward
Notes
All commmands and cvars should be already registered by the time this is forwarded.


plugin_end
Core (amxmodx.inc)
Description
plugin_end - Called at a plugin's end
Syntax
plugin_end ( )
Type
Native
Notes
This is forwarded on ServerDeactivate - shutdown or mapchange.


plugin_flags
Core (amxmodx.inc)
Description
plugin_flags - Returns plugin flags
Syntax
plugin_flags ( [ hdr=0 ] )
Type
Native
Notes
Returns the internal flags set on the called plugin's state. If hdr is 1, it will return the pcode flags rather than state flags.

These flags are defined in amxconst.inc


plugin_init
Core (amxmodx.inc)
Description
plugin_init - Forward for plugin initialization
Syntax
plugin_init ( )
Type
Forward
Notes
This is called on ServerActivate. You should call register_plugin here.


plugin_log
Core (amxmodx.inc)
Description
plugin_log - Called on a log message
Syntax
plugin_log ( )
Type
Forward
User Contributed Notes
bailopan at gmail dot com Oct-05-04 11:48:33
As of 0.20-RC7, this can be blocked with PLUGIN_HANDLED.


plugin_modules
Core (amxmodx.inc)
Description
plugin_modules - Module check routine - DEPRECATED
Syntax
plugin_modules ( )
Type
Forward
Notes
Update:
This routine is deprecated and is never called as of AMX Mod X 1.1.

This routine is called before anything else - even plugin_init. For this reason most natives will be unitialized and using them will crash. The only function you are allowed to use here is require_module.


plugin_natives
Core (amxmodx.inc)
Description
plugin_natives - Called when register_native can be used.
Syntax
plugin_natives ( )
Type
Forward
Notes
This forward is called immediately after the plugin is initialized in memory, much like the deprecated plugin_modules was.

It is safe to use only register_native and register_library here.


plugin_pause
Core (amxmodx.inc)
Description
plugin_pause - Called when the plugin is paused.
Syntax
plugin_pause ( )
Type
Forward


plugin_precache
Core (amxmodx.inc)
Description
plugin_precache - Actually first called forward
Syntax
plugin_precache ( )
Type
Forward
Notes
You should do all precaching here, as it is called on ServerActivate.


plugin_unpause
Core (amxmodx.inc)
Description
plugin_unpause - Called when the plugin is unpaused.
Syntax
plugin_unpause ( )
Type
Forward


power
Core (core.inc)
Description
power - Raises a value to a power.
Syntax
power ( value, exponent )
Type
Native


precache_model
Core (amxmodx.inc)
Description
precache_model - Precaches a model file
Syntax
precache_model ( const name[] )
Type
Native
Notes
Only call this in the plugin_precache() forward.


precache_sound
Core (amxmodx.inc)
Description
precache_sound - Precaches a sound file
Syntax
precache_sound ( const name[] )
Type
Native
Notes
Only call this in the plugin_precache() forward.


query_client_cvar
Core (amxmodx.inc)
Description
query_client_cvar - Dispatches a client cvar query
Syntax
query_client_cvar ( id, const cvar[], const resultFunc[], paramlen=0, const params[] = "" )
Type
Native
Notes
* id is a player entid from 1 to 32. Must be connected and may not be a bot
* cvar is the cvar name
* resultFunc is the name of the public function in your plugin that will be called when the response arrives
* paramlen cells from the params array will be passed to the result function as its fourth parameter if paramlen is specified.

The result function has the following form:

public callbackCvarValue(id, const cvar[], const value[])

or, if you use the optional array parameter (paramlen + params):

public callbackCvarValue(id, const cvar[], const value[], const param[])

* id is the player id
* cvar and value are self explaining

The function uses a pretty new engine function (added around Aug 11, 2005). Therefore it may cause a native error on out-of-date servers.
It also uses newdll functions; metamod (at least 1.18) doesn't provide newdll function table hooking for plugins if the mod gamedll doesn't export newdll functions.
This is fixed in metamod-1.18p26 by ghost_of_evilspy (hullu). [ http://sourceforge.net/projects/metamod-p ]

! This function is only available in the CVS at the moment; it will be available in the next official AMX Mod X release.

**********************************
Example plugin:
Log the value of the rate cvar of all connecting users

#include <amxmodx>

public plugin_init()

    register_plugin("test", "1", "PM");
}

public client_connect(id)

    if (!is_user_bot(id))
        query_client_cvar(id, "rate", "cvar_result_func");
}

public cvar_result_func(id, const cvar[], const value[])

    new name[32];
    get_user_name(id, name, 31);

    log_amx("Client %d(%s)'s rate is ^"%s^"", id, name, value);
}

Logged output:
L 09/07/2005 - 11:42:25: [test.amxx] Client 1(psychedelic hampster)'s rate is "15000"


random
Core (core.inc)
Description
random - Returns a pseudo-random number in the range of 0 to max-1.
Syntax
random ( max )
Type
Native
User Contributed Notes
knare at optonline dot net Aug-28-05 23:03:56
You can also generate a random number between two specified intergers by using: example: (between 10 and 20) new num = random(10,20)


random_float
Core (amxmodx.inc)
Description
random_float - Generates random floating point number from a to b
Syntax
random_float ( Float:a,Float:b )
Type
Native


random_num
Core (amxmodx.inc)
Description
random_num - Generates random integer from a to b.
Syntax
random_num ( a,b )
Type
Native


read_argc
Core (amxmodx.inc)
Description
read_argc - Returns the number of parameters/arguments in a command.
Syntax
read_argc ( )
Type
Native
Notes
This includes the command itself.

If it returns 10, the actual argument count is 9.


read_args
Core (amxmodx.inc)
Description
read_args - Returns the entire parameter line of a command.
Syntax
read_args ( output[], len )
Type
Native
Notes
The result is stored in output for a maximum length of len characters.


read_argv
Core (amxmodx.inc)
Description
read_argv - Reads an argument from a command.
Syntax
read_argv ( id, output[], len )
Type
Native
Notes
Arguments start from 1, the 0 argument returns the command.

The result is stored in output for a maximum length of len characters.


read_data
Core (amxmodx.inc)
Description
read_data - Gets arguments/values from client messages.
Syntax
read_data ( value, [ ... ] )
Type
Native
Notes
To get an array/string:
new string[32]
read_data(argument, string, 31)

To get a float:
new Float:fVal
read_data(argument, fVal)

To get an integer:
read_data(argument)


read_datanum
Core (amxmodx.inc)
Description
read_datanum - Returns the number of values in a client message.
Syntax
read_datanum ( )
Type
Native


read_dir
Core (file.inc)
Description
read_dir - Reads content from a directory.
Syntax
read_dir ( const dirname[], pos, output[], len, &outLen )
Type
Native
Notes
Returns index of next element or 0 when the end of the directory is reached.

This function has been deprecated because it is very slow. The correct usage of this function is to not advance pos, but to set pos equal to the return value. Since most users did not do this, a more optimized version is now recommended. See open_dir.


read_file
Core (file.inc)
Description
read_file - Reads a line from a file.
Syntax
read_file ( const file[], line, text[], len, &txtLen )
Type
Native
Notes
Returns index of next line or 0 when the end of the file is reached.

Line numbers start at 0. The line is read into text for a maximum of len characters. The number of characters read is stored in txtLen (passed byref).
User Contributed Notes
burnincoldblue at comcast dot net Oct-28-04 03:56:34
I advise you to be very careful on how you word your script. Improper wording can make your server crash.


read_flags
Core (amxmodx.inc)
Description
read_flags - Converts a string into a sum of bits.
Syntax
read_flags ( const flags[] )
Type
Native
Notes
"a" is 1
"b" is 2
"c" is 4
...
This function will sum the letters into a bit total.
User Contributed Notes
downtown1 at gmail dot com Jul-05-04 22:22:28
Use this to check flags quickly.. "a" is (1<<0) (in binary 0001) "b" is (1<<1) (in binary 0010) "c" is (1<<2) (in binary 0100) etc. With this you could make a loop, i.e. flags = read_flags(szString) for (new i = 0; i < 26; i++) { if ( flags&(1<<i) ) //the flag is set, do something or not } But then again it's quicker only in the machine code sense, because usually you'd want different things depending on different flags.


read_logargc
Core (amxmodx.inc)
Description
read_logargc -
Syntax
read_logargc ( Returns the number of log arguments. )
Type
Native
Notes
Can only be performed inside the plugin_log forward.


read_logargv
Core (amxmodx.inc)
Description
read_logargv - Gets a log argument.
Syntax
read_logargv ( id, output[], len )
Type
Native
Notes
Arguments are indexed from 0.

Stores result in output for a maximum length of len characters.


read_logdata
Core (amxmodx.inc)
Description
read_logdata - Gets a log message.
Syntax
read_logdata ( output[], len )
Type
Native
Notes
Can only be performed inside the plugin_log forward.

Stores result in output for a maximum length of len characters.


register_clcmd
Core (amxmodx.inc)
Description
register_clcmd - Registers function which will be called from client console
Syntax
register_clcmd ( const client_cmd[],const function[],flags=-1, info[]="" )
Type
Native
Notes
Example:

register_clcmd("amx_mycommand","MyFunction",ADMIN_KICK,"Description of the command")

A list of all the access list:
ADMIN_RESERVATION
ADMIN_IMMUNITY
ADMIN_KICK
ADMIN_BAN
ADMIN_SLAY
ADMIN_MAP
ADMIN_CVAR
ADMIN_CFG
ADMIN_CHAT
ADMIN_VOTE
ADMIN_PASSWORD
ADMIN_RCON
ADMIN_LEVEL_A
ADMIN_LEVEL_B
ADMIN_LEVEL_C
ADMIN_LEVEL_D
ADMIN_LEVEL_E
ADMIN_LEVEL_F
ADMIN_LEVEL_G
ADMIN_LEVEL_H


register_concmd
Core (amxmodx.inc)
Description
register_concmd - Registers function which will be called from any console
Syntax
register_concmd ( const cmd[],const function[],flags=-1, info[]="" )
Type
Native
Notes
Example:

register_concmd("amx_mycommand","MyFunction",ADMIN_KICK,"Description of the command")

A list of all the access list:
ADMIN_RESERVATION
ADMIN_IMMUNITY
ADMIN_KICK
ADMIN_BAN
ADMIN_SLAY
ADMIN_MAP
ADMIN_CVAR
ADMIN_CFG
ADMIN_CHAT
ADMIN_VOTE
ADMIN_PASSWORD
ADMIN_RCON
ADMIN_LEVEL_A
ADMIN_LEVEL_B
ADMIN_LEVEL_C
ADMIN_LEVEL_D
ADMIN_LEVEL_E
ADMIN_LEVEL_F
ADMIN_LEVEL_G
ADMIN_LEVEL_H


register_cvar
Core (amxmodx.inc)
Description
register_cvar - Registers new cvar for HL engine.
Syntax
register_cvar ( const name[],const string[],flags = 0,Float:fvalue = 0.0 )
Type
Native
Notes
Example:

register_cvar("amx_MyCvar","1",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)

FCVAR_ARCHIVE set to cause it to be saved to vars.rc
FCVAR_USERINFO changes the client's info string
FCVAR_SERVER notifies players when changed
FCVAR_EXTDLL defined by external DLL
FCVAR_CLIENTDLL defined by the client dll
FCVAR_PROTECTED It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
FCVAR_SPONLY This cvar cannot be changed by clients connected to a multiplayer server.
FCVAR_PRINTABLEONLY This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
FCVAR_UNLOGGED If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log


register_dictionary
Core (amxmodx.inc)
Description
register_dictionary - Registers a dictionary file
Syntax
register_dictionary ( const file[] )
Type
Native
Notes
The file must be located relative to "%datadir%/lang". The file should be formatted like a language dictionary file. An example would be:

[en]
hello = Hello!
bye = Goodbye!
greeting = Hello, %s!

[es]
hello = Hola!
...

The dictionary implementation in AMX Mod X is called "register" because it only adds or enforces the dictionary when necessary. The text file is not processed if it has already been processed and has not changed.


register_event
Core (amxmodx.inc)
Description
register_event - Registers an event on which a given function will be called
Syntax
register_event ( const event[], const function[], const flags[], [ cond=[], ... ] )
Type
Native
Notes
event is a message, such as "DeathMsg", "Damage", et cetera.

function is the name of a public function which will be called on this event.

flags is a combination of flags that determine if this event is forwarded:
"a" - Global Event
"b" - Event sent to a single target
"c" - Send only once when repeated to other players
"d" - Only if sent to a dead player
"e" - Only if sent to an alive player

You can optionally set a list of restrictions/conditions on the event. For example:
"2=c4" - 2nd parameter of message must be sting "c4".
"3>10" - 3rd parameter must be greater then 10.
"3!4" - 3rd must not be 4.
"2&Buy" - 2nd parameter of message must contain "Buy" substring.
"2!Buy" - 2nd parameter of message can't contain "Buy" substring.

Example:

public plugin_init()

   //Only called if killer is not worldspawn
   register_event("DeathMsg", "hook_death", "a", "1>0")
}

public hook_death()

   new Killer = read_data(1)
   new Victim = read_data(2)
}

User Contributed Notes
wchristian at gmx dot ch Dec-26-04 21:15:52
Hi, Correction ;) You need to type "meta game" (it's key sensitive ;))

burnincoldblue at comcast dot net Oct-20-04 04:24:18
If you have a server running you can type "meta Game" into the console showing you all the messages that you can use with this function.


register_library
Core (amxmodx.inc)
Description
register_library - Registers your plugin as a library.
Syntax
register_library ( const name[] )
Type
Native
Notes
You can put #pragma library <name in your include files, and plugins that use your include without loading your plugin will get a nice error message.

This native technically just makes the Core think your plugin is a module; this is part of the "auto-module" system where failed plugins automatically know what modules they need.


register_logevent
Core (amxmodx.inc)
Description
register_logevent - Registers a function to be called on a log event
Syntax
register_logevent ( const function[], argsnum, ... )
Type
Native
Notes
function is the name of a public function to be called on the logged message.

argsnum is the number of arguments to retrieve.

You can filter the results by adding conditional parameters. Examples:
"0=World triggered" "1=Game_Commencing"
"1=say"
"3=Terrorists_Win"
"1=entered the game"
"0=Server cvar"

You can get the log data with the functions: read_logdata, read_logargc, read_logargv.

Example:
public plugin_init()

    register_plugin("Logevent Example","0.1","SniperBeamer")
    register_logevent("joined_team",3,"1=joined team","2=CT")
}

public joined_team()

    new Arg1[64],Arg2[64]
    read_logargv(0,Arg1,63) // [L] Arg0: SniperBeamer<1><4294967295><>
    read_logargv(2,Arg2,63) // [L] Arg2: CT
}


register_menu
Core (amxmisc.inc)
Description
register_menu - Registers a menu.
Syntax
register_menu ( title[], keys, function[], outside=0 )
Type
Stock
Notes
Shortcut for register_menuid and register_menucmd.


register_menucmd
Core (amxmodx.inc)
Description
register_menucmd - Calls function when player uses specified menu and proper keys.
Syntax
register_menucmd ( menuid,keys, const function[] )
Type
Native


register_menuid
Core (amxmodx.inc)
Description
register_menuid - Gets unique id of menu.
Syntax
register_menuid ( const menu[], outside=0 )
Type
Native
Notes
If outside is set to 1 it allows to catch menus outside a plugin where register_menuid is called.


register_native
Core (amxmodx.inc)
Description
register_native - Declares a native that other plugins can use.
Syntax
register_native ( const name[], const handler[], [ style = 0 ] )
Type
Native
Notes
When a plugin uses your native (you should distribute a .inc), the handler will be called with two parameters: the calling plugin id, and the number of parameters.

If you set style=1, the method of parameter passing is a tad more efficient. Instead of "id, numParams", you label the native exactly as how the parameters should, in theory, be sent. Then for each byreference parameter, you call param_convert(num). This is theoretically more efficient but quite hacky. The method was discovered by dJeyL, props to him!

The advantage to keeping style set to 0 is that it more closely resembles the AMX Mod/X module API.


register_plugin
Core (amxmodx.inc)
Description
register_plugin - Sets a plugin's info
Syntax
register_plugin ( const plugin_name[], const version[], const author[] )
Type
Native
Notes
This registers a plugin into the plugin list.

Example:

#define PLUGIN_NAME "Admin Abuse"
#define PLUGIN_VERSION "1.00"
#define PLUGIN_AUTHOR "The Man"

public plugin_init()

   register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
}


register_srvcmd
Core (amxmodx.inc)
Description
register_srvcmd - Registers function which will be called from server console.
Syntax
register_srvcmd ( const server_cmd[],const function[],flags=-1, info[]="" )
Type
Native


remove_cvar_flags
Core (amxmodx.inc)
Description
remove_cvar_flags - const cvar[],flags = -1
Syntax
remove_cvar_flags ( )
Type
Native
Notes
Removes a cvar flags (not allowed for amx_version, fun_version and sv_cheats cvars).


remove_quotes
Core (amxmodx.inc)
Description
remove_quotes - Removes quotes from sentence.
Syntax
remove_quotes ( text[] )
Type
Native


remove_task
Core (amxmodx.inc)
Description
remove_task - Removes all tasks with given id.
Syntax
remove_task ( id = 0, outside = 0 )
Type
Native
Notes
If outside var is set then a task can be removed also when was set in another plugin.


remove_user_flags
Core (amxmodx.inc)
Description
remove_user_flags - Removes flags for player
Syntax
remove_user_flags ( index,flags=-1,id=0 )
Type
Native


remove_vaultdata
Core (vault.inc)
Description
remove_vaultdata - Removes a key from the vault.
Syntax
remove_vaultdata ( const key[] )
Type
Native


replace
Core (string.inc)
Description
replace - Replaces a contained string
Syntax
replace ( text[], len, const what[], const with[] )
Type
Native
Notes
Replaces string what inside string text, with given string "with", for a maximum length of len.
User Contributed Notes
amxmodx at dagy dot sk Jan-11-05 16:46:14
Sorry but in replace statements in previous post should ofcourse be ">", "&gt;" ) and < to &lt; respectively. This was a mistake.

amxmodx at dagy dot sk Jan-11-05 16:42:29
I've looked for statsx.amxx fix to properly handle html tags in user names for top15 list, but nothing found.
So I decided to fix this myself.
I've modified statsx.sma in function format_top15
to replace special html chars  from < to &lt; and > to &gt;.
like this:

    get_stats( i, izStats, izBody, t_sName, MAX_NAME_LENGTH )
    // properly handle html tags in name
    while( contain ( t_sName, "<" ) != -1 )
        replace( t_sName, MAX_NAME_LENGTH, "<", "<" )
    while( contain ( t_sName, ">" ) != -1 )
        replace( t_sName, MAX_NAME_LENGTH, ">", ">" )
    iLen += format( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen,
                    "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i+1, t_sName,
                    izStats[STATS_KILLS], izStats[STATS_DEATHS], izStats[STATS_HITS],
                    izStats[STATS_SHOTS], izStats[STATS_HS],
                    effec( izStats ), accuracy( izStats ) )

the question is what happened if replace function did not replace character in case of maximal name length ? then this is an endless loop isn't it ?
Can be return value of replace used in any case ?


require_module
Core (amxmodx.inc)
Description
require_module - Sets a requirement for a module - DEPRECATED
Syntax
require_module ( const name[] )
Type
Native
Notes
Update:
This routine is deprecated in AMX Mod X 1.1. It does nothing and always returns 1.

This function may only be called in plugin_modules. Do not call it anywhere else.

The name is the name the module displays when you type "amxx modules". It is case insensitive. The only "magic" name is "DBI", which will detect any module that has "DBI" or "SQL" in its name.

If no matching module is loaded for each require_module() line, the plugin will fail to load and an error message will instruct the user to check modules.ini.


rewind
Core (file.inc)
Description
rewind - Resets a file's internal position (by file handle).
Syntax
rewind ( file )
Type
Native
Notes
This function is deprecated as of AMX Mod X Version 1.1.


server_cmd
Core (amxmodx.inc)
Description
server_cmd - Executes command on a server console
Syntax
server_cmd ( const command[],{Float,_}:... )
Type
Native
Notes
Example:

server_cmd("echo The maxplayers on this server is: %d",get_maxplayers())

Please do not use this function to set cvars, use: set_cvar_string,set_cvar_float,set_cvar_num

User Contributed Notes
rh at pdc dot ru Oct-10-04 14:34:07
Keep in mind that actual execution of command is delayed until last forward function of last plugin is executed or until you call server_exec. For example server_cmd called in plugin_init will be executed after completion of plugin_init of last pluging listed in plugins.ini


server_exec
Core (amxmodx.inc)
Description
server_exec - Forces server to execute sent server command at current time. Very useful for map changes, setting cvars and other activities.
Syntax
server_exec ( )
Type
Native


server_print
Core (amxmodx.inc)
Description
server_print - Prints a message to the server console.
Syntax
server_print ( const message[], [ ... ] )
Type
Native
Notes
message can be formatted in the style of format.


setarg
Core (core.inc)
Description
setarg - Set the value of an argument from an argument list.
Syntax
setarg ( arg, index=0, value )
Type
Native
Notes
Arguments start from 0. If an array, index specifies the array index.


setc
Core (string.inc)
Description
setc - Sets a string with a given character.
Syntax
setc ( src[], len, ch )
Type
Native


set_array
Core (amxmodx.inc)
Description
set_array - Copies a local array into the one given by a calling plugin.
Syntax
set_array ( param, source[], size )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.

See set_string for more details.


set_array_f
Core (amxmodx.inc)
Description
set_array_f - Copies a float array into the one given by a calling plugin.
Syntax
set_array_f ( param, Float:dest[], size )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.

See set_string for more details.


set_cvar_flags
Core (amxmodx.inc)
Description
set_cvar_flags - Sets a cvar flags (not allowed for amx_version, fun_version and sv_cheats cvars)
Syntax
set_cvar_flags ( const cvar[],flags )
Type
Native


set_cvar_float
Core (amxmodx.inc)
Description
set_cvar_float - Sets a cvar to given float.
Syntax
set_cvar_float ( const cvar[],Float:value )
Type
Native


set_cvar_num
Core (amxmodx.inc)
Description
set_cvar_num - Sets a cvar with integer value
Syntax
set_cvar_num ( const cvarname[],value )
Type
Native


set_cvar_string
Core (amxmodx.inc)
Description
set_cvar_string - Sets a cvar to given value
Syntax
set_cvar_string ( const cvar[],const value[]) )
Type
Native


set_error_filter
Core (amxmodx.inc)
Description
set_error_filter - Allows you to trap error messages that occur in your plugin.
Syntax
set_error_filter ( const handler[] )
Type
Native
Notes
You can use this to override the debug messages that occur when your plugin causes some sort of runtime error. A plugin can only have one error filter at one time. Subsequent calls to set_error_filter always replace the old filter.

Parameters:
* handler: The public callback function that should be called when an error occured.

The handler function will be called with these parameters:

public error_filter(error_code, bool:debugging, message[])

* error_code: Specifies the error that occured. This can be one of the AMX_ERR_* values defined in amxconst.inc
* debugging specifies whether the plugin runs in debug mode
* message is any message that was sent along with the error

When the handler function returns PLUGIN_HANDLED, the error is blocked from displaying. Returning PLUGIN_CONTINUE lets the error pass the filter.


set_float_byref
Core (amxmodx.inc)
Description
set_float_byref - Sets a float into the byreference parameter in a calling plugin.
Syntax
set_float_byref ( param, Float:value )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.


set_hudmessage
Core (amxmodx.inc)
Description
set_hudmessage - Sets the format for a HUD message
Syntax
set_hudmessage ( red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2, channel=4 )
Type
Native
Notes
There are 4 hud channels pr player. This means you can send a 2 diffrent messages to player a & b via channel 1.

Use index 0 if you want to send a message to everyone.
Use show_hudmessage to show the message.

Plugins that can be helpfull.
This plugin allows you to easly change the pos/color of a hud message:
http://www.amxmodx.org/forums/viewtopic.php?p=20785
User Contributed Notes
anonymous Mar-18-05 22:08:38
What are these parameters ?? efect and fxtime ?


set_localinfo
Core (amxmodx.inc)
Description
set_localinfo - Sets info ("localinfo") on the server
Syntax
set_localinfo ( const info[], const value[] )
Type
Native


set_param_byref
Core (amxmodx.inc)
Description
set_param_byref - Sets a byreference value into the parameter given by a calling plugin.
Syntax
set_param_byref ( param, value )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.


set_string
Core (amxmodx.inc)
Description
set_string - Sets a string in a calling plugin
Syntax
set_string ( param, string[], maxlen )
Type
Native
Notes
This can only be used in a dynamic native function registered with style 0 (default). Arguments start at 1.

Copies a string back into a buffer specified in a parameter. For example:
public mynative(id, numParams)

   set_string(1, "Yams", 4)
}
public test()

   new str[5]
   mynative(str)
}

Will copy the word "Yams" into the array given as parameter 1.


set_task
Core (amxmodx.inc)
Description
set_task - Calls function on specified time.
Syntax
set_task ( Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0 )
Type
Native
Notes
Flags:
"a" - repeat.
"b" - loop task.
"c" - do task on time after a map timeleft.
"d" - do task on time before a map timelimit.

Example of executing a task once.

set_task(15.0,"MyFunction")

Remember that functions executed by set_task needs be public


set_user_deaths
Core (amxmodx.inc)
Description
set_user_deaths - Sets a player's death count.
Syntax
set_user_deaths ( index, newDeaths )
Type
Native
Notes
This does not work on some mods, which store deaths in a private variable, like Counter-Strike.

See cs_set_user_deaths.


set_user_flags
Core (amxmodx.inc)
Description
set_user_flags - Sets flags for player.
Syntax
set_user_flags ( index,flags=-1,id=0 )
Type
Native
Notes
Set flags to -1 if you want to clear all flags. You can use different settings by changing the id, which is from range 0 - 31.


set_user_frags
Core (amxmodx.inc)
Description
set_user_frags - Set's a player's frag count.
Syntax
set_user_frags ( index, newFrags )
Type
Native
Notes
index is a player index from 1 to 32.
User Contributed Notes
gary dot berthelsen at gmail dot com Sep-03-05 09:32:04
set_user_frags(x,y) requires: #include

niro_cs at mail dot ru Apr-05-05 17:24:00
L 04/05/2005 - 19:18:56: [AMXX] Plugin uses an unknown function (name "set_user_ frags") - check your modules.ini. (plugin "amx_war_154b5.amxx")

secretlan at hotmail dot com Mar-21-05 21:29:14
How to set "set_user_health" and "set_user_ammo" ?


set_user_info
Core (amxmodx.inc)
Description
set_user_info - Sets an info value on a player
Syntax
set_user_info ( index, const info[], const value[] )
Type
Native
Notes
index is a player index from 1 to 32.
User Contributed Notes
rh at pdc dot ru Oct-10-04 14:26:18
Such a simple function but still full of surprises! Do not try to set info on user id 0 (which is server itself) otherwise you'll end up with nasty runtime error. You may want to use set_localinfo instead.

rh at pdc dot ru Aug-18-04 17:05:01
This function does not seem to save info to client's config. Had to execute client_cmd(index, "setinfo %s %s", info, value) instead...


set_vaultdata
Core (vault.inc)
Description
set_vaultdata - Sets a value for a key in the vault.
Syntax
set_vaultdata ( const key[], [ const data[] = "" ] )
Type
Native


set_xvar_float
Core (amxmodx.inc)
Description
set_xvar_float - Sets a float value of a public variable
Syntax
Float: set_xvar_float ( id, Float:value = 0.0 )
Type
Native
Notes
Id is a value returned by get_xvar_id


set_xvar_num
Core (amxmodx.inc)
Description
set_xvar_num - Sets a value of a public variable.
Syntax
set_xvar_num ( id, value = 0 )
Type
Native
Notes
Id is a value returned by get_xvar_id


show_activity
Core (amxmisc.inc)
Description
show_activity - Shows admin activity.
Syntax
show_activity ( id, const name[], ... )
Type
Stock
Notes
index is the index of the player running the command. name is the name of the player running the command. The other parameters are the description of the command.

Example:
show_activity(id,playername,"slapped player");

If amx_show_activity is 2, will appear as: "ADMIN PlayerName: slapped player". If it is 1, it will appear as: "ADMIN: slapped player".
User Contributed Notes
slayerized at gmail dot com Apr-10-05 07:20:45
Isn't this kind of pointless when you could just do a switch statement like so: --- switch(get_cvar_num("amx_show_activity")) {
        case 1: client_print(0,print_chat,"ADMIN: Slapped player")
        case 2: client_print(0,print_chat,"ADMIN %s: Slapped player",szUsername)
    } --- .. ?


show_hudmessage
Core (amxmodx.inc)
Description
show_hudmessage - Displays a HUD message to a player
Syntax
show_hudmessage ( index, message[], ... )
Type
Native
Notes
index is a player index from 1 to 32.

message can be formatted according to format.
Remeber to use the set_hudmessage function first, to control the color/pos/effects.


show_menu
Core (amxmodx.inc)
Description
show_menu - Shows a list of menu options to a client.
Syntax
show_menu ( index, keys, const menu[], time = -1, title[] = "" )
Type
Native
Notes
index is a player index from 1 to 32.

keys is a bitwise number totalling the set of menu options. For example, here is a two option menu:

format(menuBody, 192, "\rCSDM: Armor\R^n^n\y1.\w Yes, armor up^n\y2.\w No armor")
key = (1<<0)|(1<<1)
show_menu(id, key, menuBody)

Optionally you can specify a time, which defaults to infinity (-1) and a title for register_menu.
User Contributed Notes
devicenul at gmail dot com Jun-24-04 20:48:42
Defines for the various key's you need #define key_one     (1<<0)        //1
#define key_two     (1<<1)        //2
#define key_three     (1<<2)        //3
#define key_four    (1<<3)        //4
#define key_five     (1<<4)        //5
#define key_six        (1<<5)        //6
#define key_seven    (1<<6)        //7
#define key_eight    (1<<7)        //8
#define key_nine     (1<<8)        //9


show_motd
Core (amxmodx.inc)
Description
show_motd - Displays an MOTD style window to a user.
Syntax
show_motd ( player, const message[], [ const header[] ] )
Type
Native
Notes
player is a player index from 1 to 32.

message can either be a filename or a string formatted message. With VGUI2, the message can be HTML formatted.

You can supply an optional title bar for the window. If not supplied, it will default to the server name.

The length of the message should not be more than around 1,200 characters - going over this limit could potentially crash the client.


sqroot
Core (core.inc)
Description
sqroot - Approximates the integer square root of value.
Syntax
sqroot ( value )
Type
Native


strbreak
Core (string.inc)
Description
strbreak - Gets parameters from text one at a time.
Syntax
strbreak ( const text[], left[], leftLen, right[], rightLen )
Type
Native
Notes
It breaks a string into the first parameter and the rest of the parameters (A left side and right side of the string).
Example: to split text: "^"This is^" the best year",

split(text, arg1, len1, arg2, len2)
arg1="This is", arg2=the best year

This is more useful than parse() because you can keep breaking any number of arguments.
User Contributed Notes
anonymous Feb-22-05 01:27:03
Actually, shouldn't it be: arg1="^"This is^"" arg2="the best year"

anonymous Feb-22-05 01:26:09
Add quotes around "the best year"

bailopan at gmail dot com Sep-03-04 04:41:27
It exists in AMX Mod X 0.20.


strcat
Core (string.inc)
Description
strcat - Concatenates a string.
Syntax
strcat ( dest[], const source[], maxlength )
Type
Native
Notes
Maxlength is the total buffer of the destination.


strcmp
Core (string.inc)
Description
strcmp - Compares two strings, C-style. Returns 0 on equal.
Syntax
strcmp ( const string1[], const string2[], ignorecase=0 )
Type
Native


strfind
Core (string.inc)
Description
strfind - Finds a string in another string. Returns -1 if not found.
Syntax
strfind ( const string[], const sub[], ignorecase=0, pos=0 )
Type
Native


strlen
Core (core.inc)
Description
strlen - Returns the length of a zero terminated string.
Syntax
strlen ( const string[] )
Type
Native


strpack
Core (core.inc)
Description
strpack - Copy a string from source to dest, in packed format.
Syntax
strpack ( dest[], const source[] )
Type
Native
Notes
Source or destination may be in packed format.


strtolower
Core (string.inc)
Description
strtolower - Converts all characters in string to lower case.
Syntax
strtolower ( string[] )
Type
Native


strtoupper
Core (string.inc)
Description
strtoupper - Converts all characters in string to upper case.
Syntax
strtoupper ( string[] )
Type
Native


strunpack
Core (core.inc)
Description
strunpack - Copy a string from source to dest in unpacked format.
Syntax
strunpack ( dest[], const source[] )
Type
Native
Notes
The source string may either be a packed or unpacked string.


str_to_float
Core (string.inc)
Description
str_to_float - Converts a string to a float
Syntax
Float: str_to_float ( const string[] )
Type
Native
Notes
The function takes a string, parses a float, and returns it.

Example:

Float:fl = str_to_float("-5.06"); // fl will be -5.06

A leading + sign is accepted (but optional).
When the function finds a character that is not a digit and not a period, it stops parsing and returns.

More examples:

str_to_float(""); // returns 0.0
str_to_float("2"); // returns 2.0
str_to_float("+7"); // returns 7.0
str_to_float("+"); // returns 0.0
str_to_float("089.1.3"); // returns 89.1
str_to_float("-.2gaben1"); // returns -0.2
str_to_float("gab2"); // returns 0.0


str_to_num
Core (string.inc)
Description
str_to_num - Returns a string converted to a number
Syntax
str_to_num ( const string[] )
Type
Native
User Contributed Notes
stromling at yahoo dot se Apr-08-05 22:36:15
Example: new example = str_to_num(10)


swapchars
Core (core.inc)
Description
swapchars - Returns the value of c where all the bytes in the cell are swapped (low bye becomes high).
Syntax
swapchars ( c )
Type
Native


task_exists
Core (amxmodx.inc)
Description
task_exists - Returns 1 if task under given id exists.
Syntax
task_exists ( id = 0, outside = 0 )
Type
Native
Notes
If outside is true, checks under other plugins.


tickcount
Core (core.inc)
Description
tickcount - Unknown
Syntax
tickcount ( [ &granularity ] )
Type
Native


time
Core (core.inc)
Description
time - Retrives the time.
Syntax
time ( [ &hour, &minute, &second ] )
Type
Native
Notes
Each parameter, passed by reference, will have the corresponding piece of time stored inside.


tolower
Core (core.inc)
Description
tolower - Returns the lower case character code of c, or if not available, returns c.
Syntax
tolower ( c )
Type
Native


toupper
Core (core.inc)
Description
toupper - Returns the upper case character code of c, or if not available, returns c.
Syntax
toupper ( c )
Type
Native


trim
Core (string.inc)
Description
trim - Strips spaces from the beginning and end of a string.
Syntax
trim ( text[] )
Type
Native
Notes
Returns the number of deleted chars.

Spaces are:
- ordinary spaces
- tabs
- new lines
- carriage returns
- vertical tabs


ucfirst
Core (string.inc)
Description
ucfirst - Make a string's first character uppercase
Syntax
ucfirst ( string[] )
Type
Native


unlink
Core (file.inc)
Description
unlink - Deletes a file.
Syntax
unlink ( const filename[], ... )
Type
Native
Notes
Macro for delete_file with format syntax.


unpause
Core (amxmodx.inc)
Description
unpause - Unpauses function or plugin.
Syntax
unpause ( flag[], const param1[]= )
Type
Native
Notes
Note: As of AMX Mod X 1.1, the "b" flag has been deprecated and no longer works. The implementation was poor and a proper version would be a great performance hit. Instead, use your own internal variables to switch function bodies on and off.

Flags:
"a" - unpause whole plugin.
"b" - unpause function.
"c" - look outside the plugin (by given plugin name).


user_has_weapon
Core (amxmodx.inc)
Description
user_has_weapon - Returns if a player has the weapon or not.
Syntax
user_has_weapon ( index, weapon, [ setweapon ] )
Type
Native
Notes
index is a player index from 1 to 32.

weapon is an index into the player's weapon bitfield. If setweapon is used, you can toggle whether the bit is set or not.

Note: Will not work right on all modifications. Check the mod's custom module for a mod-specific function.


user_kill
Core (amxmodx.inc)
Description
user_kill - Kills a player.
Syntax
user_kill ( index, [ flag ] )
Type
Native
Notes
index is a player index from 1 to 32.

If flag is set to 1, the death won't decrease the player's frag count.


user_slap
Core (amxmodx.inc)
Description
user_slap - Slaps a player for variable damage (power).
Syntax
user_slap ( index, power, [ rnddir ] )
Type
Native
Notes
If rnddir is specified as 0, the player is not thrown in a random direction.

index,is a player index from 1 to 32.


vaultdata_exists
Core (vault.inc)
Description
vaultdata_exists - Checks if a key exists in the vault.
Syntax
vaultdata_exists ( const key[] )
Type
Native


write_angle
Core (amxmodx.inc)
Description
write_angle - Writes an angle entry to a message.
Syntax
write_angle ( x )
Type
Native
Notes
Read message_begin for more information


write_byte
Core (amxmodx.inc)
Description
write_byte - Writes a single byte to a message.
Syntax
write_byte ( x )
Type
Native
Notes
Read message_begin for more information


write_char
Core (amxmodx.inc)
Description
write_char - Writes a single character to a message.
Syntax
write_char ( x )
Type
Native
Notes
Read message_begin for more information


write_coord
Core (amxmodx.inc)
Description
write_coord - Writes a coordinate entry to a message.
Syntax
write_coord ( x )
Type
Native
Notes
Read message_begin for more information


write_entity
Core (amxmodx.inc)
Description
write_entity - Writes an entity index to a message.
Syntax
write_entity ( x )
Type
Native
Notes
Read message_begin for more information


write_file
Core (file.inc)
Description
write_file - Writes a line to a file.
Syntax
write_file ( const file[], const text[], [ line ] )
Type
Native
Notes
Returns 0 on failure.

The line parameter defaults to -1, which appends to the end of the file. Otherwise, a specific line is overwritten.


write_long
Core (amxmodx.inc)
Description
write_long - Writes a single number to a message (long).
Syntax
write_long ( x )
Type
Native
Notes
Read message_begin for more information


write_short
Core (amxmodx.inc)
Description
write_short - Writes a single number to a message (short).
Syntax
write_short ( x )
Type
Native
Notes
Read message_begin for more information


write_string
Core (amxmodx.inc)
Description
write_string - Writes a string to a message.
Syntax
write_string ( x )
Type
Native
Notes
Read message_begin for more information


xvar_exists
Core (amxmodx.inc)
Description
xvar_exists - Checks if public variable with given name exists in loaded plugins.
Syntax
xvar_exists ( const name[] )
Type
Native
Notes


Cstrike
Content:
  • Notes
  • Functions
  • User Contributed Notes
Notes
The Cstrike module was researched and made by Johnny Got His Gun. It contains many natives for changing Counter-Strike gameplay.

  • cstrike.inc (Provides natives to interface with Counter-Strike and Condition-Zero.)

CStrike Modules Constants:
  • CS Weapon Constants
  • Team Constants
  • Model Constants
  • Armor Constants

CS Weapon Constants:
CSW_P228		1
CSW_SCOUT		3
CSW_HEGRENADE		4
CSW_XM1014		5
CSW_C4			6
CSW_MAC10		7
CSW_AUG			8
CSW_SMOKEGRENADE	9
CSW_ELITE		10
CSW_FIVESEVEN		11
CSW_UMP45		12
CSW_SG550		13
CSW_GALI		14
CSW_GALIL		14
CSW_FAMAS		15
CSW_USP			16
CSW_GLOCK18		17
CSW_AWP			18
CSW_MP5NAVY		19
CSW_M249		20
CSW_M3			21
CSW_M4A1		22
CSW_TMP			23
CSW_G3SG1		24
CSW_FLASHBANG		25
CSW_DEAGLE		26
CSW_SG552		27
CSW_AK47		28
CSW_KNIFE		29
CSW_P90			30

Team Constants:
enum CsTeams {
    CS_TEAM_T = 1,
    CS_TEAM_CT = 2,
    CS_TEAM_SPECTATOR = 3
};

Model Constants:
enum CsInternalModel {
    CS_DONTCHANGE = 0,
    CS_CT_URBAN = 1,
    CS_T_TERROR = 2,
    CS_T_LEET = 3,
    CS_T_ARCTIC = 4,
    CS_CT_GSG9 = 5,
    CS_CT_GIGN = 6,
    CS_CT_SAS = 7,
    CS_T_GUERILLA = 8,
    CS_CT_VIP = 9
};

Armor Constants:
enum CsArmorType {
    CS_ARMOR_NONE = 0, // no armor
    CS_ARMOR_KEVLAR = 1, // armor
    CS_ARMOR_VESTHELM = 2 // armor and helmet
};
Functions
cs_get_hostage_foll - Returns the index of an entity of which a hostage is following.
cs_get_hostage_id - Returns the unique hostage ID of a hostage entity.
cs_get_no_knives - Returns 1 if no knives mode is enabled, otherwise 0.
cs_get_user_bpammo - Returns the amount of ammo in a player's backpack for a specific weapon.
cs_get_user_buyzone - Returns 1 if a player is in a buyzone, 0 otherwise.
cs_get_user_deaths - Returns a user's deaths.
cs_get_user_defuse - Returns 1 if a user has a defuse kit, 0 otherwise.
cs_get_user_driving - Returns different values depending on if user is driving a vehicle.
cs_get_user_hasprim - Returns 1 when user has a primary weapon OR a shield in inventory, otherwise 0.
cs_get_user_model - Finds a user's model.
cs_get_user_money - Returns a user's money.
cs_get_user_nvg - Returns 1 if a player has night vision goggles, 0 otherwise.
cs_get_user_plant - Returns 1 if a player can plant the bomb.
cs_get_user_stationary - Returns 1 if user is using a stationary gun, else 0.
cs_get_user_team - Gets a user's CS team.
cs_get_user_tked - Returns 1 if specified user has TKed (team killed).
cs_get_user_vip - Returns 1 if the player is the VIP, 0 otherwise.
cs_get_weapon_ammo - Returns the amount of ammo in a player's weapon clip.
cs_get_weapon_burst - Returns 1 if the player's weapon is in burst mode, 0 otherwise.
cs_get_weapon_id - Get weapon type.
cs_get_weapon_silen - Returns 1if a player's weapon is silenced, 0 otherwise.
cs_reset_user_model - Reset a player's model.
cs_set_hostage_foll - Sets what a hostage follows.
cs_set_no_knives - Sets whether or not no knives mode is enabled.
cs_set_user_bpammo - Restock/remove ammo in a user's backpack for a specific weapon.
cs_set_user_deaths - Sets a user's deaths
cs_set_user_defuse - Sets whether a user has the defusekit.
cs_set_user_model - Sets a player's model (CS only).
cs_set_user_money - Sets a user's money count.
cs_set_user_nvg - Sets whether a user has night vision goggles.
cs_set_user_plant - Sets whether a player can plant the bomb.
cs_set_user_team - Sets a CS player's team without killing the player.
cs_set_user_tked - Sets whether or not specified user has TKed (team killed).
cs_set_user_vip - Sets whether a user is the VIP.
cs_set_weapon_ammo - Sets the amount of ammo in a player's weapon clip.
cs_set_weapon_burst - Sets whether the player's weapon is in burst mode.
cs_set_weapon_silen - Sets whether a player's weapon is silenced or not.
cs_user_spawn - Spawns a player. EXPERIMENTAL
User Contributed Notes
lilvietx2 at yahoo dot com Sep-13-05 04:01:37
uhh. i started my dedicated server with amx modx and everything i read "My admin doesn't work!" i did what it said but it still doesnt work. why wouldnt it work?

flying_donkey_99 at hotmail dot com Sep-02-05 11:33:31
when i install amx and click on dedicated server and click next it says that i have to run dedicated server once before i can use it but i have dedicated server running already. can someone please halp me with this?

night_reaper999 at yahoo dot com Aug-01-05 00:51:29
i started a dedicated server and i have a problem with adding plugins i just dont noe how 2 compile them!!! anyway i dont noe how 2 add cutom maps 2. PLZ HELP ME!!!!!

seeko at ugotpwned dot info Jul-31-05 02:19:51
I installed the latest AMX MOD X file with the installer to my server through FTP. After doing that I changed a few things in the metamod file to make it read the AMX MOD X file. The file still isn't being read. Everytime I type in anything involving amx it just says unknown command. Please someone help me, I've been struggling with this all day. My e-mail is seeko@ugotpwned.info [ uGp ]:

me Jul-19-05 12:53:27
go in a server wxith amx modx and type in the console amx_langmenu exit the console pres 1 till you see your language then press 2 i had the same problem


cs_get_hostage_foll
Cstrike (cstrike.inc)
Description
cs_get_hostage_foll - Returns the index of an entity of which a hostage is following.
Syntax
cs_get_hostage_foll ( index )
Type
Native
Notes
index is a hostage entity index.

If 0, the hostage is not following anything.


cs_get_hostage_id
Cstrike (cstrike.inc)
Description
cs_get_hostage_id - Returns the unique hostage ID of a hostage entity.
Syntax
cs_get_hostage_id ( index )
Type
Native


cs_get_no_knives
Cstrike (cstrike.inc)
Description
cs_get_no_knives - Returns 1 if no knives mode is enabled, otherwise 0.
Syntax
cs_get_no_knives ( )
Type
Native


cs_get_user_bpammo
Cstrike (cstrike.inc)
Description
cs_get_user_bpammo - Returns the amount of ammo in a player's backpack for a specific weapon.
Syntax
cs_get_user_bpammo ( index, weapon )
Type
Native
Notes
index is a player index from 1 to 32. weapon is a weapon index (see amxconst.inc for CS weapon definitions).

Some weapons share ammo types. Below is a list of weapons, ones on the same line do this.
* awm
* scout, ak, g3
* para
* famas, m4a1, aug, sg550, galil, sg552
* m3, xm
* usp, ump, mac
* fiveseven, p90
* deagle
* p228
* glock, mp5, tmp, elites
* flash
* he
* smoke


cs_get_user_buyzone
Cstrike (cstrike.inc)
Description
cs_get_user_buyzone - Returns 1 if a player is in a buyzone, 0 otherwise.
Syntax
cs_get_user_buyzone ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_user_deaths
Cstrike (cstrike.inc)
Description
cs_get_user_deaths - Returns a user's deaths.
Syntax
cs_get_user_deaths ( index )
Type
Native
Notes
index is a player index from 1 to 32.

This is the CS version of get_user_deaths.


cs_get_user_defuse
Cstrike (cstrike.inc)
Description
cs_get_user_defuse - Returns 1 if a user has a defuse kit, 0 otherwise.
Syntax
cs_get_user_defuse ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_user_driving
Cstrike (cstrike.inc)
Description
cs_get_user_driving - Returns different values depending on if user is driving a vehicle.
Syntax
cs_get_user_driving ( index )
Type
Native
Notes
Return values:
0: no driving
1: driving, but standing still
2-4: driving, different positive speeds
5: driving, negative speed (backing)

Note: these values were tested quickly, they may differ.


cs_get_user_hasprim
Cstrike (cstrike.inc)
Description
cs_get_user_hasprim - Returns 1 when user has a primary weapon OR a shield in inventory, otherwise 0.
Syntax
cs_get_user_hasprim ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_user_model
Cstrike (cstrike.inc)
Description
cs_get_user_model - Finds a user's model.
Syntax
cs_get_user_model ( index, model[], len )
Type
Native
Notes
index is a player index from 1 to 32.

Model is stored for a maximum of len characters.


cs_get_user_money
Cstrike (cstrike.inc)
Description
cs_get_user_money - Returns a user's money.
Syntax
cs_get_user_money ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_user_nvg
Cstrike (cstrike.inc)
Description
cs_get_user_nvg - Returns 1 if a player has night vision goggles, 0 otherwise.
Syntax
cs_get_user_nvg ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_user_plant
Cstrike (cstrike.inc)
Description
cs_get_user_plant - Returns 1 if a player can plant the bomb.
Syntax
cs_get_user_plant ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_user_stationary
Cstrike (cstrike.inc)
Description
cs_get_user_stationary - Returns 1 if user is using a stationary gun, else 0.
Syntax
cs_get_user_stationary ( index )
Type
Native


cs_get_user_team
Cstrike (cstrike.inc)
Description
cs_get_user_team - Gets a user's CS team.
Syntax
cs_get_user_team ( index )
Type
Native
Notes
Return type is CsTeams, which means you have to declare your variable as CsTeams:name, just as you declare a float as Float:name.

index is a player index from 1 to 32.

Return values are CS_TEAM_T, CS_TEAM_CT, or CS_TEAM_SPECTATOR.
User Contributed Notes
XxAvalanchexX at hotmail dot com Oct-23-04 06:14:19
This function returns constants that are interpreted as 1 being Terrorist, 2 being Counter-Terrorist, and 3 being Spectator.

jim_nicebutdim at hotmail dot com Jul-08-04 19:05:38
How does this work? Specifically I'm trying to defferentiate between teams in CS Maps, so for example I could make a teleporter that works for CT's only. I know this comment isn't helpful, but the *answer* might provide some useful insight for CS mappers, like me, who have so far been unable to put team-specific triggers/event in their maps!


cs_get_user_tked
Cstrike (cstrike.inc)
Description
cs_get_user_tked - Returns 1 if specified user has TKed (team killed).
Syntax
cs_get_user_tked ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_user_vip
Cstrike (cstrike.inc)
Description
cs_get_user_vip - Returns 1 if the player is the VIP, 0 otherwise.
Syntax
cs_get_user_vip ( index )
Type
Native
Notes
index is a player index from 1 to 32.
User Contributed Notes
Freeecode at hotmail dot com Jun-24-04 20:40:42
Here is a small code that will show everyone who VIP is.
new players[32],inum;
get_players(players,inum);
for(new x=0; x <= inum; x++)
{
     if(cs_get_user_vip(players[x])
     {
          //This user is VIP
     }
}


cs_get_weapon_ammo
Cstrike (cstrike.inc)
Description
cs_get_weapon_ammo - Returns the amount of ammo in a player's weapon clip.
Syntax
cs_get_weapon_ammo ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_weapon_burst
Cstrike (cstrike.inc)
Description
cs_get_weapon_burst - Returns 1 if the player's weapon is in burst mode, 0 otherwise.
Syntax
cs_get_weapon_burst ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_get_weapon_id
Cstrike (cstrike.inc)
Description
cs_get_weapon_id - Get weapon type.
Syntax
cs_get_weapon_id ( index )
Type
Native
Notes
index is a weapon index correpsonding to the CSW_* constants in amxconst.inc.


cs_get_weapon_silen
Cstrike (cstrike.inc)
Description
cs_get_weapon_silen - Returns 1if a player's weapon is silenced, 0 otherwise.
Syntax
cs_get_weapon_silen ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_reset_user_model
Cstrike (cstrike.inc)
Description
cs_reset_user_model - Reset a player's model.
Syntax
cs_reset_user_model ( index )
Type
Native
Notes
index is a player index from 1 to 32.


cs_set_hostage_foll
Cstrike (cstrike.inc)
Description
cs_set_hostage_foll - Sets what a hostage follows.
Syntax
cs_set_hostage_foll ( index, [ entity ] )
Type
Native
Notes
index is a hostage entity index.

If the entity index is set to 0 (default), the hostage will stop following anything.
User Contributed Notes
downtown1 at gmail dot com Jul-05-04 22:07:31
As always hostages must be following a CT entity to be rescued. i.e. Try, as a Terrorist (in an old CS version or using the Terrorist/Hostage plugin), to get the hostage to come with you to the rescue point (it will not get rescued). Likewise, a hostage standing in a rescue point will only be rescued AFTER it is activated by a CT (cs_moria).

Freeecode at hotmail dot com Jun-24-04 20:36:07
So if i set it to follow the rescue point then it will go to rescue point and be rescued by who??


cs_set_no_knives
Cstrike (cstrike.inc)
Description
cs_set_no_knives - Sets whether or not no knives mode is enabled.
Syntax
cs_set_no_knives ( [ noknives = 0 ] )
Type
Native
Notes
Enable no knives mode by calling this with a value of 1. Disable it with a value of 0. No knives mode means that player will not be given a knife when spawning. You can still give knives (ie: through the Fun Module's give_item).


cs_set_user_bpammo
Cstrike (cstrike.inc)
Description
cs_set_user_bpammo - Restock/remove ammo in a user's backpack for a specific weapon.
Syntax
cs_set_user_bpammo ( index, weapon, amount )
Type
Native
Notes
index is a player index from 1 to 32.


cs_set_user_deaths
Cstrike (cstrike.inc)
Description
cs_set_user_deaths - Sets a user's deaths
Syntax
cs_set_user_deaths ( index, deaths )
Type
Native
Notes
index is a player index from 1 to 32.

This is the CS version of set_user_deaths.


cs_set_user_defuse
Cstrike (cstrike.inc)
Description
cs_set_user_defuse - Sets whether a user has the defusekit.
Syntax
cs_set_user_defuse ( index, [ defusekit = 1, r = 0, g = 160, b = 0, icon[] = "defuser", flash = 0 ] )
Type
Native
Notes
If defusekit is 1, the user will have a defuse kit.

You can specify the status icon. Default is "defuser". Flash (defaults to 0) can be set to flash the item red.

You can also specify the status icon color (defaults to green, r=0, g=160, b=0).


cs_set_user_model
Cstrike (cstrike.inc)
Description
cs_set_user_model - Sets a player's model (CS only).
Syntax
cs_set_user_model ( index, const model[] )
Type
Native
Notes
index is a player index from 1 to 32.

model is set as "gign" or "leet", for example, NOT "models/player/gign/gign.mdl".
User Contributed Notes
mattemarklund at msn dot com Feb-18-05 18:53:41
how do I change model for someone who types f.e. /gign to a CT>gign model? I've tried everything, it just says "No such command" or something, when I remove cs_set_user_model(id,"gign") the command works again, and my includes are: amxmisc, amxmodx, fun, engine


cs_set_user_money
Cstrike (cstrike.inc)
Description
cs_set_user_money - Sets a user's money count.
Syntax
cs_set_user_money ( index , money, [ flash = 1] )
Type
Native
Notes
index is a player index from 1 to 32.

If flash is set to 0, the difference between the old and new money will NOT flash.
User Contributed Notes
scream_tfc at hotmail dot com Mar-15-05 18:17:48
I need this Module for Half-life server because this unknown admin_allinone. bad load Load fails: Plugin uses an unknown function (name "cs_set_user_money") - check your modules.ini. (plugin "admin_allinone.amxx")

scream_tfc at hotmailc,om Mar-15-05 18:17:19
I need this Module for Half-life server because this unknown admin_allinone. bad load Load fails: Plugin uses an unknown function (name "cs_set_user_money") - check your modules.ini. (plugin "admin_allinone.amxx")

Chineseman55 at Yahoo dot com Dec-11-04 04:42:58
it says when i try tp put a plugin like respawn in my server it says i need something like cs_set_user_money how and where do i get it!

Freeecode at hotmail dot com Jun-24-04 20:34:20
Note that if you set above $16,000 it will not show it.


cs_set_user_nvg
Cstrike (cstrike.inc)
Description
cs_set_user_nvg - Sets whether a user has night vision goggles.
Syntax
cs_set_user_nvg ( index, [ nvgoggles = 1] )
Type
Native
Notes
index is a player index from 1 to 32.


cs_set_user_plant
Cstrike (cstrike.inc)
Description
cs_set_user_plant - Sets whether a player can plant the bomb.
Syntax
cs_set_user_plant ( index, [ plant = 1, showbombicon = 1 ] )
Type
Native
Notes
This will only work if the player is at a bomb site and has the bomb. You should use this if you give a player weapon_c4 manually.

If showbombicon is 1, the green C4 icon will be shown on the user's HUD.


cs_set_user_team
Cstrike (cstrike.inc)
Description
cs_set_user_team - Sets a CS player's team without killing the player.
Syntax
cs_set_user_team ( index, CsTeams:team, [ CsInternalModel: model = CS_DONTCHANGE ] )
Type
Native
Notes
index is a player index from 1 to 32.

Team values are CS_TEAM_T, CS_TEAM_CT, or CS_TEAM_SPECTATOR.

You can optionally set a model:
CS_DONTCHANGE
CS_CT_URBAN
CS_T_TERROR
CS_T_LEET
CS_T_ARCTIC
CS_CT_GSG9
CS_CT_GIGN
CS_CT_SAS
CS_T_GUERILLA
CS_CT_VIP


cs_set_user_tked
Cstrike (cstrike.inc)
Description
cs_set_user_tked - Sets whether or not specified user has TKed (team killed).
Syntax
cs_set_user_tked ( index, [ tk = 1, subtract = 1 ] )
Type
Native
Notes
If tk is 1 then player has tked, otherwise not.

Set subtract to how many frags to subtract. Set subtract to a negative value to add frags.


cs_set_user_vip
Cstrike (cstrike.inc)
Description
cs_set_user_vip - Sets whether a user is the VIP.
Syntax
cs_set_user_vip ( index, [ vip = 1] )
Type
Native
Notes
index is a player index from 1 to 32.

The model will be changed to VIP model if 1, else it will be changed to a random CT model.

This shouldn't be used for players on teams other than CT.

This is mostly useful for unsetting vips, so they can change teams and/or buy items properly. It does not alter game play; the one being VIP at start of round will retain internal status as VIP; terrorists can terminate him and accomplish their objective, etc.


cs_set_weapon_ammo
Cstrike (cstrike.inc)
Description
cs_set_weapon_ammo - Sets the amount of ammo in a player's weapon clip.
Syntax
cs_set_weapon_ammo ( index, newammo )
Type
Native
Notes
index is a player index from 1 to 32.
User Contributed Notes
Freecode Sep-25-04 13:14:59
The index in this instance is the index of the weapon not the person holding the weapon. So you must find the weapons index before using this native.


cs_set_weapon_burst
Cstrike (cstrike.inc)
Description
cs_set_weapon_burst - Sets whether the player's weapon is in burst mode.
Syntax
cs_set_weapon_burst ( index, [ burstmode = 1 ] )
Type
Native
Notes
This only works on the Glock or FAMAS.


cs_set_weapon_silen
Cstrike (cstrike.inc)
Description
cs_set_weapon_silen - Sets whether a player's weapon is silenced or not.
Syntax
cs_set_weapon_silen ( index, [ silence = 1 ] )
Type
Native
Notes
This only works on the USP or M4A1.


cs_user_spawn
Cstrike (cstrike.inc)
Description
cs_user_spawn - Spawns a player. EXPERIMENTAL
Syntax
cs_user_spawn ( player )
Type
Native
Notes


DoDFun
Content:
  • Notes
  • Functions
Notes
The Day of Defeat Fun module (DoDFun) was developed by SidLuke. It will add more DoD Only natives. This module is very similar to Cstrike module. It isn't "steamupdateproof", so always make sure you are using the latest version.
  • dodfun.inc (Day of Defeat Fun natives)
Functions
dod_get_next_class - Returns next player class.
dod_get_pl_deaths - Returns player deaths.
dod_get_pl_teamname - Gets player team name.
dod_get_user_ammo - Returns the amount of ammo in a player's backpack for a specific weapon
dod_get_user_kills - Returns player kills.
dod_is_deployed - Returns 1 is player weapon is deployed (bar,mg..)
dod_is_randomclass - Returns 1 if player has chosen random class.
dod_set_fuse - Sets fuses for grenades
dod_set_pl_deaths - Sets player deaths.
dod_set_pl_teamname - Sets new team name for a player.
dod_set_stamina - Sets a player's stamina
dod_set_user_ammo - Restock/remove ammo in a user's backpack for a specific weapon.
dod_set_user_class - Sets a player's class.
dod_set_user_kills - Sets player kills.
dod_set_user_score - Sets player score.
dod_set_user_team - Sets player team and random class
grenade_throw - Called when a grenade is thrown


dod_get_next_class
DoDFun (dodfun.inc)
Description
dod_get_next_class - Returns next player class.
Syntax
dod_get_next_class ( index )
Type
Native
Notes
This is useful for when a player is using random class. See dodconst.inc for a list of DODC_* class indexes.


dod_get_pl_deaths
DoDFun (dodfun.inc)
Description
dod_get_pl_deaths - Returns player deaths.
Syntax
dod_get_pl_deaths ( index )
Type
Native


dod_get_pl_teamname
DoDFun (dodfun.inc)
Description
dod_get_pl_teamname - Gets player team name.
Syntax
dod_get_pl_teamname ( index, szName[], len )
Type
Native


dod_get_user_ammo
DoDFun (dodfun.inc)
Description
dod_get_user_ammo - Returns the amount of ammo in a player's backpack for a specific weapon
Syntax
dod_get_user_ammo ( index, wid )
Type
Native
Notes
See dodconst.inc for a list of DODW_* indexes.


dod_get_user_kills
DoDFun (dodfun.inc)
Description
dod_get_user_kills - Returns player kills.
Syntax
dod_get_user_kills ( index )
Type
Native


dod_is_deployed
DoDFun (dodfun.inc)
Description
dod_is_deployed - Returns 1 is player weapon is deployed (bar,mg..)
Syntax
dod_is_deployed ( index )
Type
Native


dod_is_randomclass
DoDFun (dodfun.inc)
Description
dod_is_randomclass - Returns 1 if player has chosen random class.
Syntax
dod_is_randomclass ( index )
Type
Native


dod_set_fuse
DoDFun (dodfun.inc)
Description
dod_set_fuse - Sets fuses for grenades
Syntax
dod_set_fuse ( index, set = FUSE_SET, Float:newFuse = 5.0, Type = FT_NEW )
Type
Native
Notes
Valid newFuse number is from 0.1-20.0. Types: new or preprimed (FT_NEW, FT_OLD).


dod_set_pl_deaths
DoDFun (dodfun.inc)
Description
dod_set_pl_deaths - Sets player deaths.
Syntax
dod_set_pl_deaths ( index, value, [ refresh = 1 ] )
Type
Native
Notes
If refresh is set to 0, scoreboard won't be updated.


dod_set_pl_teamname
DoDFun (dodfun.inc)
Description
dod_set_pl_teamname - Sets new team name for a player.
Syntax
dod_set_pl_teamname ( index, szName[] )
Type
Native


dod_set_stamina
DoDFun (dodfun.inc)
Description
dod_set_stamina - Sets a player's stamina
Syntax
dod_set_stamina ( player, set = STAMINA_SET, minvalue = 0, maxvalue = 100 )
Type
Native
Notes
Example: for full stamina use dod_set_stamina(1,STAMINA_SET,100,100)

Value is from 0 - 100


dod_set_user_ammo
DoDFun (dodfun.inc)
Description
dod_set_user_ammo - Restock/remove ammo in a user's backpack for a specific weapon.
Syntax
dod_set_user_ammo ( index, wid, value )
Type
Native
Notes
See dodconst.inc for a list of DODW_* indexes.


dod_set_user_class
DoDFun (dodfun.inc)
Description
dod_set_user_class - Sets a player's class.
Syntax
dod_set_user_class ( index, classId )
Type
Native
Notes
See dodconst.inc for a list of DODC_* class indexes.


dod_set_user_kills
DoDFun (dodfun.inc)
Description
dod_set_user_kills - Sets player kills.
Syntax
dod_set_user_kills ( index, value, [ refresh = 1 ] )
Type
Native
Notes
If refresh is set to 0, scoreboard won't be updated.


dod_set_user_score
DoDFun (dodfun.inc)
Description
dod_set_user_score - Sets player score.
Syntax
dod_set_user_score ( index, value, [ refresh = 1 ] )
Type
Native
Notes
If refresh is set to 0, scoreboard won't be updated.


dod_set_user_team
DoDFun (dodfun.inc)
Description
dod_set_user_team - Sets player team and random class
Syntax
dod_set_user_team ( index, teamId, [ refresh = 1 ] )
Type
Native
Notes
This does not work for spectators.

If refresh is set to 0, scoreboard won't be updated.


grenade_throw
DoDFun (dodfun.inc)
Description
grenade_throw - Called when a grenade is thrown
Syntax
grenade_throw ( index,greindex,wId )
Type
Forward
Notes
index is the index of the player that threw the grenade. greindex is the entity index of the grenade thrown. wId is the weapon index of the grenade. See dodconst.inc for a list of DODW_* indexes.


DoDX
Content:
  • Notes
  • Functions
Notes
The Day of Defeat module (DoDX) was developed by SidLuke, originally ported from his earlier AMX Mod module. It has two main portions, generic Day of Defeat natives and a Day of Defeat statistical package.
  • dodx.inc (Day of Defeat natives)
  • dodstats.inc (Day of Defeat statistical natives)
  • dodconst.inc (Day of Defeat constants)
DoDX contains the following constants:
  • Team Constants
  • Class Constants
  • Stamina Constants
  • Fuse Constants
  • Weapon Constants
  • Prone Constants
  • Map Constants
Team Constants
#define ALLIES			1
#define AXIS 			2

Class Constants
enum {
    DODC_GARAND = 1,
    DODC_CARBINE,
    DODC_THOMPSON,
    DODC_GREASE,
    DODC_SNIPER,
    DODC_BAR,
    DODC_30CAL,
    DODC_BAZOOKA,
    //DODC_ALLIES_MORTAR,
    DODC_KAR = 10,
    DODC_K43,
    DODC_MP40,
    DODC_MP44,
    DODC_SCHARFSCHUTZE,
    DODC_FG42,
    DODC_SCOPED_FG42,
    DODC_MG34,
    DODC_MG42,
    DODC_PANZERJAGER,
    //DODC_AXIS_MORTAR,
    DODC_ENFIELD = 21,
    DODC_STEN,
    DODC_MARKSMAN,
    DODC_BREN,
    DODC_PIAT,
    //DODC_BRIT_MORTAR,
};

Stamina Constants
#define STAMINA_SET		0
#define STAMINA_RESET		1

Fuse Constants
#define FT_NEW			1<<0
#define FT_OLD			1<<1
#define FUSE_SET			0
#define FUSE_RESET			1

Weapon Constants
#define DODMAX_WEAPONS		46 // 5 slots for custom weapons
enum {
    DODW_AMERKNIFE = 1,
    DODW_GERKNIFE,
    DODW_COLT,
    DODW_LUGER,
    DODW_GARAND,
    DODW_SCOPED_KAR,
    DODW_THOMPSON,
    DODW_STG44,
    DODW_SPRINGFIELD,
    DODW_KAR,
    DODW_BAR,
    DODW_MP40,
    DODW_HANDGRENADE,
    DODW_STICKGRENADE,
    DODW_STICKGRENADE_EX,
    DODW_HANDGRENADE_EX,
    DODW_MG42,
    DODW_30_CAL,
    DODW_SPADE,
    DODW_M1_CARBINE,
    DODW_MG34,
    DODW_GREASEGUN,
    DODW_FG42,
    DODW_K43,
    DODW_ENFIELD,
    DODW_STEN,
    DODW_BREN,
    DODW_WEBLEY,
    DODW_BAZOOKA,
    DODW_PANZERSCHRECK,
    DODW_PIAT,
    DODW_SCOPED_FG42,
    DODW_FOLDING_CARBINE,
    DODW_KAR_BAYONET,
    DODW_SCOPED_ENFIELD,
    DODW_MILLS_BOMB,
    DODW_BRITKNIFE,
    DODW_GARAND_BUTT,
    DODW_ENFIELD_BAYONET,
    DODW_MORTAR,
    DODW_K43_BUTT,
};

Prone Constants
enum {
    PS_NOPRONE =0,
    PS_PRONE,
    PS_PRONEDEPLOY,
}

Map Constants
enum {
    MI_ALLIES_TEAM = 0,
    MI_ALLIES_PARAS,
    MI_AXIS_PARAS,
}

Functions
client_damage - Function is called after player to player attacks
client_death - Called when a player dies.
custom_weapon_add - Custom weapon support.
custom_weapon_dmg - Custom weapon support.
custom_weapon_shot - Custom weapon support.
dod_get_map_info - Returns map information.
dod_get_pronestate - Returns a user's prone state.
dod_get_team_score - Returns a team's score.
dod_get_user_class - Returns a player's class id.
dod_get_user_score - Returns a player's score.
dod_get_user_team - DEPRECATED. Returns a player's team id.
dod_get_user_weapon - Returns id of a player's currently carried weapon.
dod_user_kill - Kills a player without taking deaths.
dod_wpnlog_to_id - Gets the id of a logged weapon name.
dod_wpnlog_to_name - Converts a weapon's logname to normal name.
get_stats - Gets overall stats.
get_statsnum - Returns number of all entries in stats.
get_user_astats - Gets stats with which a player has been killed/hurt.
get_user_lstats - Gets life (from spawn to spawn) stats of player.
get_user_rstats - Gets life (from spawn to spawn) stats of player.
get_user_stats - Gets overall stats.
get_user_vstats - Gets stats with which the player has killed/hurt a victim.
get_user_wlstats - Gets life (from spawn to spawn) stats from given weapon index.
get_user_wrstats - Gets round stats from given weapon index.
get_user_wstats - Gets stats from given weapon index.
grenade_throw - This function is now in DoDFun module
register_statsfwd - Use this function to register forwards
reset_user_wstats - Resets life, weapon, victims and attackers user stats.
xmod_get_maxweapons -
xmod_get_stats_size - Returns stats array size
xmod_get_wpnlogname - Gets a weapon's logged name.
xmod_get_wpnname - Gets the name of a weapon.
xmod_is_custom_wpn - Returns 1 if true
xmod_is_melee_wpn - is this a melee weapon ?
zdod_get_next_class - DEPRECATED. Returns next player class.
zdod_get_pl_deaths - DEPRECATED. Returns player deaths.
zdod_is_randomclass - DEPRECATED. Returns 1 if player has chosen random class.
zdod_set_fuse - DEPRECATED. Sets fuses for grenades.
zdod_set_pl_deaths - DEPRECATED. Sets player deaths.
zdod_set_pl_teamname - DEPRECATED. Sets new team name for a player.
zdod_set_stamina - DEPRECATED. Sets a player's stamina.
zdod_set_user_class - DEPRECATED. Sets a player's class.
zdod_set_user_score - DEPRECATED. Sets player score.
zdod_set_user_team - DEPRECATED. Sets player team and random class.


client_damage
DoDX (dodx.inc)
Description
client_damage - Function is called after player to player attacks
Syntax
client_damage ( attacker, victim, damage, wpnindex, hitplace, TA )
Type
Forward
Notes
You must register this forward first. Use register_statsfwd function.
If players were damaged by teammate then TA is set to 1.


client_death
DoDX (dodx.inc)
Description
client_death - Called when a player dies.
Syntax
client_death ( killer, victim, wpnindex, hitplace, TK )
Type
Native
Notes
You must register this forward first. Use register_statsfwd function.
If player was killed by teammate then TK is set to 1.


custom_weapon_add
DoDX (dodx.inc)
Description
custom_weapon_add - Custom weapon support.
Syntax
custom_weapon_add ( name[], melee=0,logname[] )
Type
Native
Notes


custom_weapon_dmg
DoDX (dodx.inc)
Description
custom_weapon_dmg - Custom weapon support.
Syntax
custom_weapon_dmg ( weapon, attacker, victim, damage, hitplace=0 )
Type
Native
Notes


custom_weapon_shot
DoDX (dodx.inc)
Description
custom_weapon_shot - Custom weapon support.
Syntax
custom_weapon_shot ( weapon,player )
Type
Native
Notes


dod_get_map_info
DoDX (dodx.inc)
Description
dod_get_map_info - Returns map information.
Syntax
dod_get_map_info ( info )
Type
Native
Notes
Refer to the MI_* constants in dodconst.inc for return values.


dod_get_pronestate
DoDX (dodx.inc)
Description
dod_get_pronestate - Returns a user's prone state.
Syntax
dod_get_pronestate ( player )
Type
Native
Notes
Values are:

0 (PS_NOPRONE): Not prone
1 (PS_PRONE): Prone
2 (PS_PRONEDEPLOY): Prone and weapon deployed


dod_get_team_score
DoDX (dodx.inc)
Description
dod_get_team_score - Returns a team's score.
Syntax
dod_get_team_score ( teamId )
Type
Native


dod_get_user_class
DoDX (dodx.inc)
Description
dod_get_user_class - Returns a player's class id.
Syntax
dod_get_user_class ( index )
Type
Native
Notes
Refer to the DODC_* natives in dodconst.inc for class indexes.


dod_get_user_score
DoDX (dodx.inc)
Description
dod_get_user_score - Returns a player's score.
Syntax
dod_get_user_score ( index )
Type
Native


dod_get_user_team
DoDX (dodx.inc)
Description
dod_get_user_team - DEPRECATED. Returns a player's team id.
Syntax
dod_get_user_team ( player )
Type
Native
Notes
This native is DEPRECATED and no longer available for use.


dod_get_user_weapon
DoDX (dodx.inc)
Description
dod_get_user_weapon - Returns id of a player's currently carried weapon.
Syntax
dod_get_user_weapon ( index, &clip, &ammo )
Type
Native
Notes
This acts the same as get_user_weapon for CS, but actually works for Day of Defeat.


dod_user_kill
DoDX (dodx.inc)
Description
dod_user_kill - Kills a player without taking deaths.
Syntax
dod_user_kill ( player )
Type
Native


dod_wpnlog_to_id
DoDX (dodx.inc)
Description
dod_wpnlog_to_id - Gets the id of a logged weapon name.
Syntax
dod_wpnlog_to_id ( logname[] )
Type
Native


dod_wpnlog_to_name
DoDX (dodx.inc)
Description
dod_wpnlog_to_name - Converts a weapon's logname to normal name.
Syntax
dod_wpnlog_to_name ( logname[], name[], len )
Type
Native


get_stats
DoDX (dodstats.inc)
Description
get_stats - Gets overall stats.
Syntax
get_stats ( player, stats[9], bodyhits[8], name[], len )
Type
Native
Notes
Gets overall stats which stored in stats.dat file in amxx folder and updated on every mapchange or user disconnect. Function returns next index of stats entry or 0 if no more exists.


get_statsnum
DoDX (dodstats.inc)
Description
get_statsnum - Returns number of all entries in stats.
Syntax
get_statsnum ( )
Type
Native


get_user_astats
DoDX (dodstats.inc)
Description
get_user_astats - Gets stats with which a player has been killed/hurt.
Syntax
get_user_astats ( player, wpnindex, stats[9], bodyhits[8], [ wpnname, maxLength ] )
Type
Native
Notes
Gets stats with which user have been killed/hurt. If killer is 0 then stats are from all attacks. If killer has not hurt user, function returns 0 in other case 1. User stats are reset on his respawn.


get_user_lstats
DoDX (dodstats.inc)
Description
get_user_lstats - Gets life (from spawn to spawn) stats of player.
Syntax
get_user_lstats ( player, stats[9], bodyhits[8] )
Type
Native


get_user_rstats
DoDX (dodstats.inc)
Description
get_user_rstats - Gets life (from spawn to spawn) stats of player.
Syntax
get_user_rstats ( player, stats[9], bodyhits[8] )
Type
Native
Notes


get_user_stats
DoDX (dodstats.inc)
Description
get_user_stats - Gets overall stats.
Syntax
get_user_stats ( index, stats[9], bodyhits[8] )
Type
Native
Notes
Gets overall stats which are stored in file on server and updated on every respawn or user disconnect. Function returns the position in stats by diff. kills to deaths.


get_user_vstats
DoDX (dodstats.inc)
Description
get_user_vstats - Gets stats with which the player has killed/hurt a victim.
Syntax
get_user_vstats ( player, victim, stats[9], bodyhits[8], [ wpnname[], maxLen ] )
Type
Native
Notes
Gets stats with which user have killed/hurt his victim. If victim is 0 then stats are from all victims. If victim has not been hurt, function returns 0 in other case 1. User stats are reset on his respawn.


get_user_wlstats
DoDX (dodstats.inc)
Description
get_user_wlstats - Gets life (from spawn to spawn) stats from given weapon index.
Syntax
get_user_wlstats ( player, wpnindex, stats[9], bodyhits[8] )
Type
Native
Notes
See get_user_wstats for more information.


get_user_wrstats
DoDX (dodstats.inc)
Description
get_user_wrstats - Gets round stats from given weapon index.
Syntax
get_user_wrstats ( player, wpnindex, stats[9], bodyhits[8] )
Type
Native
Notes
See get_user_wstats for more information.


get_user_wstats
DoDX (dodstats.inc)
Description
get_user_wstats - Gets stats from given weapon index.
Syntax
get_user_wstats ( player, wpnindex, stats[9], bodyhits[8] )
Type
Native
Notes
If wpnindex is 0 then the stats are from all weapons. If weapon has not been used function returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* 7 - score
For body hits fields see amxconst.inc.


grenade_throw
DoDX (dodx.inc)
Description
grenade_throw - This function is now in DoDFun module
Syntax
grenade_throw ( index, greindex, wId )
Type
Forward
Notes


register_statsfwd
DoDX (dodx.inc)
Description
register_statsfwd - Use this function to register forwards
Syntax
register_statsfwd ( forward_index )
Type
Native
Notes
For forwards list check dodx.inc file
example :

public plugin_init() {
...
register_statsfwd(XMF_DAMAGE)
...
}

This will register client_damage(...) forward


reset_user_wstats
DoDX (dodstats.inc)
Description
reset_user_wstats - Resets life, weapon, victims and attackers user stats.
Syntax
reset_user_wstats ( player )
Type
Native


xmod_get_maxweapons
DoDX (dodx.inc)
Description
xmod_get_maxweapons -
Syntax
xmod_get_maxweapons ( )
Type
Native


xmod_get_stats_size
DoDX (dodx.inc)
Description
xmod_get_stats_size - Returns stats array size
Syntax
xmod_get_stats_size ( )
Type
Native
Notes
9 at the moment but this may change in the future


xmod_get_wpnlogname
DoDX (dodx.inc)
Description
xmod_get_wpnlogname - Gets a weapon's logged name.
Syntax
xmod_get_wpnlogname ( wpnindex, name[], len )
Type
Native
Notes


xmod_get_wpnname
DoDX (dodx.inc)
Description
xmod_get_wpnname - Gets the name of a weapon.
Syntax
xmod_get_wpnname ( wpnindex, name[], len )
Type
Native
Notes


xmod_is_custom_wpn
DoDX (dodx.inc)
Description
xmod_is_custom_wpn - Returns 1 if true
Syntax
xmod_is_custom_wpn ( wpnindex )
Type
Native


xmod_is_melee_wpn
DoDX (dodx.inc)
Description
xmod_is_melee_wpn - is this a melee weapon ?
Syntax
xmod_is_melee_wpn ( wpnindex )
Type
Native
Notes
Returns 1 if true.


zdod_get_next_class
DoDX (dodx.inc)
Description
zdod_get_next_class - DEPRECATED. Returns next player class.
Syntax
zdod_get_next_class ( player )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_get_next_class instead.

Useful is player is using random class.


zdod_get_pl_deaths
DoDX (dodx.inc)
Description
zdod_get_pl_deaths - DEPRECATED. Returns player deaths.
Syntax
zdod_get_pl_deaths ( player )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_get_pl_deaths instead.


zdod_is_randomclass
DoDX (dodx.inc)
Description
zdod_is_randomclass - DEPRECATED. Returns 1 if player has chosen random class.
Syntax
zdod_is_randomclass ( player )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_is_randomclass instead.


zdod_set_fuse
DoDX (dodx.inc)
Description
zdod_set_fuse - DEPRECATED. Sets fuses for grenades.
Syntax
zdod_set_fuse ( player, [ set=FUSE_SET, float:newFuse=5.0, type=FT_NEW ] )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_set_fuse instead.

Valid number is from 0.1-20.0. Types : new or preprimed (FT_NEW, FT_OLD).


zdod_set_pl_deaths
DoDX (dodx.inc)
Description
zdod_set_pl_deaths - DEPRECATED. Sets player deaths.
Syntax
zdod_set_pl_deaths ( player, value, [ refresh=1 ] )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_set_pl_deaths instead.


zdod_set_pl_teamname
DoDX (dodx.inc)
Description
zdod_set_pl_teamname - DEPRECATED. Sets new team name for a player.
Syntax
zdod_set_pl_teamname ( player, szName[] )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_set_pl_teamname instead.


zdod_set_stamina
DoDX (dodx.inc)
Description
zdod_set_stamina - DEPRECATED. Sets a player's stamina.
Syntax
zdod_set_stamina ( player, [ set=STAMINA_SET, minvalue=0, maxvalue=100 ] )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_set_stamina instead.

Example: for full stamina use set_player_stamina(1,STAMINA_SET,100,100)

Value is from 0 - 100


zdod_set_user_class
DoDX (dodx.inc)
Description
zdod_set_user_class - DEPRECATED. Sets a player's class.
Syntax
zdod_set_user_class ( player, classId )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_set_user_class instead.
User Contributed Notes
XxAvalanchexX at hotmail dot com Jan-31-05 22:29:36
Zor's comment was posted quite a while back. We now have constants for class IDs. Check dodconst.inc for the DODC_* constants.

zor at blackwatch dot recongamer dot com Jun-27-04 19:08:33
Hey. Ok we need to have an enum for the different classID. As this would make it easier to program. Cheeers! Zor


zdod_set_user_score
DoDX (dodx.inc)
Description
zdod_set_user_score - DEPRECATED. Sets player score.
Syntax
zdod_set_user_score ( player, value, [ refresh=1 ] )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_set_user_score instead.


zdod_set_user_team
DoDX (dodx.inc)
Description
zdod_set_user_team - DEPRECATED. Sets player team and random class.
Syntax
zdod_set_user_team ( player, teamId, [ refresh=1 ] )
Type
Native
Notes
This native is DEPRECATED and no longer available for use. Use dod_set_user_team instead.

This does not work for spectators.


Engine
Content:
  • Notes
  • Functions
  • User Contributed Notes
Notes
Engine Provides functions for manipulating the Half-Life engine, such as entity property modification and creation,
as well as advanced client commands (Based on original VexD Utilities). It is maintained by BAILOPAN.

For similar, but more advanced functions, check out the FakeMeta module.

Engine has three includes: One for natives, one for constants, and one for stock helper functions.
  • engine.inc (Provides base engine natives.)
  • engine_stocks.inc (Provides base engine functions to make certain tasks easier.)
  • engine_const.inc (Contains constants related to Engine's native functions.)
The Engine module includes many constants, listed below.
  • Speech Constants
  • Camera Constants
  • Message Constants

  • Entity Integer Keys
  • Entity Float Keys
  • Entity Vector Keys
  • Entity Edict Keys
  • Entity String Keys
  • Entity Byte Keys

  • Button Constants
  • Movement Constants
  • Solid Constants
  • Contents Constants
  • Damage Constants

Constants
#define SPEAK_NORMAL		0
#define SPEAK_MUTED		1
#define SPEAK_ALL		2
#define SPEAK_LISTENALL		4

Camera Constants
#define CAMERA_NONE		0
#define CAMERA_3RDPERSON	1
#define CAMERA_UPLEFT		2
#define CAMERA_TOPDOWN		3

Message Constants
#define BLOCK_NOT		0
#define BLOCK_ONCE		1
#define BLOCK_SET		2

enum {
    ARG_BYTE = 1,			/* int */
    ARG_CHAR,			/* int */
    ARG_SHORT,			/* int */
    ARG_LONG,			/* int */
    ARG_ANGLE,			/* float */
    ARG_COORD,			/* float */
    ARG_STRING,			/* string */
    ARG_ENTITY,			/* int */
}

Entity Integer Constants
enum {
    EV_INT_gamestate = 0,
    EV_INT_oldbuttons,
    EV_INT_groupinfo,
    EV_INT_iuser1,
    EV_INT_iuser2,
    EV_INT_iuser3,
    EV_INT_iuser4,
    EV_INT_weaponanim,
    EV_INT_pushmsec,
    EV_INT_bInDuck,
    EV_INT_flTimeStepSound,
    EV_INT_flSwimTime,
    EV_INT_flDuckTime,
    EV_INT_iStepLeft,
    EV_INT_movetype,
    EV_INT_solid,
    EV_INT_skin,
    EV_INT_body,
    EV_INT_effects,
    EV_INT_light_level,
    EV_INT_sequence,
    EV_INT_gaitsequence,
    EV_INT_modelindex,
    EV_INT_playerclass,
    EV_INT_waterlevel,
    EV_INT_watertype,
    EV_INT_spawnflags,
    EV_INT_flags,
    EV_INT_colormap,
    EV_INT_team,
    EV_INT_fixangle,
    EV_INT_weapons,
    EV_INT_rendermode,
    EV_INT_renderfx,
    EV_INT_button,
    EV_INT_impulse,
    EV_INT_deadflag,
}

Entity Float Constants
enum {
    EV_FL_impacttime = 0,
    EV_FL_starttime,
    EV_FL_idealpitch,
    EV_FL_pitch_speed,
    EV_FL_ideal_yaw,
    EV_FL_yaw_speed,
    EV_FL_ltime,
    EV_FL_nextthink,
    EV_FL_gravity,
    EV_FL_friction,
    EV_FL_frame,
    EV_FL_animtime,
    EV_FL_framerate,
    EV_FL_health,
    EV_FL_frags,
    EV_FL_takedamage,
    EV_FL_max_health,
    EV_FL_teleport_time,
    EV_FL_armortype,
    EV_FL_armorvalue,
    EV_FL_dmg_take,
    EV_FL_dmg_save,
    EV_FL_dmg,
    EV_FL_dmgtime,
    EV_FL_speed,
    EV_FL_air_finished,
    EV_FL_pain_finished,
    EV_FL_radsuit_finished,
    EV_FL_scale,
    EV_FL_renderamt,
    EV_FL_maxspeed,
    EV_FL_fov,
    EV_FL_flFallVelocity,
    EV_FL_fuser1,
    EV_FL_fuser2,
    EV_FL_fuser3,
    EV_FL_fuser4,
}

Entity Vector Constants
enum {
    EV_VEC_origin = 0,
    EV_VEC_oldorigin,
    EV_VEC_velocity,
    EV_VEC_basevelocity,
    EV_VEC_clbasevelocity,
    EV_VEC_movedir,
    EV_VEC_angles,
    EV_VEC_avelocity,
    EV_VEC_punchangle,
    EV_VEC_v_angle,
    EV_VEC_endpos,
    EV_VEC_startpos,
    EV_VEC_absmin,
    EV_VEC_absmax,
    EV_VEC_mins,
    EV_VEC_maxs,
    EV_VEC_size,
    EV_VEC_rendercolor,
    EV_VEC_view_ofs,
    EV_VEC_vuser1,
    EV_VEC_vuser2,
    EV_VEC_vuser3,
    EV_VEC_vuser4,
}

Entity Edict Constants
enum {
    EV_ENT_chain = 0,
    EV_ENT_dmg_inflictor,
    EV_ENT_enemy,
    EV_ENT_aiment,
    EV_ENT_owner,
    EV_ENT_groundentity,
    EV_ENT_pContainingEntity,
    EV_ENT_euser1,
    EV_ENT_euser2,
    EV_ENT_euser3,
    EV_ENT_euser4,
}

Entity String Constants
enum {
    EV_SZ_classname = 0,
    EV_SZ_globalname,
    EV_SZ_model,
    EV_SZ_target,
    EV_SZ_targetname,
    EV_SZ_netname,
    EV_SZ_message,
    EV_SZ_noise,
    EV_SZ_noise1,
    EV_SZ_noise2,
    EV_SZ_noise3,
    EV_SZ_viewmodel,
    EV_SZ_weaponmodel,
}

Entity Byte Constants
enum {
    EV_BYTE_controller1 = 0,
    EV_BYTE_controller2,
    EV_BYTE_controller3,
    EV_BYTE_controller4,
    EV_BYTE_blending1,
    EV_BYTE_blending2,
}

Button Constants
#define IN_ATTACK		(1<<0)
#define IN_JUMP			(1<<1)
#define IN_DUCK			(1<<2)
#define IN_FORWARD		(1<<3)
#define IN_BACK			(1<<4)
#define IN_USE			(1<<5)
#define IN_CANCEL		(1<<6)
#define IN_LEFT			(1<<7)
#define IN_RIGHT		(1<<8)
#define IN_MOVELEFT		(1<<9)
#define IN_MOVERIGHT		(1<<10)
#define IN_ATTACK2		(1<<11)
#define IN_RUN			(1<<12)
#define IN_RELOAD		(1<<13)
#define IN_ALT1			(1<<14)
#define IN_SCORE		(1<<15)

Movetype Constants
#define	FL_FLY			(1<<0)		/* Changes the SV_Movestep() behavior to not need to be on ground */
#define	FL_SWIM			(1<<1)		/* Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) */
#define	FL_CONVEYOR		(1<<2)
#define	FL_CLIENT		(1<<3)
#define	FL_INWATER		(1<<4)
#define	FL_MONSTER		(1<<5)
#define	FL_GODMODE		(1<<6)
#define	FL_NOTARGET		(1<<7)
#define	FL_SKIPLOCALHOST	(1<<8)		/* Don't send entity to local host, it's predicting this entity itself */
#define	FL_ONGROUND		(1<<9)		/* At rest / on the ground */
#define	FL_PARTIALGROUND	(1<<10)		/* not all corners are valid */
#define	FL_WATERJUMP		(1<<11)		/* player jumping out of water */
#define FL_FROZEN		(1<<12) 	/* Player is frozen for 3rd person camera */
#define FL_FAKECLIENT		(1<<13)		/* JAC: fake client, simulated server side; don't send network messages to them */
#define FL_DUCKING		(1<<14)		/* Player flag -- Player is fully crouched */
#define FL_FLOAT		(1<<15)		/* Apply floating force to this entity when in water */
#define FL_GRAPHED		(1<<16)		/* worldgraph has this ent listed as something that blocks a connection */
#define FL_IMMUNE_WATER		(1<<17)
#define	FL_IMMUNE_SLIME		(1<<18)
#define FL_IMMUNE_LAVA		(1<<19)
#define FL_PROXY		(1<<20)		/* This is a spectator proxy */
#define FL_ALWAYSTHINK		(1<<21)		/* Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path) */
#define FL_BASEVELOCITY		(1<<22)		/* Base velocity has been applied this frame (used to convert base velocity into momentum) */
#define FL_MONSTERCLIP		(1<<23)		/* Only collide in with monsters who have FL_MONSTERCLIP set */
#define FL_ONTRAIN		(1<<24)		/* Player is _controlling_ a train, so movement commands should be ignored on client during prediction. */
#define FL_WORLDBRUSH		(1<<25)		/* Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something) */
#define FL_SPECTATOR		(1<<26) 	/* This client is a spectator, don't run touch functions, etc. */
#define FL_CUSTOMENTITY		(1<<29)		/* This is a custom entity */
#define FL_KILLME		(1<<30)		/* This entity is marked for death -- This allows the engine to kill ents at the appropriate time */
#define FL_DORMANT		(1<<31)		/* Entity is dormant, no updates to client */
#define	MOVETYPE_NONE		0		/* never moves */
#define MOVETYPE_ANGLENOCLIP	1
#define MOVETYPE_ANGLECLIP	2
#define	MOVETYPE_WALK		3		/* Player only - moving on the ground */
#define	MOVETYPE_STEP		4		/* gravity, special edge handling -- monsters use this */
#define	MOVETYPE_FLY		5		/* No gravity, but still collides with stuff */
#define	MOVETYPE_TOSS		6		/* gravity/collisions */
#define	MOVETYPE_PUSH		7		/* no clip to world, push and crush */
#define	MOVETYPE_NOCLIP		8		/* No gravity, no collisions, still do velocity/avelocity */
#define	MOVETYPE_FLYMISSILE	9		/* extra size to monsters */
#define	MOVETYPE_BOUNCE		10		/* Just like Toss, but reflect velocity when contacting surfaces */
#define MOVETYPE_BOUNCEMISSILE	11		/* bounce w/o gravity */
#define MOVETYPE_FOLLOW		12		/* track movement of aiment */
#define	MOVETYPE_PUSHSTEP	13		/* BSP model that needs physics/world collisions (uses nearest hull for world collision) */

Solid Constants
#define	SOLID_NOT		0		/* no interaction with other objects */
#define	SOLID_TRIGGER		1		/* touch on edge, but not blocking */
#define	SOLID_BBOX		2		/* touch on edge, block */
#define	SOLID_SLIDEBOX		3		/* touch on edge, but not an onground */
#define	SOLID_BSP		4		/* bsp clip, touch on edge, block */

Contents Constants
#define	CONTENTS_EMPTY		-1
#define	CONTENTS_SOLID		-2
#define	CONTENTS_WATER		-3
#define	CONTENTS_SLIME		-4
#define	CONTENTS_LAVA		-5
#define	CONTENTS_SKY		-6
#define	CONTENTS_ORIGIN		-7		/* removed at csg time */
#define	CONTENTS_CLIP		-8		/* changed to contents_solid */
#define	CONTENTS_CURRENT_0	-9
#define	CONTENTS_CURRENT_90	-10
#define	CONTENTS_CURRENT_180	-11
#define	CONTENTS_CURRENT_270	-12
#define	CONTENTS_CURRENT_UP	-13
#define	CONTENTS_CURRENT_DOWN	-14
#define CONTENTS_TRANSLUCENT	-15
#define	CONTENTS_LADDER		-16

Damage Constants
#define DMG_GENERIC		0		/* generic damage was done */
#define DMG_CRUSH		(1<<0)		/* crushed by falling or moving object */
#define DMG_BULLET		(1<<1)		/* shot */
#define DMG_SLASH		(1<<2)		/* cut, clawed, stabbed */
#define DMG_BURN		(1<<3)		/* heat burned */
#define DMG_FREEZE		(1<<4)		/* frozen */
#define DMG_FALL		(1<<5)		/* fell too far */
#define DMG_BLAST		(1<<6)		/* explosive blast damage */
#define DMG_CLUB		(1<<7)		/* crowbar, punch, headbutt */
#define DMG_SHOCK		(1<<8)		/* electric shock */
#define DMG_SONIC		(1<<9)		/* sound pulse shockwave */
#define DMG_ENERGYBEAM		(1<<10)		/* laser or other high energy beam */
#define DMG_NEVERGIB		(1<<12)		/* with this bit OR'd in, no damage type will be able to gib victims upon death */
#define DMG_ALWAYSGIB		(1<<13)		/* with this bit OR'd in, any damage type can be made to gib victims upon death */
#define DMG_DROWN		(1<<14)		/* Drowning */
/* time-based damage */
#define DMG_TIMEBASED		(~(0x3fff))	/* mask for time-based damage */
/* TF Additions */
#define DMG_PARALYZE		(1<<15)		/* slows affected creature down */
#define DMG_NERVEGAS		(1<<16)		/* nerve toxins, very bad */
#define DMG_POISON		(1<<17)		/* blood poisioning */
#define DMG_RADIATION		(1<<18)		/* radiation exposure */
#define DMG_DROWNRECOVER	(1<<19)		/* drowning recovery */
#define DMG_ACID		(1<<20)		/* toxic chemicals or acid burns */
#define DMG_SLOWBURN		(1<<21)		/* in an oven */
#define DMG_SLOWFREEZE		(1<<22)		/* in a subzero freezer */
#define DMG_MORTAR		(1<<23)		/* Hit by air raid (done to distinguish grenade from mortar) */
Functions
anglevector - Engine function, ANGLEVECTOR.
attach_view - Sets a player's view to a new entity.
call_think - Calls MDLL_Think() on an entity.
client_impulse - Forward for impulses.
client_kill - Called when a client types kill in the console.
client_PostThink - Forward for PostThink() on a player.
client_PreThink - Forward for PreThink() on a player.
copy_keyvalue - Copies keyvalues set during the keyvalue() forward
create_entity - Creates a new entity and returns its index.
DispatchKeyValue - Dispatches a key/value pair, used for initializing entities on spawn.
DispatchSpawn - This is the same as call_think.
drop_to_floor - Drops an entity to the floor.
entity_count - Returns the number of entities in the world.
entity_get_byte - Returns a byte from an entity's structure.
entity_get_edict - Returns the entity index of an entity's structure key.
entity_get_float - Returns a float from an entity's structure.
entity_get_int - Returns an integer from an entity's structure.
entity_get_string - Gets a string from an entity's structure.
entity_get_vector - Gets a vector from an entity's structure.
entity_range - Returns the distance between two entities.
entity_set_byte - Sets a byte on an entity's structure.
entity_set_edict - Sets an edict value on an entity's structure.
entity_set_float - Sets a float value on an entity's structure.
entity_set_int - Sets an integer value on an entity's structure.
entity_set_model - Properly sets a new model on an entity.
entity_set_origin - Properly sets a new origin on an entity.
entity_set_size - Sets the bounds of an entity.
entity_set_string - Sets a string on an entity's structure.
entity_set_vector - Sets a vector on an entity's structure.
fakedamage - Fakes damage on a target.
fake_touch - Simulates two entities colliding/touching.
find_ent_by_class - Finds an entity in the world, returning the index.
find_ent_by_model - Finds an entity in the world by class and model, returning the index.
find_ent_by_owner - Finds an entity in the world by owner, returning the index.
find_ent_by_target - Finds an entity in the world by target, returning the index.
find_ent_by_tname - Finds an entity in the world by target name, returning the index.
find_ent_in_sphere - Finds an entity in the world in a sphere, returning the index.
find_sphere_class - Returns the number of ents stored in entlist
force_use - Forces an entity to use another entity.
FVecIVec - Changes a float vector to an integer vector.
get_brush_entity_origin - Gets the origin of a brush entity.
get_decal_index - Returns a decal index from a decal name.
get_entity_distance - Returns the distance between two entities.
get_entity_flags - Returns the flags an entity is flagged with.
get_entity_visibility - Returns 1 if an entity is visible.
get_global_edict - Gets a global variable from the server as an entity index.
get_global_float - Gets a global variable from the server as a float.
get_global_int - Gets a global variable from the server as an integer.
get_global_string - Gets a global variable from the server as a string.
get_global_vector - Gets a global variable from the server as a vector.
get_grenade - Gets the grenade is thrown by a user.
get_grenade_id - Gets the ID of a grenade.
get_info_keybuffer - Gets whole buffer containing keys and their data.
get_keyvalue - Retrieves a value from a key/val pair on an entity.
get_msg_args - Returns the number of arguments passed to the current message.
get_msg_argtype - Returns the type of an message's argument.
get_msg_arg_float - Returns the value of an argument in a message as a float.
get_msg_arg_int - Returns the value of an argument in a message.
get_msg_arg_string - Returns a string from a message argument.
get_msg_block - Returns the block flag on a message.
get_msg_origin - Sets the origin of the current message.
get_speak - Get a player's speak flags.
get_speed - Returns the speed of an entity's velocity.
get_usercmd - Gets parameters sent from CmdStart.
get_user_button - Gets the button(s) a user is pressing.
get_user_oldbutton - Gets the oldbutton(s) a user is pressing.
get_user_velocity - Gets a user's velocity.
halflife_time - Returns the gpGlobal time from Half-Life
is_in_viewcone - Checks if an origin is in an entity's viewcone
is_valid_ent - Returns 1 if an entity index is valid for operation, 0 otherwise.
is_visible - Checks if a target entity is visible to an entity
IVecFVec - Changes an integer vector to a float vector.
make_deathmsg - Creates a death message.
pfn_spawn - Called when an entity is spawned.
pfn_think - Called when an entity thinks with DispatchThink().
pfn_touch - Called when two entities touch/collide.
pfn_use - DEPRECATED. Called when an object uses another object.
PlaybackEvent - Forwarded on an event playback.
playback_event - PLAYBACK_EVENT_FULL from HLSDK.
PointContents - Will return the contents of a point (inside map? in sky? outside map? etc.).
precache_event - Precaches an event.
precache_generic - Precaches a generic file.
RadiusDamage - Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage.
register_impulse - Registers a client impulse to a function.
register_message - Hooks a message to a single function.
register_think - Registers a think action to a function.
register_touch - Registers a touch action to a function.
remove_entity - Removes an entity from the world.
remove_entity_name - Removes an entity by name.
server_changelevel - Forward for a server's changelevel.
server_frame - Called once every server frame, may cause lag.
set_entity_flags - Sets flags on an entity.
set_entity_visibility - If visible = 1, entity will be set to be visible, else invisible.
set_lights - Sets map lighting, "#OFF" to disable.
set_msg_arg_float - Sets a floating value in a message argument.
set_msg_arg_int - Sets the value of an argument message.
set_msg_arg_string - Sets a string in a message argument.
set_msg_block - Sets whether a message is blocked or not.
set_rendering - Sets the rendering of an entity.
set_speak - Set a player's speak flags.
set_usercmd - Sets the parameters sent from CmdStart.
set_user_velocity - Sets a user's velocity.
set_view - Sets a player's view mode.
takedamage - Mirrors CBaseEntity::TakeDamage()
traceresult - Returns information from the last traceresult.
trace_forward - Read Below
trace_hull - Traces a hull.
trace_line - Traces a line from Start to End.
user_silentkill - Kills a user without a death message.
vector_distance - Returns the distance between two vectors.
vector_length - Returns the length of a vector.
vector_to_angle - Changes a vector to an angle vector.
VelocityByAim - Gives you a velocity in the direction a player is looking, iVelocity is the multiplier.
ViewContents - Get the contents of the point a player is aiming at.
User Contributed Notes
bailopan at amxmodx dot org Jun-02-04 06:30:30
This module was largely rewritten from scratch for AMX Mod X 0.20.


anglevector
Engine (engine.inc)
Description
anglevector - Engine function, ANGLEVECTOR.
Syntax
anglevector ( Float:vector[3], FRU, Float:vReturn[3] )
Type
Native
User Contributed Notes
adrianhenning at sbcglobal dot net Oct-27-04 14:41:31
It appears that this function operates in the same way as NS2AMX's. Specifically, FRU needs to be one of these values, otherwise vReturn[3] will be an undefined value. In most cases, you want to use ANGLEVECTOR_FORWARD. NOTE: These defines are not present in AMX Mod X as of 0.20 RC6.
// ...from ns2amxdefines.inc, by Steve Dudenhoeffer...
// Used for anglevector()
#define ANGLEVECTOR_FORWARD      1
#define ANGLEVECTOR_RIGHT        2
#define ANGLEVECTOR_UP           3


attach_view
Engine (engine.inc)
Description
attach_view - Sets a player's view to a new entity.
Syntax
attach_view ( player, target )
Type
Native
User Contributed Notes
genesis at radclan dot net Aug-05-05 21:26:35
Note: You can't attach a players view to another player, well not easily to do this you would have to use entities that follow the players. Also, the players can't see their hud information when they're viewing through an entity object.


call_think
Engine (engine.inc)
Description
call_think - Calls MDLL_Think() on an entity.
Syntax
call_think ( entity )
Type
Native
Notes
This is CBaseEntity::Think() or DispatchThink().


client_impulse
Engine (engine.inc)
Description
client_impulse - Forward for impulses.
Syntax
client_impulse ( id, impulse )
Type
Forward
Notes
Returning PLUGIN_HANDLED will block the engine call.


client_kill
Engine (engine.inc)
Description
client_kill - Called when a client types kill in the console.
Syntax
client_kill ( id )
Type
Forward
Notes
Returning PLUGIN_HANDLED will block the engine call.


client_PostThink
Engine (engine.inc)
Description
client_PostThink - Forward for PostThink() on a player.
Syntax
client_PostThink ( id )
Type
Forward


client_PreThink
Engine (engine.inc)
Description
client_PreThink - Forward for PreThink() on a player.
Syntax
client_PreThink ( id )
Type
Forward


copy_keyvalue
Engine (engine.inc)
Description
copy_keyvalue - Copies keyvalues set during the keyvalue() forward
Syntax
copy_keyvalue ( Classname[], sizeA, Keyname[], sizeB, Value[], sizec )
Type
Native


create_entity
Engine (engine.inc)
Description
create_entity - Creates a new entity and returns its index.
Syntax
create_entity ( Classname[] )
Type
Native
Notes
Returns less than 1 on failure. Be careful, as some classnames will cause problems on certain mods.


DispatchKeyValue
Engine (engine.inc)
Description
DispatchKeyValue - Dispatches a key/value pair, used for initializing entities on spawn.
Syntax
DispatchKeyValue ( entity, key[], value[] )
Type
Native
Notes
Call DispatchSpawn() after making these calls.


DispatchSpawn
Engine (engine.inc)
Description
DispatchSpawn - This is the same as call_think.
Syntax
DispatchSpawn ( entity )
Type
Native
Notes
See call_think.


drop_to_floor
Engine (engine.inc)
Description
drop_to_floor - Drops an entity to the floor.
Syntax
drop_to_floor ( entity )
Type
Native
Notes
Is not known to work.


entity_count
Engine (engine.inc)
Description
entity_count - Returns the number of entities in the world.
Syntax
entity_count ( )
Type
Native


entity_get_byte
Engine (engine.inc)
Description
entity_get_byte - Returns a byte from an entity's structure.
Syntax
entity_get_byte ( entity, key )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_get_edict
Engine (engine.inc)
Description
entity_get_edict - Returns the entity index of an entity's structure key.
Syntax
entity_get_edict ( entity, key )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_get_float
Engine (engine.inc)
Description
entity_get_float - Returns a float from an entity's structure.
Syntax
Float: entity_get_float ( entity, key )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_get_int
Engine (engine.inc)
Description
entity_get_int - Returns an integer from an entity's structure.
Syntax
entity_get_int ( entity, key )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_get_string
Engine (engine.inc)
Description
entity_get_string - Gets a string from an entity's structure.
Syntax
entity_get_string ( entity, key, Result[], maxLength )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.

The result is stored in Result[] for a maximum of maxLength characters.


entity_get_vector
Engine (engine.inc)
Description
entity_get_vector - Gets a vector from an entity's structure.
Syntax
entity_get_vector ( entity, key, Float:Vector[3] )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_range
Engine (engine.inc)
Description
entity_range - Returns the distance between two entities.
Syntax
Float: entity_range ( ida, idb )
Type
Native


entity_set_byte
Engine (engine.inc)
Description
entity_set_byte - Sets a byte on an entity's structure.
Syntax
entity_set_byte ( entity, key, value )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_set_edict
Engine (engine.inc)
Description
entity_set_edict - Sets an edict value on an entity's structure.
Syntax
entity_set_edict ( entity, key, edict )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_set_float
Engine (engine.inc)
Description
entity_set_float - Sets a float value on an entity's structure.
Syntax
entity_set_float ( entity, key, Float:value )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_set_int
Engine (engine.inc)
Description
entity_set_int - Sets an integer value on an entity's structure.
Syntax
entity_set_int ( entity, key, value )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.


entity_set_model
Engine (engine.inc)
Description
entity_set_model - Properly sets a new model on an entity.
Syntax
entity_set_model ( entity, Model[] )
Type
Native
Notes
Make sure you precache the model beforehand in plugin_precache.


entity_set_origin
Engine (engine.inc)
Description
entity_set_origin - Properly sets a new origin on an entity.
Syntax
entity_set_origin ( entity, Float:NewOrigin[3] )
Type
Native


entity_set_size
Engine (engine.inc)
Description
entity_set_size - Sets the bounds of an entity.
Syntax
entity_set_size ( index, Float:mins[3], Float:maxs[3] )
Type
Native


entity_set_string
Engine (engine.inc)
Description
entity_set_string - Sets a string on an entity's structure.
Syntax
entity_set_string ( entity, key, const String[] )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.

Do not use this to set models, use entity_set_model.


entity_set_vector
Engine (engine.inc)
Description
entity_set_vector - Sets a vector on an entity's structure.
Syntax
entity_set_vector ( entity, key, Float:NewVector[3] )
Type
Native
Notes
To see what entity key variables are available, see the engine_const.inc file.

Do not use this for setting an origin, use entity_set_origin.


fakedamage
Engine (engine_stocks.inc)
Description
fakedamage - Fakes damage on a target.
Syntax
fakedamage ( victim, Classname[], Float:damage, damagetype )
Type
Stock


fake_touch
Engine (engine.inc)
Description
fake_touch - Simulates two entities colliding/touching.
Syntax
fake_touch ( Toucher, Touched )
Type
Native


find_ent_by_class
Engine (engine.inc)
Description
find_ent_by_class - Finds an entity in the world, returning the index.
Syntax
find_ent_by_class ( StartEntity, Classname[] )
Type
Native
Notes
If none is found, 0 is returned. If starting entity should not be specified, use -1.


find_ent_by_model
Engine (engine.inc)
Description
find_ent_by_model - Finds an entity in the world by class and model, returning the index.
Syntax
find_ent_by_model ( StartEntity, Classname[], Model[] )
Type
Native
Notes
If none is found, 0 is returned. If starting entity should not be specified, use -1.


find_ent_by_owner
Engine (engine.inc)
Description
find_ent_by_owner - Finds an entity in the world by owner, returning the index.
Syntax
find_ent_by_owner ( StartIndex, Classname[], OwnerEntity, [ type ] )
Type
Native
Notes
If none is found, 0 is returned. If starting entity should not be specified, use -1.

Type defaults to 0, it can be set to:
0: Find by Classname
1: Find by Target
2: Find by Target Name


find_ent_by_target
Engine (engine.inc)
Description
find_ent_by_target - Finds an entity in the world by target, returning the index.
Syntax
find_ent_by_target ( StartEntity, Classname[] )
Type
Native
Notes
If none is found, 0 is returned. If starting entity should not be specified, use -1.


find_ent_by_tname
Engine (engine.inc)
Description
find_ent_by_tname - Finds an entity in the world by target name, returning the index.
Syntax
find_ent_by_tname ( StartEntity, Classname[] )
Type
Native
Notes
If none is found, 0 is returned. If starting entity should not be specified, use -1.


find_ent_in_sphere
Engine (engine.inc)
Description
find_ent_in_sphere - Finds an entity in the world in a sphere, returning the index.
Syntax
find_ent_in_sphere ( StartEntity, Float:origin[3], Float:radius )
Type
Native
Notes
If none is found, 0 is returned. If starting entity should not be specified, use -1.


find_sphere_class
Engine (engine.inc)
Description
find_sphere_class - Returns the number of ents stored in entlist
Syntax
find_sphere_class ( aroundent, _lookforclassname[], Float:radius, entlist[], maxents, Float:origin[3] = {0.0, 0.0, 0.0} )
Type
Native
Notes
Use to find a specific type of entity classname specify in _lookforclassname) around a certain entity specified in aroundent. All matching ents are stored in entlist. Specify max amount of entities to find in maxents.

If aroundent is 0 its origin is not used, but origin in 6th parameter. Ie, do not specify 6th parameter (origin) if you specified an entity in aroundent.


force_use
Engine (engine.inc)
Description
force_use - Forces an entity to use another entity.
Syntax
force_use ( user, used )
Type
Native
User Contributed Notes
Freeecode at hotmail dot com Jun-24-04 20:49:00
Very usefull for opening something that u need to touch like doors, hostages or maybe make a person view a camera.


FVecIVec
Engine (engine_stocks.inc)
Description
FVecIVec - Changes a float vector to an integer vector.
Syntax
FVecIVec ( Float:FVec[3], IVec[3] )
Type
Stock


get_brush_entity_origin
Engine (engine_stocks.inc)
Description
get_brush_entity_origin - Gets the origin of a brush entity.
Syntax
get_brush_entity_origin ( entity, Float:Origin[3] )
Type
Stock


get_decal_index
Engine (engine.inc)
Description
get_decal_index - Returns a decal index from a decal name.
Syntax
get_decal_index ( const szDecalName[] )
Type
Native


get_entity_distance
Engine (engine_stocks.inc)
Description
get_entity_distance - Returns the distance between two entities.
Syntax
get_entity_distance ( ent1, ent2 )
Type
Stock


get_entity_flags
Engine (engine_stocks.inc)
Description
get_entity_flags - Returns the flags an entity is flagged with.
Syntax
get_entity_flags ( entity )
Type
Stock


get_entity_visibility
Engine (engine_stocks.inc)
Description
get_entity_visibility - Returns 1 if an entity is visible.
Syntax
get_entity_visibility ( entity )
Type
Stock


get_global_edict
Engine (engine.inc)
Description
get_global_edict - Gets a global variable from the server as an entity index.
Syntax
get_global_edict ( variable )
Type
Native
Notes
// Edict
GL_trace_ent = 0,


get_global_float
Engine (engine.inc)
Description
get_global_float - Gets a global variable from the server as a float.
Syntax
Float: get_global_float ( variable )
Type
Native
Notes

// Float
GL_coop,
GL_deathmatch,
GL_force_retouch,
GL_found_secrets,
GL_frametime,
GL_serverflags,
GL_teamplay,
GL_time,
GL_trace_allsolid,
GL_trace_fraction,
GL_trace_inopen,
GL_trace_inwater,
GL_trace_plane_dist,
GL_trace_startsolid,


get_global_int
Engine (engine.inc)
Description
get_global_int - Gets a global variable from the server as an integer.
Syntax
get_global_int ( variable )
Type
Native
Notes
// Int
GL_cdAudioTrack,
GL_maxClients,
GL_maxEntities,
GL_msg_entity,
GL_trace_flags,
GL_trace_hitgroup,


get_global_string
Engine (engine.inc)
Description
get_global_string - Gets a global variable from the server as a string.
Syntax
get_global_string ( variable, szString[], maxLength )
Type
Native
Notes
szString is filled with the result for a maximum of maxLength characters.

// String
GL_pStringBase,
GL_mapname,
GL_startspot,


get_global_vector
Engine (engine.inc)
Description
get_global_vector - Gets a global variable from the server as a vector.
Syntax
get_global_vector ( variable, Float:vector[3] )
Type
Native
Notes

// Vector
GL_trace_endpos,
GL_trace_plane_normal,
GL_v_forward,
GL_v_right,
GL_v_up,
GL_vecLandmarkOffset,


get_grenade
Engine (engine_stocks.inc)
Description
get_grenade - Gets the grenade is thrown by a user.
Syntax
get_grenade ( player )
Type
Stock


get_grenade_id
Engine (engine.inc)
Description
get_grenade_id - Gets the ID of a grenade.
Syntax
get_grenade_id ( player, model[], len, grandeid=0 )
Type
Native
Notes
This is directly ported from Xtrafun.


get_info_keybuffer
Engine (engine.inc)
Description
get_info_keybuffer - Gets whole buffer containing keys and their data.
Syntax
get_info_keybuffer ( entity, buffer[], length )
Type
Native


get_keyvalue
Engine (engine.inc)
Description
get_keyvalue - Retrieves a value from a key/val pair on an entity.
Syntax
get_keyvalue ( entity, szKey[], value[], maxLength )
Type
Native


get_msg_args
Engine (engine.inc)
Description
get_msg_args - Returns the number of arguments passed to the current message.
Syntax
get_msg_args ( )
Type
Native


get_msg_argtype
Engine (engine.inc)
Description
get_msg_argtype - Returns the type of an message's argument.
Syntax
get_msg_argtype ( argn )
Type
Native
Notes
Argn starts from 1.

Argument types are:

enum {
ARG_BYTE = 1, /* int */
ARG_CHAR, /* int */
ARG_SHORT, /* int */
ARG_LONG, /* int */
ARG_ANGLE, /* float */
ARG_COORD, /* float */
ARG_STRING, /* string */
ARG_ENTITY, /* int */
}


get_msg_arg_float
Engine (engine.inc)
Description
get_msg_arg_float - Returns the value of an argument in a message as a float.
Syntax
Float: get_msg_arg_float ( argn )
Type
Native
Notes
argn starts from 1.


get_msg_arg_int
Engine (engine.inc)
Description
get_msg_arg_int - Returns the value of an argument in a message.
Syntax
get_msg_arg_int ( argn )
Type
Native
Notes
argn starts from 1.


get_msg_arg_string
Engine (engine.inc)
Description
get_msg_arg_string - Returns a string from a message argument.
Syntax
get_msg_arg_string ( argn, szReturn[], length )
Type
Native
Notes
argn starts from 1. Result is stored in szReturn for a maximum of length characters.


get_msg_block
Engine (engine.inc)
Description
get_msg_block - Returns the block flag on a message.
Syntax
get_msg_block ( msgId )
Type
Native
Notes
Flags are BLOCK_ONCE, BLOCK_NOT, and BLOCK_SET.


get_msg_origin
Engine (engine.inc)
Description
get_msg_origin - Sets the origin of the current message.
Syntax
get_msg_origin ( Float:Origin[3] )
Type
Native


get_speak
Engine (engine.inc)
Description
get_speak - Get a player's speak flags.
Syntax
get_speak ( player )
Type
Native
Notes
See set_speak.


get_speed
Engine (engine_stocks.inc)
Description
get_speed - Returns the speed of an entity's velocity.
Syntax
get_speed ( entity )
Type
Stock


get_usercmd
Engine (engine.inc)
Description
get_usercmd - Gets parameters sent from CmdStart.
Syntax
get_usercmd ( type, [ ... ] )
Type
Native


get_user_button
Engine (engine_stocks.inc)
Description
get_user_button - Gets the button(s) a user is pressing.
Syntax
get_user_button ( player )
Type
Stock


get_user_oldbutton
Engine (engine_stocks.inc)
Description
get_user_oldbutton - Gets the oldbutton(s) a user is pressing.
Syntax
get_user_oldbutton ( player )
Type
Stock


get_user_velocity
Engine (engine_stocks.inc)
Description
get_user_velocity - Gets a user's velocity.
Syntax
get_user_velocity ( entity, Float:Vector[3] )
Type
Stock


halflife_time
Engine (engine.inc)
Description
halflife_time - Returns the gpGlobal time from Half-Life
Syntax
Float: halflife_time ( )
Type
Native


is_in_viewcone
Engine (engine.inc)
Description
is_in_viewcone - Checks if an origin is in an entity's viewcone
Syntax
is_in_viewcone ( entity, Float:origin[3] )
Type
Native
Notes
This function was added in AMX Mod X 1.1 directly from the HLSDK.


is_valid_ent
Engine (engine.inc)
Description
is_valid_ent - Returns 1 if an entity index is valid for operation, 0 otherwise.
Syntax
is_valid_ent ( entity )
Type
Native
Notes
0 implies the entity does not exist.


is_visible
Engine (engine.inc)
Description
is_visible - Checks if a target entity is visible to an entity
Syntax
is_visible ( entity, target )
Type
Native
Notes
This function was added in AMX Mod X 1.1 directly from the HLSDK.

Update: The function was modified per advice of T(+)rget.


IVecFVec
Engine (engine_stocks.inc)
Description
IVecFVec - Changes an integer vector to a float vector.
Syntax
IVecFVec ( IVec[3], Float:FVec[3] )
Type
Stock


make_deathmsg
Engine (engine_stocks.inc)
Description
make_deathmsg - Creates a death message.
Syntax
make_deathmsg ( killer, victim, headshot, weapon[] )
Type
Stock
Notes
This is mod dependent, and although should work in most mods was designed for Counter-Strike.


pfn_spawn
Engine (engine.inc)
Description
pfn_spawn - Called when an entity is spawned.
Syntax
pfn_spawn ( entid )
Type
Forward
Notes
Returning PLUGIN_HANDLED will block the engine call.


pfn_think
Engine (engine.inc)
Description
pfn_think - Called when an entity thinks with DispatchThink().
Syntax
pfn_think ( entid )
Type
Native


pfn_touch
Engine (engine.inc)
Description
pfn_touch - Called when two entities touch/collide.
Syntax
pfn_touch ( ptr, ptd )
Type
Forward
Notes
Players will always show up as the touched (ptd).

Returning PLUGIN_HANDLED will block the engine call.


pfn_use
Engine (engine.inc)
Description
pfn_use - DEPRECATED. Called when an object uses another object.
Syntax
pfn_use ( user, used )
Type
Forward
Notes
This callback is DEPRECATED and is no longer available.

Returning PLUGIN_HANDLED will block the engine call.


PlaybackEvent
Engine (engine.inc)
Description
PlaybackEvent - Forwarded on an event playback.
Syntax
PlaybackEvent ( flags, entid, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam2 )
Type
Forward
Notes
If the parameter list was too big, here it is reprinted:
(flags, entid, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam2)


playback_event
Engine (engine.inc)
Description
playback_event - PLAYBACK_EVENT_FULL from HLSDK.
Syntax
playback_event ( flags, invoker, eventindex, Float:delat, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2 )
Type
Native
Notes
If the above parameters did not fit, they are reprinted here:
(flags, invoker, eventindex, Float:delat, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2)

This is a direct copy of PLAYBACK_EVENT_FULL from Metamod/HLSDK. If you don't know how that works, you probably shouldn't be using it.


PointContents
Engine (engine.inc)
Description
PointContents - Will return the contents of a point (inside map? in sky? outside map? etc.).
Syntax
PointContents ( Float:Origin[3] )
Type
Native


precache_event
Engine (engine.inc)
Description
precache_event - Precaches an event.
Syntax
precache_event ( type, name[], [ ... ] )
Type
Native


precache_generic
Engine (engine.inc)
Description
precache_generic - Precaches a generic file.
Syntax
precache_generic ( szFile[] )
Type
Native
Notes
Call this in plugin_precache.


RadiusDamage
Engine (engine.inc)
Description
RadiusDamage - Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage.
Syntax
RadiusDamage ( Float:ExplodeAt[3], DamageMultiplier, RadiusMultiplier )
Type
Native
User Contributed Notes
AKhalifman at hotmail dot com Nov-25-04 02:48:56
As it does with all damage functions (except silent kill)

Freeecode at hotmail dot com Jun-24-04 20:50:28
Note that if it kills a person then the kill will show as suicide.


register_impulse
Engine (engine.inc)
Description
register_impulse - Registers a client impulse to a function.
Syntax
register_impulse ( impulse, function[] )
Type
Forward
Notes
When an impulse is started on a client, the client's id is forwarded to the named function.

This is a blocking forward (PLUGIN_HANDLED will block the operation).


register_message
Engine (engine.inc)
Description
register_message - Hooks a message to a single function.
Syntax
register_message ( msgId, function[] )
Type
Native
Notes
This is like an advanced register_event.
The function you create should have the following arguments passed to it: msg_id, msg_dest, and msg_entity. You should NEVER send a message or use a command which sends a message while in a register_message hook.

Returning PLUGIN_CONTINUE will send the message on the stack, PLUGIN_HANDLED will block the message.

See the following commands for using message commands:

get_msg_args
get_msg_argtype
get_msg_arg_int
get_msg_arg_float
get_msg_arg_string
set_msg_arg_int
set_msg_arg_float
set_msg_arg_string
get_msg_origin


register_think
Engine (engine.inc)
Description
register_think - Registers a think action to a function.
Syntax
register_think ( Classname[], function[] )
Type
Forward
Notes
If an entity of Classname[] thinks, its entity ID is forwarded to the named function.

This is not a blocking function, PLUGIN_HANDLED and PLUGIN_CONTINUE will have no effect.


register_touch
Engine (engine.inc)
Description
register_touch - Registers a touch action to a function.
Syntax
register_touch ( Toucher[], Touched[], function[] )
Type
Native
Notes
If Toucher or Touched is "*" or "", then it is a wildcard for any classname. Otherwise, you can register specific touches like this:

register_touch("my_entity", "player", "myent_touch")

public myent_touch(pToucher, pTouched)

}

This is a blocking forward (PLUGIN_HANDLED will block the operation).


remove_entity
Engine (engine.inc)
Description
remove_entity - Removes an entity from the world.
Syntax
remove_entity ( entity )
Type
Native


remove_entity_name
Engine (engine_stocks.inc)
Description
remove_entity_name - Removes an entity by name.
Syntax
remove_entity_name ( Name[] )
Type
Stock
Notes


server_changelevel
Engine (engine.inc)
Description
server_changelevel - Forward for a server's changelevel.
Syntax
server_changelevel ( map[] )
Type
Forward
Notes
Returning PLUGIN_HANDLED will block the engine call.


server_frame
Engine (engine.inc)
Description
server_frame - Called once every server frame, may cause lag.
Syntax
server_frame ( )
Type
Forward
Notes


set_entity_flags
Engine (engine_stocks.inc)
Description
set_entity_flags - Sets flags on an entity.
Syntax
set_entity_flags ( entity, flag, onoff )
Type
Stock


set_entity_visibility
Engine (engine_stocks.inc)
Description
set_entity_visibility - If visible = 1, entity will be set to be visible, else invisible.
Syntax
set_entity_visibility ( entity, [ visible = 1 ] )
Type
Stock


set_lights
Engine (engine.inc)
Description
set_lights - Sets map lighting, "#OFF" to disable.
Syntax
set_lights ( const Lighting[] )
Type
Native
User Contributed Notes
jasoningram at sympatico dot ca Aug-15-04 05:22:10
a is darkest, z is brightest m = normal (pretty sure, looks like it) use multiple letters to have it alternate eg. giving it az will make it go really bright, then really dark, then really bright, etc.

Freeecode at hotmail dot com Jun-24-04 20:53:12
Use a-z for different lights.


set_msg_arg_float
Engine (engine.inc)
Description
set_msg_arg_float - Sets a floating value in a message argument.
Syntax
set_msg_arg_float ( argn, argtype, Float:fValue )
Type
Native
Notes
argn starts from 1. Be sure to keep the same argtype, or else Bad Things Can Happen.
User Contributed Notes
bailopan at gmail dot com Jul-23-05 22:14:40
As of AMX Mod X 1.1, the second parameter is ignored for safety. You can set it to zero.


set_msg_arg_int
Engine (engine.inc)
Description
set_msg_arg_int - Sets the value of an argument message.
Syntax
set_msg_arg_int ( argn, argtype, iValue )
Type
Native
Notes
argn starts from 1. Be sure to keep the same argtype, or else Bad Things Can Happen.
User Contributed Notes
bailopan at gmail dot com Jul-23-05 22:14:12
As of AMX Mod X 1.1, the second parameter is ignored for safety. You can set it to 0.


set_msg_arg_string
Engine (engine.inc)
Description
set_msg_arg_string - Sets a string in a message argument.
Syntax
set_msg_arg_string ( argn, szString[] )
Type
Native
Notes
argn starts from 1. Be sure to keep the same argtype, or else Bad Things Can Happen.


set_msg_block
Engine (engine.inc)
Description
set_msg_block - Sets whether a message is blocked or not.
Syntax
set_msg_block ( msgId, flag )
Type
Native
Notes
Flags are BLOCK_ONCE, BLOCK_NOT, and BLOCK_SET.


set_rendering
Engine (engine_stocks.inc)
Description
set_rendering - Sets the rendering of an entity.
Syntax
set_rendering ( index, fx=kRenderFxNone, r=255,g=255,b=255, render=kRenderNormal,amount=16 )
Type
Stock


set_speak
Engine (engine.inc)
Description
set_speak - Set a player's speak flags.
Syntax
set_speak ( player, speakFlags )
Type
Native
Notes
#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4


set_usercmd
Engine (engine.inc)
Description
set_usercmd - Sets the parameters sent from CmdStart.
Syntax
set_usercmd ( type, [ ... ] )
Type
Native


set_user_velocity
Engine (engine_stocks.inc)
Description
set_user_velocity - Sets a user's velocity.
Syntax
set_user_velocity ( entity, Float:Vector[3] )
Type
Stock


set_view
Engine (engine.inc)
Description
set_view - Sets a player's view mode.
Syntax
set_view ( player, viewtype )
Type
Native
Notes
Modes are:

CAMERA_NONE
CAMERA_3RDPERSON
CAMERA_UPLEFT
CAMERA_TOPDOWN


takedamage
Engine (engine.inc)
Description
takedamage - Mirrors CBaseEntity::TakeDamage()
Syntax
takedamage ( victim, inflictor, attacker, Float:damage, type )
Type
Native
Notes
Forces an entity to take damage.

Potential for crash. If you have problems with this, use fakedamage().


traceresult
Engine (engine.inc)
Description
traceresult - Returns information from the last traceresult.
Syntax
traceresult ( type, [ ... ] )
Type
Native
Notes

TR_AllSolid,		// (int) if true, plane is not valid

TR_StartSolid,		// (int) if true, the initial point was in a solid area

TR_InOpen,		// (int)

TR_InWater,		// (int)

TR_Fraction,		// (float) time completed, 1.0 = didn't hit anything

TR_EndPos,		// (vector) final position

TR_PlaneDist,		// (float)

TR_PlaneNormal,		// (vector) surface normal at impact

TR_Hit,			// (entity) entity the surface is on

TR_Hitgroup		// (int) 0 == generic, non zero is specific body part


trace_forward
Engine (engine.inc)
Description
trace_forward - Read Below
Syntax
trace_forward ( Float:start[3], Float:angles[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh )
Type
Native
Notes
Will be added for AMX Mod X 1.1

trace_forward takes an origin from the center of a player (Float:start[3]) and an angle vector (use entity_get_vector(player,EV_VEC_angles,vec). It traces in front of the player, returning the distance to the closest obtrusion, the lowest height (min 0.0, meaning on the ground) of the obtrusion and the highest point of the obtrusion (max 72.0, meaning above the players head). Give is how much the distance to the obtrusion may very to still be considered the same obtrusion, if you pass a value less than zero it is automatically set to 20.0. ignoreEnt if 0 ignores entities, if greater than zero, it ignores the passed entity index. The closer the passed origin is to the obtrusion, the more accurate it is.


trace_hull
Engine (engine.inc)
Description
trace_hull - Traces a hull.
Syntax
trace_hull ( Float:origin[3], hull, [ ignoredent=0, ignoremonsters=0 ] )
Type
Native
User Contributed Notes
everco_ice at sbcglobal dot net (twistedeuphoria) Jun-05-05 03:36:56
From the SDK: typedef enum { point_hull=0, human_hull=1, large_hull=2, head_hull=3 };


trace_line
Engine (engine.inc)
Description
trace_line - Traces a line from Start to End.
Syntax
trace_line ( IgnoreEnt, Float:Start[3], Float:End[3], Float:vReturn[3] )
Type
Native
Notes
Returns the point hit and an entity index if an entity was hit.


user_silentkill
Engine (engine_stocks.inc)
Description
user_silentkill - Kills a user without a death message.
Syntax
user_silentkill ( player )
Type
Stock


vector_distance
Engine (engine.inc)
Description
vector_distance - Returns the distance between two vectors.
Syntax
Float: vector_distance ( Float:Vector1[3], Float:Vector2[3] )
Type
Native


vector_length
Engine (engine.inc)
Description
vector_length - Returns the length of a vector.
Syntax
Float: vector_length ( Float:Vector[3] )
Type
Native


vector_to_angle
Engine (engine.inc)
Description
vector_to_angle - Changes a vector to an angle vector.
Syntax
vector_to_angle ( Float:vector[3], Float:vReturn[3] )
Type
Native


VelocityByAim
Engine (engine.inc)
Description
VelocityByAim - Gives you a velocity in the direction a player is looking, iVelocity is the multiplier.
Syntax
VelocityByAim ( entity, velocity, Float:RetValue[3] )
Type
Native
User Contributed Notes
tsimscabinet at msn dot com Jun-28-04 21:51:37
This native can easily be manually done with more alteration. This is an example of such: new Float:vAngles[3] // plug in the view angles of the entity new Float:vReturn[3] // to get out an origin fDistance away new Float:fDistance = 400.0 // fDistance being the distance from the entity of your choice entity_get_vector(id,EV_VEC_v_angles,vAngles) vReturn[0] = floatcos( vAngles[1], degrees ) * fDistance vReturn[1] = floatsin( vAngles[1], degrees ) * fDistance vReturn[2] = floatsin( -vAngles[0], degrees ) * fDistance


ViewContents
Engine (engine_stocks.inc)
Description
ViewContents - Get the contents of the point a player is aiming at.
Syntax
ViewContents ( player )
Type
Stock


ESF
Content:
  • Notes
  • Functions
Notes
THIS MODULE WILL BE RELEASED WITH THE NEXT VERSION OF AMX MOD X.

The ESF module was based on stocks and information provided by LynX. It was organized and released by BAILOPAN. The ESF module has two includes, a natives include and a const include.
  • esf.inc (ESF Natives)
  • esf_const.inc (ESF Constants)
ESF contains the following constants:
  • Character Type Constants
  • Explosion Type Constants
  • Attack Type Constants
  • Direction Constants
  • Recovery Constants
  • State Constants
Character Type Constants
enum
{
    Character_Buu = 1,
    Character_Goku = 2,
    Character_Gohan = 3,
    Character_Krillin = 4,
    Character_Frieza = 5,
    Character_Piccolo = 6,
    Character_Trunks = 7,
    Character_Vegeta = 8,
    Character_Cell = 9,
};

Explosion Type Constants
enum
{
    Explosion_Blue = 0,
    Explosion_Green,
    Explosion_Orange,
    Explosion_Purple,
    Explosion_Yellow,
    Explosion_Red,
    Explosion_White,
    Explosion_Total,
};

Attack Type Constants
enum
{
    Attack_Kamehameha = 1,
    Attack_SpiritBomb,
    Attack_GalletGun,
    Attack_FinalFlash,
    Attack_Renzoku,
    Attack_Kametorpedo,
    Attack_GenericBeam,
    Attack_Throw,
};

Direction Constants
enum
{
    Direction_Left = 1,
    Direction_Right,
    Direction_Up,
    Direction_Down,
    Direction_Forward,
    Direction_Backward,
};

Recovery Constants
enum
{
    Recovery_Kicked = 1,
    Recovery_Tumbled,
    Recovery_Lying,
    Recovery_Thrown,
};

State Constants
#define ESF_CHARGING		1
#define ESF_CONTROLING		2
#define ESF_SHOOTING		3
#define ESF_SHOT		4

Functions
esf_create_avatar - Creates an avatar for a player.
esf_explosion - Creates a generic ESF explosion.
esf_get_class - Returns a player's character class.
esf_get_ki - Returns a player's ki.
esf_get_powerlevel - Returns a player's power level.
esf_get_shotstate - Gets the state of a player's attack.
esf_get_speed - Returns a player's speed.
esf_get_swoopspeed - Gets a player's swooping speed.
esf_grabbedwall - Checks if a player has grabbed a wall.
esf_groundthrown - Checks if a player has been thrown to the ground.
esf_has_avatar - Returns whether a not a player has an avatar.
esf_has_died - Checks if a player has just died.
esf_has_dragonball - Checks if a player has a dragonball.
esf_in_advmelee - Checks if a player is in advanced melee.
esf_in_combo - Checks if a player is in a combo (1 or 2). If attacked is 1, checks if being attacked by this combo.
esf_in_stance - Checks whether player is in stance to do a combo/punches.
esf_in_water - Checks if a player is powering up.
esf_is_advmeleed - Checks if a player is being advanced meleed.
esf_is_advmeleeing - Checks if a player is advanced meleeing.
esf_is_beamjumping - Checks if a player is beam jumping.
esf_is_blocking - Checks if a player is blocking.
esf_is_crushed - Checks if a player is crushed against a wall.
esf_is_flying - Checks if a player is flying.
esf_is_grappling - Checks if a player is grappling/in an adv. melee struggle.
esf_is_idle - Checks if a player is idling.
esf_is_kicked - Checks if a player has been kicked in basic melee.
esf_is_kicking - Checks if a player has kicked someone with basic melee.
esf_is_lying - Checks if a player is lying on the ground.
esf_is_prepunch - Checks if a player is in prepunch, or if a player is being prepunched.
esf_is_recovered - Checks if a player is recovering from an attack.
esf_is_shooting - Checks if a player is shooting.
esf_is_stunned - Checks if a player is stunned.
esf_is_swooping - Checks if a player is swooping in a certain direction.
esf_is_swung - Checks if a player has been swung.
esf_is_tumbling - Checks if a player is tumbling.
esf_remove_avatar - Removes a user's avatar.
esf_set_avatar_model - Sets an avatar model.
esf_set_chargebar - Creates a chargebar (0 - 1000).
esf_set_class - Sets a player's class (experimental).
esf_set_health - Sets a player's health.
esf_set_ki - Sets a player's ki.
esf_set_powerlevel - Sets a player's power level.
esf_set_speed - Sets a player's speed.
esf_set_swoopspeed - Sets a player's swooping speed.
esf_start_powerup - Starts a power-up sequence with specified colors.
esf_stop_powerup - Stops power-up.
esf_threw_dragonball - Checks if a player has just thrown a dragonball.
esf_transformfx_1 - Use character's TransformFX 1 message.
esf_transformfx_2 - Use character's TransformFX 2 message.
esf_transformfx_off - Stops a user's transformation.
esf_transforming - Checks if a player is transforming.
esf_transform_done - Checks if a player's transformation is done.
esf_walljumped - Checks if a player has jumped off a wall.


esf_create_avatar
ESF (esf.inc)
Description
esf_create_avatar - Creates an avatar for a player.
Syntax
esf_create_avatar ( id )
Type
Native


esf_explosion
ESF (esf.inc)
Description
esf_explosion - Creates a generic ESF explosion.
Syntax
esf_explosion ( origin[3], radius, type = Explosion_White )
Type
Native


esf_get_class
ESF (esf.inc)
Description
esf_get_class - Returns a player's character class.
Syntax
esf_get_class ( player )
Type
Native


esf_get_ki
ESF (esf.inc)
Description
esf_get_ki - Returns a player's ki.
Syntax
Float: esf_get_ki ( player )
Type
Native
Notes


esf_get_powerlevel
ESF (esf.inc)
Description
esf_get_powerlevel - Returns a player's power level.
Syntax
esf_get_powerlevel ( player )
Type
Native


esf_get_shotstate
ESF (esf.inc)
Description
esf_get_shotstate - Gets the state of a player's attack.
Syntax
esf_get_shotstate ( player, attack )
Type
Native
Notes
You must specify the attack or it will return 0. See defines for attacks.


esf_get_speed
ESF (esf.inc)
Description
esf_get_speed - Returns a player's speed.
Syntax
esf_get_speed ( player )
Type
Native


esf_get_swoopspeed
ESF (esf.inc)
Description
esf_get_swoopspeed - Gets a player's swooping speed.
Syntax
Float: esf_get_swoopspeed ( player )
Type
Native


esf_grabbedwall
ESF (esf.inc)
Description
esf_grabbedwall - Checks if a player has grabbed a wall.
Syntax
esf_grabbedwall ( player )
Type
Native


esf_groundthrown
ESF (esf.inc)
Description
esf_groundthrown - Checks if a player has been thrown to the ground.
Syntax
esf_groundthrown ( player )
Type
Native


esf_has_avatar
ESF (esf.inc)
Description
esf_has_avatar - Returns whether a not a player has an avatar.
Syntax
esf_has_avatar ( id )
Type
Native


esf_has_died
ESF (esf.inc)
Description
esf_has_died - Checks if a player has just died.
Syntax
esf_has_died ( player )
Type
Native


esf_has_dragonball
ESF (esf.inc)
Description
esf_has_dragonball - Checks if a player has a dragonball.
Syntax
esf_has_dragonball ( player )
Type
Native


esf_in_advmelee
ESF (esf.inc)
Description
esf_in_advmelee - Checks if a player is in advanced melee.
Syntax
esf_in_advmelee ( player )
Type
Native


esf_in_combo
ESF (esf.inc)
Description
esf_in_combo - Checks if a player is in a combo (1 or 2). If attacked is 1, checks if being attacked by this combo.
Syntax
esf_in_combo ( player, combo, attacked = 0 )
Type
Native


esf_in_stance
ESF (esf.inc)
Description
esf_in_stance - Checks whether player is in stance to do a combo/punches.
Syntax
esf_in_stance ( player )
Type
Native


esf_in_water
ESF (esf.inc)
Description
esf_in_water - Checks if a player is powering up.
Syntax
esf_in_water ( player )
Type
Native


esf_is_advmeleed
ESF (esf.inc)
Description
esf_is_advmeleed - Checks if a player is being advanced meleed.
Syntax
esf_is_advmeleed ( player )
Type
Native


esf_is_advmeleeing
ESF (esf.inc)
Description
esf_is_advmeleeing - Checks if a player is advanced meleeing.
Syntax
esf_is_advmeleeing ( player )
Type
Native


esf_is_beamjumping
ESF (esf.inc)
Description
esf_is_beamjumping - Checks if a player is beam jumping.
Syntax
esf_is_beamjumping ( player )
Type
Native


esf_is_blocking
ESF (esf.inc)
Description
esf_is_blocking - Checks if a player is blocking.
Syntax
esf_is_blocking ( player )
Type
Native


esf_is_crushed
ESF (esf.inc)
Description
esf_is_crushed - Checks if a player is crushed against a wall.
Syntax
esf_is_crushed ( player )
Type
Native


esf_is_flying
ESF (esf.inc)
Description
esf_is_flying - Checks if a player is flying.
Syntax
esf_is_flying ( player )
Type
Native


esf_is_grappling
ESF (esf.inc)
Description
esf_is_grappling - Checks if a player is grappling/in an adv. melee struggle.
Syntax
esf_is_grappling ( player )
Type
Native


esf_is_idle
ESF (esf.inc)
Description
esf_is_idle - Checks if a player is idling.
Syntax
esf_is_idle ( player )
Type
Native


esf_is_kicked
ESF (esf.inc)
Description
esf_is_kicked - Checks if a player has been kicked in basic melee.
Syntax
esf_is_kicked ( player )
Type
Native


esf_is_kicking
ESF (esf.inc)
Description
esf_is_kicking - Checks if a player has kicked someone with basic melee.
Syntax
esf_is_kicking ( player )
Type
Native


esf_is_lying
ESF (esf.inc)
Description
esf_is_lying - Checks if a player is lying on the ground.
Syntax
esf_is_lying ( player )
Type
Native


esf_is_prepunch
ESF (esf.inc)
Description
esf_is_prepunch - Checks if a player is in prepunch, or if a player is being prepunched.
Syntax
esf_is_prepunch ( player )
Type
Native


esf_is_recovered
ESF (esf.inc)
Description
esf_is_recovered - Checks if a player is recovering from an attack.
Syntax
esf_is_recovered ( player, recovery )
Type
Native


esf_is_shooting
ESF (esf.inc)
Description
esf_is_shooting - Checks if a player is shooting.
Syntax
esf_is_shooting ( player, mode )
Type
Native
Notes
1 = kiblast
2 = generic beam


esf_is_stunned
ESF (esf.inc)
Description
esf_is_stunned - Checks if a player is stunned.
Syntax
esf_is_stunned ( player )
Type
Native


esf_is_swooping
ESF (esf.inc)
Description
esf_is_swooping - Checks if a player is swooping in a certain direction.
Syntax
esf_is_swooping ( player, dir = 0 )
Type
Native
Notes
0 = Any direction.


esf_is_swung
ESF (esf.inc)
Description
esf_is_swung - Checks if a player has been swung.
Syntax
esf_is_swung ( player )
Type
Native


esf_is_tumbling
ESF (esf.inc)
Description
esf_is_tumbling - Checks if a player is tumbling.
Syntax
esf_is_tumbling ( player )
Type
Native


esf_remove_avatar
ESF (esf.inc)
Description
esf_remove_avatar - Removes a user's avatar.
Syntax
esf_remove_avatar ( id )
Type
Native


esf_set_avatar_model
ESF (esf.inc)
Description
esf_set_avatar_model - Sets an avatar model.
Syntax
esf_set_avatar_model ( id, const szModel[] )
Type
Native


esf_set_chargebar
ESF (esf.inc)
Description
esf_set_chargebar - Creates a chargebar (0 - 1000).
Syntax
esf_set_chargebar ( player, charge )
Type
Native


esf_set_class
ESF (esf.inc)
Description
esf_set_class - Sets a player's class (experimental).
Syntax
esf_set_class ( player, class )
Type
Native


esf_set_health
ESF (esf.inc)
Description
esf_set_health - Sets a player's health.
Syntax
esf_set_health ( player, health )
Type
Native


esf_set_ki
ESF (esf.inc)
Description
esf_set_ki - Sets a player's ki.
Syntax
esf_set_ki ( player, Float:ki )
Type
Native
Notes
Minimum ki is 0.0
Maximum ki is 1000.0


esf_set_powerlevel
ESF (esf.inc)
Description
esf_set_powerlevel - Sets a player's power level.
Syntax
esf_set_powerlevel ( player, power )
Type
Native


esf_set_speed
ESF (esf.inc)
Description
esf_set_speed - Sets a player's speed.
Syntax
esf_set_speed ( player, speed )
Type
Native


esf_set_swoopspeed
ESF (esf.inc)
Description
esf_set_swoopspeed - Sets a player's swooping speed.
Syntax
esf_set_swoopspeed ( player, Float;speed )
Type
Native


esf_start_powerup
ESF (esf.inc)
Description
esf_start_powerup - Starts a power-up sequence with specified colors.
Syntax
esf_start_powerup ( player, iRed, iGreen, iBlue )
Type
Native


esf_stop_powerup
ESF (esf.inc)
Description
esf_stop_powerup - Stops power-up.
Syntax
esf_stop_powerup ( player )
Type
Native


esf_threw_dragonball
ESF (esf.inc)
Description
esf_threw_dragonball - Checks if a player has just thrown a dragonball.
Syntax
esf_threw_dragonball ( player )
Type
Native


esf_transformfx_1
ESF (esf.inc)
Description
esf_transformfx_1 - Use character's TransformFX 1 message.
Syntax
esf_transformfx_1 ( id )
Type
Native


esf_transformfx_2
ESF (esf.inc)
Description
esf_transformfx_2 - Use character's TransformFX 2 message.
Syntax
esf_transformfx_2 ( id )
Type
Native


esf_transformfx_off
ESF (esf.inc)
Description
esf_transformfx_off - Stops a user's transformation.
Syntax
esf_transformfx_off ( id )
Type
Native


esf_transforming
ESF (esf.inc)
Description
esf_transforming - Checks if a player is transforming.
Syntax
esf_transforming ( player )
Type
Native


esf_transform_done
ESF (esf.inc)
Description
esf_transform_done - Checks if a player's transformation is done.
Syntax
esf_transform_done ( player )
Type
Native


esf_walljumped
ESF (esf.inc)
Description
esf_walljumped - Checks if a player has jumped off a wall.
Syntax
esf_walljumped ( player )
Type
Native


Fakemeta
Content:
  • Notes
  • Functions
Notes
The Fakemeta module is a high powered alternative to the Engine module. It allows you
to interact with nearly the entire HL Engine by calling DLL functions, Engine functions, and
hooking/forwarding DLL and Engine functions. It also has natives for retrieving any data from
a player, including their edict_t struct and pvPrivateData block.

The Fakemeta module has three includes. The second contains no natives.
However, it will be necessary to consult it for engine specifics.
If you make mistakes with Fakemeta, you can easily crash an HLServer.
Be careful, as you are directly interacting with the engine.
  • fakemeta.inc (Constains fakemeta module natives)
  • fakemeta_const.inc (Constants and engine descriptions)
  • fakemeta_stocks.inc (Stock functions for dllfunc() and engfunc())
FakeMeta contains the following constats:
  • Return Type Constants
  • Return Value Constants
  • Engine Function Constants
  • DLL Function Constants
  • Pev Constants
  • Forward Function Constants
  • TraceResult Constants
Return Type Constants
#define FMV_STRING		1
#define FMV_FLOAT		2
#define FMV_CELL		3

Return Value Constants
#define FMRES_HANDLED	2
#define FMRES_SUPERCEDE	4
#define FMRES_IGNORED	1
#define FMRES_OVERRIDE	3

Engine Function Constants
enum {
    EngFunc_PrecacheModel,	// int  )			(char* s);
    EngFunc_PrecacheSound,	// int  )			(char* s);
    EngFunc_SetModel,		// void )				(edict_t *e, const char *m);
    EngFunc_ModelIndex,		// int  )			(const char *m);
    EngFunc_ModelFrames,	// int	)			(int modelIndex);
    EngFunc_SetSize,		// void )				(edict_t *e, const float *rgflMin, const float *rgflMax);
    EngFunc_ChangeLevel,			// void )			(char* s1, char* s2);
    EngFunc_VecToYaw,			// float)				(const float *rgflVector);
    EngFunc_VecToAngles,			// void )			(const float *rgflVectorIn, float *rgflVectorOut);
    EngFunc_MoveToOrigin,		// void )			(edict_t *ent, const float *pflGoal, float dist, int iMoveType);
    EngFunc_ChangeYaw,			// void )				(edict_t* ent);
    EngFunc_ChangePitch,			// void )			(edict_t* ent);
    EngFunc_FindEntityByString,	// edict)	(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
    EngFunc_GetEntityIllum,		// int	)		(edict_t* pEnt);
    EngFunc_FindEntityInSphere,	// edict)	(edict_t *pEdictStartSearchAfter, const float *org, float rad);
    EngFunc_FindClientInPVS,		// edict)		(edict_t *pEdict);
    EngFunc_EntitiesInPVS,		// edict)			(edict_t *pplayer);
    EngFunc_MakeVectors,			// void )			(const float *rgflVector);
    EngFunc_AngleVectors,		// void )			(const float *rgflVector, float *forward, float *right, float *up);
    EngFunc_CreateEntity,		// edict)			(void);
    EngFunc_RemoveEntity,		// void )			(edict_t* e);
    EngFunc_CreateNamedEntity,	// edict)		(int className);
    EngFunc_MakeStatic,			// void )			(edict_t *ent);
    EngFunc_EntIsOnFloor,		// int  )			(edict_t *e);
    EngFunc_DropToFloor,			// int  )			(edict_t* e);
    EngFunc_WalkMove,			// int  )				(edict_t *ent, float yaw, float dist, int iMode);
    EngFunc_SetOrigin,			// void )				(edict_t *e, const float *rgflOrigin);
    EngFunc_EmitSound,			// void )				(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
    EngFunc_EmitAmbientSound,	// void )		(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
    EngFunc_TraceLine,			// void )				(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
    EngFunc_TraceToss,			// void )				(edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr);
    EngFunc_TraceMonsterHull,	// int  )		(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
    EngFunc_TraceHull,			// void )				(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
    EngFunc_TraceModel,			// void )			(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
    EngFunc_TraceTexture,		// const char *)			(edict_t *pTextureEntity, const float *v1, const float *v2 );
    EngFunc_TraceSphere,			// void )			(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
    EngFunc_GetAimVector,		// void )			(edict_t* ent, float speed, float *rgflReturn);
    EngFunc_ParticleEffect,		// void )		(const float *org, const float *dir, float color, float count);
    EngFunc_LightStyle,			// void )			(int style, char* val);
    EngFunc_DecalIndex,			// int  )			(const char *name);
    EngFunc_PointContents,		// int )			(const float *rgflVector);
    EngFunc_FreeEntPrivateData,	// void )	(edict_t *pEdict);
    EngFunc_SzFromIndex,			// const char * )			(int iString);
    EngFunc_AllocString,			// int )			(const char *szValue);
    EngFunc_RegUserMsg,			// int	)			(const char *pszName, int iSize);
    EngFunc_AnimationAutomove,	// void )		(const edict_t* pEdict, float flTime);
    EngFunc_GetBonePosition,		// void )		(const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
    EngFunc_GetAttachment,		// void	)			(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
    EngFunc_SetView,				// void )				(const edict_t *pClient, const edict_t *pViewent );
    EngFunc_Time,				// float)					( void );
    EngFunc_CrosshairAngle,		// void )		(const edict_t *pClient, float pitch, float yaw);
    EngFunc_FadeClientVolume,	// void )      (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
    EngFunc_SetClientMaxspeed,	// void )     (const edict_t *pEdict, float fNewMaxspeed);
    EngFunc_CreateFakeClient,	// edict)		(const char *netname);	// returns NULL if fake client can't be created
    EngFunc_RunPlayerMove,		// void )			(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
    EngFunc_NumberOfEntities,	// int  )		(void);
    EngFunc_StaticDecal,			// void )			( const float *origin, int decalIndex, int entityIndex, int modelIndex );
    EngFunc_PrecacheGeneric,		// int  )		(char* s);
    EngFunc_BuildSoundMsg,		// void )			(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
    EngFunc_GetPhysicsKeyValue,	// const char* )	( const edict_t *pClient, const char *key );
    EngFunc_SetPhysicsKeyValue,	// void )	( const edict_t *pClient, const char *key, const char *value );
    EngFunc_GetPhysicsInfoString,// const char* )	( const edict_t *pClient );
    EngFunc_PrecacheEvent,		// unsigned short )		( int type, const char*psz );
    EngFunc_PlaybackEvent,		// void )			( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
    EngFunc_CheckVisibility,			//)		( const edict_t *entity, unsigned char *pset );
    EngFunc_GetCurrentPlayer,			//)		( void );
    EngFunc_CanSkipPlayer,			//)			( const edict_t *player );
    EngFunc_SetGroupMask,				//)			( int mask, int op );
    EngFunc_GetClientListening,	// bool (int iReceiver, int iSender)
    EngFunc_SetClientListening,	// bool (int iReceiver, int iSender, bool Listen)
    EngFunc_MessageBegin,	// void (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
    EngFunc_WriteCoord,		// void (float)
    EngFunc_WriteAngle,		// void (float)
    EngFunc_InfoKeyValue,	// char*	)			(char *infobuffer, char *key);
    EngFunc_SetKeyValue,	// void )			(char *infobuffer, char *key, char *value);
    EngFunc_SetClientKeyValue	 // void )		(int clientIndex, char *infobuffer, char *key, char *value);
};

DLL Function Constants
enum
{
    DLLFunc_GameInit,	// void)			( void );
    DLLFunc_Spawn,	// int )				( edict_t *pent );
    DLLFunc_Think,	// void )				( edict_t *pent );
    DLLFunc_Use,	// void )				( edict_t *pentUsed, edict_t *pentOther );
    DLLFunc_Touch,	// void )				( edict_t *pentTouched, edict_t *pentOther );
    DLLFunc_Blocked,	// void )			( edict_t *pentBlocked, edict_t *pentOther );
    DLLFunc_KeyValue,	// void )			( edict_t *pentKeyvalue, KeyValueData *pkvd );
    DLLFunc_SetAbsBox,			// void )			( edict_t *pent );

    DLLFunc_ClientConnect,		// bool)		( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );

    DLLFunc_ClientDisconnect,	// void )	( edict_t *pEntity );
    DLLFunc_ClientKill,		// void )		( edict_t *pEntity );
    DLLFunc_ClientPutInServer,	// void )	( edict_t *pEntity );
    DLLFunc_ClientCommand,		// void )		( edict_t *pEntity );

    DLLFunc_ServerDeactivate,	// void)	( void );

    DLLFunc_PlayerPreThink,		// void )	( edict_t *pEntity );
    DLLFunc_PlayerPostThink,		// void )	( edict_t *pEntity );

    DLLFunc_StartFrame,		// void )		( void );
    DLLFunc_ParmsNewLevel,		// void )		( void );
    DLLFunc_ParmsChangeLevel,	// void )	( void );

     // Returns string describing current .dll.  E.g., TeamFotrress 2, Half-Life
    DLLFunc_GetGameDescription,	 // const char * )( void );

    // Spectator funcs
    DLLFunc_SpectatorConnect,	// void)		( edict_t *pEntity );
    DLLFunc_SpectatorDisconnect,	// void )	( edict_t *pEntity );
    DLLFunc_SpectatorThink,		// void )		( edict_t *pEntity );

    // Notify game .dll that engine is going to shut down.  Allows mod authors to set a breakpoint.
    DLLFunc_Sys_Error,		// void )			( const char *error_string );

    DLLFunc_PM_FindTextureType,	// char )( char *name );
    DLLFunc_RegisterEncoders,	// void )	( void );

    // Enumerates player hulls.  Returns 0 if the hull number doesn't exist, 1 otherwise
    DLLFunc_GetHullBounds,	// int)	( int hullnumber, float *mins, float *maxs );

    // Create baselines for certain "unplaced" items.
    DLLFunc_CreateInstancedBaseline,	// void ) ( void );
    DLLFunc_pfnAllowLagCompensation,	// int )( void );
    // I know this does not fit with DLLFUNC(), but I dont want another native just for it.
    MetaFunc_CallGameEntity,	// bool	(plid_t plid, const char *entStr,entvars_t *pev);
    DLLFunc_ClientUserInfoChanged // void (idplayer)
};

Pev Constants
enum {
    pev_string_start = 0,
    pev_classname,
    pev_globalname,
    pev_model,
    pev_target,
    pev_targetname,
    pev_netname,
    pev_message,
    pev_noise,
    pev_noise1,
    pev_noise2,
    pev_noise3,
    pev_string_end,
    pev_edict_start,
    pev_chain,
    pev_dmg_inflictor,
    pev_enemy,
    pev_aiment,
    pev_owner,
    pev_groundentity,
    pev_euser1,
    pev_euser2,
    pev_euser3,
    pev_euser4,
    pev_edict_end,
    pev_float_start,
    pev_impacttime,
    pev_starttime,
    pev_idealpitch,
    pev_ideal_yaw,
    pev_pitch_speed,
    pev_yaw_speed,
    pev_ltime,
    pev_nextthink,
    pev_gravity,
    pev_friction,
    pev_frame,
    pev_animtime,
    pev_framerate,
    pev_scale,
    pev_renderamt,
    pev_health,
    pev_frags,
    pev_takedamage,
    pev_max_health,
    pev_teleport_time,
    pev_armortype,
    pev_armorvalue,
    pev_dmg_take,
    pev_dmg_save,
    pev_dmg,
    pev_dmgtime,
    pev_speed,
    pev_air_finished,
    pev_pain_finished,
    pev_radsuit_finished,
    pev_maxspeed,
    pev_fov,
    pev_flFallVelocity,
    pev_fuser1,
    pev_fuser2,
    pev_fuser3,
    pev_fuser4,
    pev_float_end,
    pev_int_start,
    pev_fixangle,
    pev_modelindex,
    pev_viewmodel,
    pev_weaponmodel,
    pev_movetype,
    pev_solid,
    pev_skin,
    pev_body,
    pev_effects,
    pev_light_level,
    pev_sequence,
    pev_gaitsequence,
    pev_rendermode,
    pev_renderfx,
    pev_weapons,
    pev_deadflag,
    pev_button,
    pev_impulse,
    pev_spawnflags,
    pev_flags,
    pev_colormap,
    pev_team,
    pev_waterlevel,
    pev_watertype,
    pev_playerclass,
    pev_weaponanim,
    pev_pushmsec,
    pev_bInDuck,
    pev_flTimeStepSound,
    pev_flSwimTime,
    pev_flDuckTime,
    pev_iStepLeft,
    pev_gamestate,
    pev_oldbuttons,
    pev_groupinfo,
    pev_iuser1,
    pev_iuser2,
    pev_iuser3,
    pev_iuser4,
    pev_int_end,
    pev_byte_start,
    pev_controller_0,
    pev_controller_1,
    pev_controller_2,
    pev_controller_3,
    pev_blending_0,
    pev_blending_1,
    pev_byte_end,
    pev_bytearray_start,
    pev_controller,
    pev_blending,
    pev_bytearray_end,
    pev_vecarray_start,
    pev_origin,
    pev_oldorigin,
    pev_velocity,
    pev_basevelocity,
    pev_clbasevelocity,
    pev_movedir,
    pev_angles,
    pev_avelocity,
    pev_v_angle,
    pev_endpos,
    pev_startpos,
    pev_absmin,
    pev_absmax,
    pev_mins,
    pev_maxs,
    pev_size,
    pev_rendercolor,
    pev_view_ofs,
    pev_vuser1,
    pev_vuser2,
    pev_vuser3,
    pev_vuser4,
    pev_punchangle,
    pev_vecarray_end
};

Forward Function Constants
    FM_PrecacheModel = 1,	// done
    FM_PrecacheSound,	// done
    FM_SetModel,		// done
    FM_ModelIndex,		// done
    FM_ModelFrames,	// done
    FM_SetSize,		// done
    FM_ChangeLevel,			// done
    FM_VecToYaw,			// done
    FM_VecToAngles,			// done
    FM_MoveToOrigin,		// done
    FM_ChangeYaw,			// done
    FM_ChangePitch,			// done
    FM_FindEntityByString,	// done
    FM_GetEntityIllum,		// done
    FM_FindEntityInSphere,	// done
    FM_FindClientInPVS,		// done
    FM_EntitiesInPVS,		// done
    FM_MakeVectors,			// done
    FM_AngleVectors,		// done
    FM_CreateEntity,		// done
    FM_RemoveEntity,		// done
    FM_CreateNamedEntity,	// done
    FM_MakeStatic,			// done
    FM_EntIsOnFloor,		// done
    FM_DropToFloor,			// done
    FM_WalkMove,			// int  )				(edict_t *ent, float yaw, float dist, int iMode); -- does't work as of 0.20 RC2
    FM_SetOrigin,			// done
    FM_EmitSound,			// done
    FM_EmitAmbientSound,	// done
    FM_TraceLine,			// void )				(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); -- does't work as of 0.20 RC2
    FM_TraceToss,			// void )				(edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr); -- does't work as of 0.20 RC2
    FM_TraceMonsterHull,	// int  )		(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); -- does't work as of 0.20 RC2
    FM_TraceHull,			// void )				(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);  -- does't work as of 0.20 RC2
    FM_TraceModel,			// void )			(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);  -- does't work as of 0.20 RC2
    FM_TraceTexture,		// const char *)			(edict_t *pTextureEntity, const float *v1, const float *v2 ); -- does't work as of 0.20 RC2
    FM_TraceSphere,			// void )			(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);  -- does't work as of 0.20 RC2
    FM_GetAimVector,		// done
    FM_ParticleEffect,		// done
    FM_LightStyle,			// done
    FM_DecalIndex,			// done
    FM_PointContents,		// done
    FM_MessageBegin,		// done
    FM_MessageEnd,			// done
    FM_WriteByte,			// done
    FM_WriteChar,			// done
    FM_WriteShort,			// done
    FM_WriteLong,			// done
    FM_WriteAngle,			// done
    FM_WriteCoord,			// done
    FM_WriteString,			// done
    FM_WriteEntity,			// done
    FM_CVarGetFloat,		// done
    FM_CVarGetString,		// done
    FM_CVarSetFloat,		// done
    FM_CVarSetString,		// done
    FM_FreeEntPrivateData,	// done
    FM_SzFromIndex,			// done
    FM_AllocString,			// done
    FM_RegUserMsg,			// done
    FM_AnimationAutomove,	// done
    FM_GetBonePosition,		// void )		(const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );  -- does't work as of 0.20 RC2
    FM_GetAttachment,		// void	)			(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );  -- does't work as of 0.20 RC2
    FM_SetView,				// done
    FM_Time,				// done
    FM_CrosshairAngle,		// done
    FM_FadeClientVolume,	// done
    FM_SetClientMaxspeed,	// done
    FM_CreateFakeClient,	// done
    FM_RunPlayerMove,		// void )			(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); -- does't work as of 0.20 RC2
    FM_NumberOfEntities,	// done
    FM_StaticDecal,			// done
    FM_PrecacheGeneric,		// done
    FM_BuildSoundMsg,		// void )			(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);  -- does't work as of 0.20 RC2
    FM_GetPhysicsKeyValue,	// done
    FM_SetPhysicsKeyValue,	// done
    FM_GetPhysicsInfoString,// done
    FM_PrecacheEvent,		// done
    FM_PlaybackEvent,		// done
    FM_CheckVisibility,			//)		(
    FM_GetCurrentPlayer,			// done
    FM_CanSkipPlayer,			// done
    FM_SetGroupMask,				//done
    FM_Voice_GetClientListening,	// done
    FM_Voice_SetClientListening,	// done
    FM_InfoKeyValue,	// done
    FM_SetKeyValue,	// done
    FM_SetClientKeyValue,	 // done
    FM_GetPlayerAuthId,	// done
    FM_GetPlayerWONId,	// done
    FM_IsMapValid,	// done

    FM_Spawn,	// done
    FM_Think,	// done
    FM_Use,	// done
    FM_Touch,	// done
    FM_Blocked,	// done
    FM_KeyValue,	// void )			( edict_t *pentKeyvalue, KeyValueData *pkvd ); -- does't work as of 0.20 RC2
    FM_SetAbsBox,			// done
    FM_ClientConnect,		// done

    FM_ClientDisconnect,	// done
    FM_ClientKill,		// done
    FM_ClientPutInServer,	// done
    FM_ClientCommand,		// done

    FM_ServerDeactivate,	// done

    FM_PlayerPreThink,		// done
    FM_PlayerPostThink,		// done

    FM_StartFrame,		// done
    FM_ParmsNewLevel,		// done
    FM_ParmsChangeLevel,	// done

     // Returns string describing current .dll.  E.g., TeamFotrress 2, Half-Life
    FM_GetGameDescription,	 // done

    // Spectator funcs
    FM_SpectatorConnect,	// done
    FM_SpectatorDisconnect,	// done
    FM_SpectatorThink,		// done

    // Notify game .dll that engine is going to shut down.  Allows mod authors to set a breakpoint.
    FM_Sys_Error,		// done

    FM_PM_FindTextureType,	// done
    FM_RegisterEncoders,	// done

    // Enumerates player hulls.  Returns 0 if the hull number doesn't exist, 1 otherwise

    // Create baselines for certain "unplaced" items.
    FM_CreateInstancedBaseline,	// done
    FM_AllowLagCompensation,	// done
    FM_AlertMessage, //done (at_type, message[])
};

TraceResult Constants
enum TraceResult
{
    TR_AllSolid,
    TR_StartSolid,
    TR_InOpen,
    TR_InWater,
    TR_flFraction,
    TR_vecEndPos,
    TR_flPlaneDist,
    TR_vecPlaneNormal,
    TR_pHit,
    TR_iHitgroup,
};

Functions
dllfunc - Calls a Half-Life engine DLL function.
engfunc - Calls a Half-Life engine function.
forward_return - Returns data for a hook.
get_pdata_float - Gets private data from an entity's memory block
get_pdata_int - Gets private data from an entity's memory block
get_tr - Returns value of tr_member within the trace.
pev - Returns edict data from an entity.
register_forward - Registers a forward in the HL engine
set_pdata_float - Sets private data from an entity's memory block
set_pdata_int - Sets private data from an entity's memory block
set_pev - Sets edict data on an entity.
set_tr - Sets value of tr_member within the trace.


dllfunc
Fakemeta (fakemeta.inc)
Description
dllfunc - Calls a Half-Life engine DLL function.
Syntax
dllfunc ( type, [ ... ] )
Type
Native
Notes
type is an DllFunc_* function type, which can be referenced in fakemeta_const.inc

Make sure the parameters passed are appropriate and match types, otherwise the engine can crash.


engfunc
Fakemeta (fakemeta.inc)
Description
engfunc - Calls a Half-Life engine function.
Syntax
engfunc ( type, [ ... ] )
Type
Native
Notes
type is an EngFunc_* function type, which can be referenced in fakemeta_const.inc

Make sure the parameters passed are appropriate and match types, otherwise the engine can crash.


forward_return
Fakemeta (fakemeta.inc)
Description
forward_return - Returns data for a hook.
Syntax
forward_return ( type, [ ... ] )
Type
Native
Notes
forward_return can only be called inside a public function called by register_forward.

Type is one of three types:
#define FMV_STRING 1
#define FMV_FLOAT 2
#define FMV_CELL 3

The second parameter must correspondingly be a string, float, or number.

This is similar to RETURN_META_VALUE(..., value);


get_pdata_float
Fakemeta (fakemeta.inc)
Description
get_pdata_float - Gets private data from an entity's memory block
Syntax
Float: get_pdata_float ( index, offset, [ linuxdiff = 5 ] )
Type
Native
Notes
Gets private data from an entity's void *pvPrivateData memory block.

index is the numerical entity index.
offset is the numerical offset into the memory block, as an C-type float.

If the server is running linux, the linuxdiff parameter is added to the offset.


get_pdata_int
Fakemeta (fakemeta.inc)
Description
get_pdata_int - Gets private data from an entity's memory block
Syntax
get_pdata_int ( index, offset, [ linuxdiff = 5 ] )
Type
Native
Notes
Gets private data from an entity's void *pvPrivateData memory block.

index is the numerical entity index.
offset is the numerical offset into the memory block, as an C-type integer.

If the server is running linux, the linuxdiff parameter is added to the offset.


get_tr
Fakemeta (fakemeta.inc)
Description
get_tr - Returns value of tr_member within the trace.
Syntax
get_tr ( TraceResult:tr_member, [ ... ] )
Type
Native
Notes
Only use this with functions that pass a Trace, such as a TraceLine forward registered with FakeMeta.

With no extra parameters this returns an integer value. With one extra parameter this a returns float or vector value by reference.


pev
Fakemeta (fakemeta.inc)
Description
pev - Returns edict data from an entity.
Syntax
pev ( index, value, [ ... ] )
Type
Native
Notes
index is the numerical entity index.
value is the section of the edict_t for retrieval. Consult fakemeta_const.inc for the list of Pev_* types you can use.

To retrieve an integer, supply no extra parameters.
To retrieve a float, pass a single float by reference.
To retrieve a string, pass a string array and max length.
User Contributed Notes
Freecode Sep-21-04 19:06:02
example on how to use as to comparing to health
new health = get_user_health(id);
//fakemeta way using pev
new health = pev(id,pev_health);

set_user_health(id,100);
//fakemeta way using pev
set_pev(id,pev_health,100);


register_forward
Fakemeta (fakemeta.inc)
Description
register_forward - Registers a forward in the HL engine
Syntax
register_forward ( forwardType, callback[], [ post = 0 ] )
Type
Native
Notes
This will hook a function in the HL engine or mod DLL and forward it to a function in an AMXx plugin.

forwardType is a forward identifer type, such as FM_PrecacheModel, which selects the function to hook.
callback[] is a string which identifies the public function to call when the forward is hooked.

If post is set to 1, the function is a "POST" function in metamod, which means that it is called AFTER the engine has called the original. This also means you cannot block the original function.

Note that using this native incorrectly can crash the Half-Life engine. Each forward should exactly match the parameters in the fakemeta_const.inc file. To find parameter types from original HL engine functions, use this chart:

const char * = str[]
int = num
float = Float:flt
float * = Float:vFlt[3]

To return data inside the hooked call, use forward_return.
To block a function as you would in Metamod, use these return values:

#define FMRES_HANDLED 2
#define FMRES_SUPERCEDE 4
#define FMRES_IGNORED 1
#define FMRES_OVERRIDE 3


set_pdata_float
Fakemeta (fakemeta.inc)
Description
set_pdata_float - Sets private data from an entity's memory block
Syntax
set_pdata_float ( index, offset, Float:value, [ linuxdiff = -5 ] )
Type
Native
Notes
Sets private data on an entity's void *pvPrivateData memory block.

index is the numerical entity index.
offset is the numerical offset into the memory block, as an C-type integer.
value is the value to set.

If the server is running linux, the linuxdiff parameter is added to the offset.


set_pdata_int
Fakemeta (fakemeta.inc)
Description
set_pdata_int - Sets private data from an entity's memory block
Syntax
set_pdata_int ( index, offset, value, [ linuxdiff = -5 ] )
Type
Native
Notes
Sets private data on an entity's void *pvPrivateData memory block.

index is the numerical entity index.
offset is the numerical offset into the memory block, as an C-type integer.
value is the value to set.

If the server is running linux, the linuxdiff parameter is added to the offset.


set_pev
Fakemeta (fakemeta.inc)
Description
set_pev - Sets edict data on an entity.
Syntax
set_pev ( index, value, [ ... ] )
Type
Native
Notes
index is the numerical index of the entity.
value is the edict section to set data on. View fakemeta_const.inc to see the list of Pev_* types to use.

The third parameter can be a string, float, or number.


set_tr
Fakemeta (fakemeta.inc)
Description
set_tr - Sets value of tr_member within the trace.
Syntax
set_tr ( TraceResult:tr_member, [ ... ] )
Type
Native
Notes
Only use this with functions that pass a Trace, such as a TraceLine forward registered with FakeMeta.
User Contributed Notes
XxAvalanchexX at hotmail dot com Jan-31-05 04:59:01
Example:
public plugin_init()
{
   register_forward(FM_TraceLine,"traceline",1);
}

public traceline(Float:v1[3],Float:v2[3],noMonsters,pentToSkip)
{
   if(is_user_connected(pentToSkip) && is_user_alive(pentToSkip))
   {
      set_tr(TR_pHit,pentToSkip); // make users shoot themselves
   }
}


Fun
Content:
  • Notes
  • Functions
  • User Contributed Notes
Notes
The Fun module is enabled by default. It is totally rewritten from the original one developed by OLO, and is maintained by Johnny Got His Gun. Its purpose is to provide extra "cheating" functions that the Core does not provide - functions that modify gameplay rules such as health, armor, and player properties.

The Fun module has one include:
  • fun.inc (Extra generic functions for gameplay modification.)

Fun Module has only a few constants:
  • Hitzone Constants:
  • Render Constants:
  • FX Constants:

Hitzone Constants:
HIT_GENERIC		0
HIT_HEAD		1
HIT_CHEST		2
HIT_STOMACH		3
HIT_LEFTARM		4
HIT_RIGHTARM		5
HIT_LEFTLEG		6
HIT_RIGHTLEG		7

Rendering Constants:
enum {
    kRenderNormal = 0,		/* src */
    kRenderTransColor,		/* c*a+dest*(1-a) */
    kRenderTransTexture,		/* src*a+dest*(1-a) */
    kRenderGlow,			/* src*a+dest -- No Z buffer checks */
    kRenderTransAlpha,		/* src*srca+dest*(1-srca) */
    kRenderTransAdd,		/* src*a+dest */
}

FX Constants:
enum {
    kRenderFxNone = 0,
    kRenderFxPulseSlow,
    kRenderFxPulseFast,
    kRenderFxPulseSlowWide,
    kRenderFxPulseFastWide,
    kRenderFxFadeSlow,
    kRenderFxFadeFast,
    kRenderFxSolidSlow,
    kRenderFxSolidFast,
    kRenderFxStrobeSlow,
    kRenderFxStrobeFast,
    kRenderFxStrobeFaster,
    kRenderFxFlickerSlow,
    kRenderFxFlickerFast,
    kRenderFxNoDissipation,
    kRenderFxDistort,		/* Distort/scale/translate flicker */
    kRenderFxHologram,		/* kRenderFxDistort + distance fade */
    kRenderFxDeadPlayer,		/* kRenderAmt is the player index */
    kRenderFxExplode,		/* Scale up really big! */
    kRenderFxGlowShell,		/* Glowing Shell */
    kRenderFxClampMinScale,		/* Keep this sprite from getting very small (SPRITES only!) */
}
Functions
get_client_listen - Returns 1 if receiver hears sender via voice communication.
get_user_godmode - Returns 1 if godmode is set.
get_user_gravity - Returns users gravity
get_user_hitzones - Get user hitzones.
get_user_maxspeed - Returns users max. speed.
get_user_noclip - Returns 1 if noclip is set on a player.
give_item - Gives an item to a player.
set_client_listen - Sets who can listen who.
set_user_armor - Sets player armor.
set_user_footsteps - Gives player silent footsteps if set is 1.
set_user_godmode - Sets player godmode. If you want to disable godmode set only first parameter.
set_user_gravity - Sets users gravity
set_user_health - Sets player health.
set_user_hitzones - Sets hit zones for player.
set_user_maxspeed - Sets a user's maxspeed
set_user_noclip - Sets player noclip. If you want to disable noclip set only first parameter.
set_user_origin - Move player to origin
set_user_rendering - Sets player rendering mode.
spawn - Spawns entity.
strip_user_weapons - Strips all weapons from user
User Contributed Notes
mobsterbob769 at netscape dot net Aug-21-05 21:03:23
68.190.40.105:27014


get_client_listen
Fun (fun.inc)
Description
get_client_listen - Returns 1 if receiver hears sender via voice communication.
Syntax
get_client_listen ( receiver, sender )
Type
Native
Notes
receiver and sender are player indices from 1 to 32.


get_user_godmode
Fun (fun.inc)
Description
get_user_godmode - Returns 1 if godmode is set.
Syntax
get_user_godmode ( index )
Type
Native
Notes
index is a player index from 1 to 32.


get_user_gravity
Fun (fun.inc)
Description
get_user_gravity - Returns users gravity
Syntax
get_user_gravity ( index )
Type
Native
Notes
index is a player index from 1 to 32.


get_user_hitzones
Fun (fun.inc)
Description
get_user_hitzones - Get user hitzones.
Syntax
get_user_hitzones ( index, target )
Type
Native
Notes
To get what bodyparts a player can hit when firing, set the player's index to index and target to 0.

To get what bodyparts other players can hit when firing at player, set index to 0 and target to player's index.


get_user_maxspeed
Fun (fun.inc)
Description
get_user_maxspeed - Returns users max. speed.
Syntax
Float: get_user_maxspeed ( index )
Type
Native
Notes
index is a player index from 1 to 32.


get_user_noclip
Fun (fun.inc)
Description
get_user_noclip - Returns 1 if noclip is set on a player.
Syntax
get_user_noclip ( index )
Type
Native
Notes
index is a player index from 1 to 32.


give_item
Fun (fun.inc)
Description
give_item - Gives an item to a player.
Syntax
give_item ( index, const item[] )
Type
Native
Notes
The name of the item may start with weapon_, ammo_ or item_.
index is a player index from 1 to 32.
User Contributed Notes
clansnort at yahoo dot com Mar-26-05 23:44:49
This is not for use in-game; it is for use in a plugins code.

paralyzedsk8er at msn dot com Feb-27-05 13:38:46
hey, can anyone tell me where to find the index for a player. also, where can i find the const item[] ive been having probs with all of the fun commands. im using amx_rcon CVAR - with full admin powers. can anyone help ? thanks, Steve-o CoGS - Community of Gaming Scotland


set_client_listen
Fun (fun.inc)
Description
set_client_listen - Sets who can listen who.
Syntax
set_client_listen ( receiver, sender, listen )
Type
Native
Notes
The function returns 0 if for some reasons this setting can't be done.
Receiver and sender are players indices from 1 to 32.


set_user_armor
Fun (fun.inc)
Description
set_user_armor - Sets player armor.
Syntax
set_user_armor ( index, armor )
Type
Native
Notes
index is a player index from 1 to 32.


set_user_footsteps
Fun (fun.inc)
Description
set_user_footsteps - Gives player silent footsteps if set is 1.
Syntax
set_user_footsteps ( id, [ set = 1 ] )
Type
Native
Notes
index is a player index from 1 to 32.

The set parameter can be used toggle the footsteps on or off.


set_user_godmode
Fun (fun.inc)
Description
set_user_godmode - Sets player godmode. If you want to disable godmode set only first parameter.
Syntax
set_user_godmode ( index, [ godmode = 0 ] )
Type
Native
Notes
index is a player index from 1 to 32.


set_user_gravity
Fun (fun.inc)
Description
set_user_gravity - Sets users gravity
Syntax
Float: set_user_gravity ( index, [ Float:gravity = 1.0 ] )
Type
Native
Notes
index is a player index from 1 to 32.

Gravity is a float which defaults to 1.0. Since sv_gravity defaults to 800, you should proportion input right to get the correct results. IE: 1.0 is 800, 2.0 is 1600, 0.5 is 400, and so on.


set_user_health
Fun (fun.inc)
Description
set_user_health - Sets player health.
Syntax
set_user_health ( index, health )
Type
Native
Notes
index is a player index from 1 to 32.
User Contributed Notes
Freeecode at hotmail dot com Jun-24-04 20:45:11
Note that health will not go above 255. If you set user's health to 256 it will show 1. If you shot that person and do 5 damage it will then show 251.


set_user_hitzones
Fun (fun.inc)
Description
set_user_hitzones - Sets hit zones for player.
Syntax
set_user_hitzones ( [ index = 0, target = 0, body = 255 [ )
Type
Native
Notes
Sets hit zones for player.
Parts of body are as bits:
1 - generic
2 - head
4 - chest
8 - stomach
16 - left arm
32 - right arm
64 - left leg
128 - right leg

Set index to a player's index and leave target at 0 to define what bodyparts this player can hit when he is firing.

Set index to 0 and target to a player's index to define what bodyparts on player other players can hit when they are firing.

Set both index and target to 0 to define globally what bodyparts people can hit and what bodyparts can be hit when firing.
Example: ( Make a single player fire blanks )

set_user_hitzones(index, 0, 0)

Remember that this funtion does NOT affect grenades and knives.
User Contributed Notes
storm at stormwc3 dot com Jul-21-04 09:55:46
there seems to be a bug with the set_user_hitzones in the amxmodx. i have a blanks plugin, but instead of giving the player blanks, it sets them to godmode (giving everyone blanks when shooting at that player). code: new player = cmd_target(id, arg, 5) if(!player) return PLUGIN_HANDLED set_user_hitzones(player, 0, 0) seems to be looking at the code like set_user_hitzones(0, player, 0) this plugin worked perfect under amx mod


set_user_maxspeed
Fun (fun.inc)
Description
set_user_maxspeed - Sets a user's maxspeed
Syntax
Float: set_user_maxspeed ( index, [ Float:speed = - 1.0 ] )
Type
Native
Notes
index is a player index from 1 to 32.

Speed defaults to -1.0.

If you set a user's maxspeed to 0.0 they will be able to run normal speed. Set it to 0.1 if you wish to stop them from moving completely.
User Contributed Notes
Freeecode at hotmail dot com Jun-24-04 20:43:26
Note that the speed is reset once you change your weapon and on New Round. So the best way to keep the speed that you want is set it in the Weapon Event.


set_user_noclip
Fun (fun.inc)
Description
set_user_noclip - Sets player noclip. If you want to disable noclip set only first parameter.
Syntax
set_user_noclip ( index, [ noclip = 0 ] )
Type
Native
Notes
index is a player index from 1 to 32.

Setting the second parameter sets noclip on.


set_user_origin
Fun (fun.inc)
Description
set_user_origin - Move player to origin
Syntax
set_user_origin ( index, origin[3] )
Type
Native
Notes
index is a player index from 1 to 32.

Example:
public MovePlayer(id)

    new origin[3]
    get_user_origin(id,origin,0)  // Gets the current location the player is at
    origin[2] = origin[2] + 10    // Adds + 10 to the players hight
    set_user_origin(id,origin)   // Moves the player to the location stored in origin
}


set_user_rendering
Fun (fun.inc)
Description
set_user_rendering - Sets player rendering mode.
Syntax
set_user_rendering ( index, [ fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16 ] )
Type
Native
Notes
Example: ( Make a player Glow red )

set_user_rendering(index,kRenderFxGlowShell,255,0,0,kRenderNormal,25)

Example: ( Remove the glow)

set_user_rendering(index,kRenderFxGlowShell,0,0,0,kRenderNormal,25)

A list of different render modes:
kRenderNormal = 0, /* src */
kRenderTransColor, /* c*a+dest*(1-a) */
kRenderTransTexture, /* src*a+dest*(1-a) */
kRenderGlow, /* src*a+dest -- No Z buffer checks */
kRenderTransAlpha, /* src*srca+dest*(1-srca) */
kRenderTransAdd, /* src*a+dest */

A list of different render effects:
kRenderFxNone = 0,
kRenderFxPulseSlow,
kRenderFxPulseFast,
kRenderFxPulseSlowWide,
kRenderFxPulseFastWide,
kRenderFxFadeSlow,
kRenderFxFadeFast,
kRenderFxSolidSlow,
kRenderFxSolidFast,
kRenderFxStrobeSlow,
kRenderFxStrobeFast,
kRenderFxStrobeFaster,
kRenderFxFlickerSlow,
kRenderFxFlickerFast,
kRenderFxNoDissipation,
kRenderFxDistort, /* Distort/scale/translate flicker */
kRenderFxHologram, /* kRenderFxDistort + distance fade */
kRenderFxDeadPlayer, /* kRenderAmt is the player index */
kRenderFxExplode, /* Scale up really big! */
kRenderFxGlowShell, /* Glowing Shell */
kRenderFxClampMinScale, /* Keep this sprite from getting very small (SPRITES only!) */
User Contributed Notes
root at Neo-Vortex dot Ath dot Cx Jul-23-04 16:16:58
well, render types, whatever, but yeah, its the second last param, *mutters about them not being listed making me look them up...*

root at Neo-Vortex dot Ath dot Cx Jul-23-04 15:50:01
Some other, non-listed rendering modes (from amxconst.inc): kRenderNormal = 0, // src kRenderTransColor, // c*a+dest*(1-a) kRenderTransTexture, // src*a+dest*(1-a) kRenderGlow, // src*a+dest -- No Z buffer checks kRenderTransAlpha, // src*srca+dest*(1-srca) kRenderTransAdd, // src*a+dest


spawn
Fun (fun.inc)
Description
spawn - Spawns entity.
Syntax
spawn ( index )
Type
Native
User Contributed Notes
XxAvalanchexX at hotmail dot com Feb-05-05 22:40:28
People have had trouble getting this to work, the below seems to be the "correct" way to do it without any bugs: public soandso(id)
{
   spawn(id);
   set_task(0.5,"spawnagain",id);
}

public spawnagain(id) {
   spawn(id);
} You can play around with the 0.5 time.

sniperbeamer at amxmodx dot org Jul-07-04 19:41:54
You might have to use spawn() two times for players.


strip_user_weapons
Fun (fun.inc)
Description
strip_user_weapons - Strips all weapons from user
Syntax
strip_user_weapons ( index )
Type
Native
Notes
Warning ! Don't use this function IN ResetHUD event. This will probably crash server. To fix this use set_task with time more or equal to 0.1 sec.

User Contributed Notes
Radical_mel at hotmail dot com Sep-17-04 00:49:16
Never ever use it in server_frame()


GeoIP
Content:
  • Notes
  • Functions
Notes
The GeoIP module was originally written by dJeyL for AMX and rewritten from scratch by BAILOPAN for AMX Mod X. GeoIP is a database of physical locations for IP addresses, and this module lets you look up entries for players.
  • geoip.inc (Natives for the GeoIP module)
Functions
geoip_code2 - Gets a two character country code.
geoip_code3 - Gets a three character country code.
geoip_country - Gets a full country name.


geoip_code2
GeoIP (geoip.inc)
Description
geoip_code2 - Gets a two character country code.
Syntax
geoip_code2 ( ip[], ccode[3] )
Type
Native


geoip_code3
GeoIP (geoip.inc)
Description
geoip_code3 - Gets a three character country code.
Syntax
geoip_code3 ( ip[], ccode[4] )
Type
Native


geoip_country
GeoIP (geoip.inc)
Description
geoip_country - Gets a full country name.
Syntax
geoip_country ( ip[], result[], [ len = 45 ] )
Type
Native
Notes
Max name is 45 characters.


NS
Content:
  • Notes
  • Functions
Notes
The Natural-Selection module was developed by Mahnsawce as NS2AMX.
It has been split and trimmed down for AMXx to fit into our organizational design scheme.
Combined with engine, it still contains all the functionality of NS2AMX.
  • ns.inc (Base natives for Natural-Selection)
  • ns_const.inc (Constant definitions for NS)
  • ns2amx.inc (Backwards compatibility layer)
The NS module contains the following constants:
  • Player Mask Constants
  • Class Constants
  • Weapon Constants
  • Hive Trait Constants
Player Mask Constants
enum {
    MASK_NONE = 0,
    MASK_SIGHTED = 1,
    MASK_DETECTED = 2,
    MASK_BUILDABLE = 4,
    MASK_BASEBUILD0 = 8,		// Base build slot #0
    MASK_WEAPONS1 = 8,		// Marine weapons 1
    MASK_CARAPACE = 8,		// Alien carapace
    MASK_WEAPONS2 = 16,		// Marines weapons 2
    MASK_REGENERATION = 16,		// Alien regeneration
    MASK_BASEBUILD1 = 16,		// Base build slot #1
    MASK_WEAPONS3 = 32,		// Marine weapons 3
    MASK_REDEMPTION = 32,		// Alien redemption
    MASK_BASEBUILD2 = 32,		// Base build slot #2
    MASK_ARMOR1 = 64,		// Marine armor 1
    MASK_CELERITY = 64,		// Alien celerity
    MASK_BASEBUILD3 = 64,		// Base build slot #3
    MASK_ARMOR2 = 128,		// Marine armor 2
    MASK_ADRENALINE = 128,		// Alien adrenaline
    MASK_BASEBUILD4 = 128,		// Base build slot #4
    MASK_ARMOR3 = 256,		// Marine armor 3
    MASK_SILENCE = 256,		// Alien silence
    MASK_BASEBUILD5 = 256,		// Base build slot #5
    MASK_JETPACK = 512,		// Marine jetpacks
    MASK_CLOAKING = 512,		// Alien cloaking
    MASK_BASEBUILD6 = 512,		// Base build slot #6
    MASK_FOCUS = 1024,		// Alien focus
    MASK_MOTION = 1024,		// Marine motion tracking
    MASK_BASEBUILD7 = 1024,		// Base build slot #7
    MASK_SCENTOFFEAR = 2048,	// Alien scent of fear
    MASK_DEFENSE2 = 4096,		// Defense level 2
    MASK_DEFENSE3 = 8192,		// Defense level 3
    MASK_ELECTRICITY = 8192,	// Electricy
    MASK_MOVEMENT2 = 16384,		// Movement level 2,
    MASK_MOVEMENT3 = 32768,		// Movement level 3
    MASK_HEAVYARMOR = 32768,	// Marine heavy armor
    MASK_SENSORY2 = 65536,		// Sensory level 2
    MASK_SENSORY3 = 131072,		// Sensory level 3
    MASK_ALIEN_MOVEMENT = 262144,	// Onos is charging
    MASK_WALLSTICKING = 524288,	// Flag for wall-sticking
    MASK_PRIMALSCREAM = 1048576,	// Alien is in range of active primal scream
    MASK_UMBRA = 2097152,		// In umbra
// When set on a visible player, player is digesting.  When set on invisible player, player is being digested
    MASK_DIGESTING = 4194304,
    MASK_RECYCLING = 8388608,	// Building is recycling
    MASK_TOPDOWN = 16777216,	// Commander view
    MASK_PLAYER_STUNNED = 33554432,	// Player has been stunned by stomp
    MASK_ENSNARED = 67108864,	// Webbed
    MASK_ALIEN_EMBRYO = 268435456,	// Gestating
    MASK_SELECTABLE = 536870912,	// ???
    MASK_PARASITED = 1073741824,	// Parasite flag
    MASK_SENSORY_NEARBY = 2147483648	// Sensory chamber in range

}

Class Constants
enum {
    CLASS_UNKNOWN = 0,
    CLASS_SKULK,
    CLASS_GORGE,
    CLASS_LERK,
    CLASS_FADE,
    CLASS_ONOS,
    CLASS_MARINE,
    CLASS_JETPACK,
    CLASS_HEAVY,
    CLASS_COMMANDER,
    CLASS_GESTATE,
    CLASS_DEAD,
    CLASS_NOTEAM
}

Weapon Constants
enum {
    WEAPON_NONE = 0,
    WEAPON_CLAWS,
    WEAPON_SPIT,
    WEAPON_SPORES,
    WEAPON_SPIKE,
    WEAPON_BITE,
    WEAPON_BITE2,
    WEAPON_SWIPE,
    WEAPON_WEBSPINNER,
    WEAPON_METABOLIZE,
    WEAPON_PARASITE,
    WEAPON_BLINK,
    WEAPON_DIVINEWIND,
    WEAPON_KNIFE,
    WEAPON_PISTOL,
    WEAPON_LMG,
    WEAPON_SHOTGUN,
    WEAPON_HMG,
    WEAPON_WELDER,
    WEAPON_MINE,
    WEAPON_GRENADE_GUN,
    WEAPON_LEAP,
    WEAPON_CHARGE,
    WEAPON_UMBRA,
    WEAPON_PRIMALSCREAM,
    WEAPON_BILEBOMB,
    WEAPON_ACIDROCKET,
    WEAPON_HEALINGSPRAY,
    WEAPON_GRENADE,
    WEAPON_STOMP,
    WEAPON_DEVOUR,
    WEAPON_MAX
}

Hive Trait Constants
enum {
    HIVETRAIT_NONE	= 0,
    HIVETRAIT_DC	= 92,
    HIVETRAIT_SC	= 93,
    HIVETRAIT_MC	= 94
}

Functions
client_built - Called whenever the client build's a structure.
client_changeclass - Called whenever the client's class is changed.
client_changeteam - Called when a player's team entvar has changed.
client_spawn - Called when a player's deadflag entvar has changed from > 0 to 0 (when they spawn).
get_class - Same as ns_get_class.
get_mask - Same as ns_get_mask.
get_maxspeed - Same as ns_get_maxspeed.
get_res - Same as ns_get_res, except this returns an integer as opposed to a float.
get_spawn - Same as ns_get_spawn.
get_special - DEPRECATED. Same as ns_get_special.
get_speedchange - Same as ns_get_speedchange.
has_weapon - Same as ns_has_weapon.
is_combat - Same as ns_is_combat.
ns2amx_getammo - Same as ns_get_weap_reserve.
ns2amx_getenergy - Same as ns_get_energy, except this returns an integer as opposed to a float.
ns2amx_gethives - Returns total number of hives.
ns2amx_getjpfuel - Same as ns_get_jp_fuel, except this returns an integer as opposed to a float.
ns2amx_giveitem - Same as ns_give_item.
ns2amx_isdigesting - Returns whether or not the player has the MASK_DIGESTING flag set.
ns2amx_nspopup - Same as ns_popup, except length of message parameter.
ns2amx_setammo - Same as ns_set_weap_reserve.
ns2amx_setjpfuel - Same as ns_set_jp_fuel, except this takes value as an integer as opposed to a float.
ns2amx_setres - Same as ns_set_res.
ns_get_build - Returns built/unbuilt structures.
ns_get_class - Returns the class of the player.
ns_get_deaths - Gets a player's death count.
ns_get_energy - Returns a player's percentage of adrenaline. (alien players only)
ns_get_ent - DEPRECATED. Returns the number of specified entities in the map.
ns_get_exp - Returns a player's experience. (combat maps only)
ns_get_hive_trait - Gets the trait type tied to the hive.
ns_get_jpfuel - Returns a player's percentage of JP fuel.
ns_get_mask - Returns whether or not this mask is set from the entity's iuser4 field.
ns_get_maxspeed - Returns a player's maxspeed.
ns_get_points - Gets a player's point spent value in combat.
ns_get_res - Returns a player's resources.
ns_get_score - Gets a player's score.
ns_get_spawn - Gets spawn points for specified team.
ns_get_speedchange - Returns the speed change of a player.
ns_get_struct_owner - Gets the index of the owner of a structure.
ns_get_weap_clip - Gets a weapon's clip ammo.
ns_get_weap_dmg - Gets a weapon's damage.
ns_get_weap_range - Gets a weapon's range.
ns_get_weap_reserve - Gets the player's weapon reserve for the specified type of weapon.
ns_give_item - Give a player an item.
ns_has_weapon - Returns if the player has the weapon or not in their pev->weapons field.
ns_is_combat - Returns 1 if the map is in combat, 0 otherwise.
ns_popup - Sends a popup to a player.
ns_set_deaths - Sets a player's death count.
ns_set_energy - Sets a player's percentage of adrenaline. (alien players only)
ns_set_exp - Set's a player's experience. (combat maps only)
ns_set_fov - Sets the players field of view.
ns_set_hive_trait - Sets the trait type tied to the hive.
ns_set_jpfuel - Sets a player's percentage of JP fuel.
ns_set_mask - Sets or removes the mask from the entity's iuser4 field.
ns_set_menu - DEPRECATED. Configures display of the custom menus.
ns_set_player_body - Sets a player's body.
ns_set_player_model - Sets a player's model.
ns_set_player_skin - Sets a player's skin.
ns_set_points - Sets a player's point spent value in combat.
ns_set_res - Sets a player's resources. (alien players only)
ns_set_score - Sets a player's score.
ns_set_speedchange - Used to change a player's speed change.
ns_set_struct_owner - Sets the index of the owner of a structure.
ns_set_weap_clip - Sets a weapon's clip ammo.
ns_set_weap_dmg - Sets a weapon's damage.
ns_set_weap_range - Sets a weapon's range.
ns_set_weap_reserve - Sets the player's weapon reserve for the specified type of weapon.
ns_show_menu - DEPRECATED. Displays a custom menu.
ns_spawn_player - DEPRECATED. Forces a player to spawn.
set_mask - Same as ns_set_mask.
set_player_body - Same as ns_set_player_body.
set_player_model - Same as ns_set_player_model.
set_player_skin - Same as ns_set_player_skin.
set_speedchange - Same as ns_set_speedchange.


client_built
NS (ns.inc)
Description
client_built - Called whenever the client build's a structure.
Syntax
client_built ( index, structure, type, impulse )
Type
Forward
Notes
If type is 1, it's a Marine structure. If type is 2, it's an Alien structure.


client_changeclass
NS (ns.inc)
Description
client_changeclass - Called whenever the client's class is changed.
Syntax
client_changeclass ( id, newclass, oldclass )
Type
Forward
Notes
Refer to ns_const.inc for the CLASS_* constants.


client_changeteam
NS (ns.inc)
Description
client_changeteam - Called when a player's team entvar has changed.
Syntax
client_changeteam ( index, newteam, oldteam )
Type
Forward


client_spawn
NS (ns.inc)
Description
client_spawn - Called when a player's deadflag entvar has changed from > 0 to 0 (when they spawn).
Syntax
client_spawn ( index )
Type
Forward


get_class
NS (ns2amx.inc)
Description
get_class - Same as ns_get_class.
Syntax
get_class ( index )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_class.


get_mask
NS (ns2amx.inc)
Description
get_mask - Same as ns_get_mask.
Syntax
get_mask ( index, mask )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_mask.


get_maxspeed
NS (ns2amx.inc)
Description
get_maxspeed - Same as ns_get_maxspeed.
Syntax
get_maxspeed ( index )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_maxspeed.


get_res
NS (ns2amx.inc)
Description
get_res - Same as ns_get_res, except this returns an integer as opposed to a float.
Syntax
get_res ( index )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_res.


get_spawn
NS (ns2amx.inc)
Description
get_spawn - Same as ns_get_spawn.
Syntax
get_spawn ( type, number = 0, Float:ret[3] )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_spawn.


get_special
NS (ns2amx.inc)
Description
get_special - DEPRECATED. Same as ns_get_special.
Syntax
get_special ( index, mask )
Type
Stock
Notes
DEPRECATED.

Used for backwards compatabilty. The new name is func:ns_get_special.


get_speedchange
NS (ns2amx.inc)
Description
get_speedchange - Same as ns_get_speedchange.
Syntax
get_speedchange ( index )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_speedchange.


has_weapon
NS (ns2amx.inc)
Description
has_weapon - Same as ns_has_weapon.
Syntax
has_weapon ( index, weapon, [ setweapon = -1] )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_has_weapon.


is_combat
NS (ns2amx.inc)
Description
is_combat - Same as ns_is_combat.
Syntax
is_combat ( )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_is_combat.


ns2amx_getammo
NS (ns2amx.inc)
Description
ns2amx_getammo - Same as ns_get_weap_reserve.
Syntax
ns2amx_getammo ( index, weapon )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_weap_reserve.


ns2amx_getenergy
NS (ns2amx.inc)
Description
ns2amx_getenergy - Same as ns_get_energy, except this returns an integer as opposed to a float.
Syntax
ns2amx_getenergy ( index )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_energy.


ns2amx_gethives
NS (ns2amx.inc)
Description
ns2amx_gethives - Returns total number of hives.
Syntax
ns2amx_gethives ( )
Type
Stock
Notes
This is the same as: ns_get_build("team_hive",1)


ns2amx_getjpfuel
NS (ns2amx.inc)
Description
ns2amx_getjpfuel - Same as ns_get_jp_fuel, except this returns an integer as opposed to a float.
Syntax
ns2amx_getjpfuel ( index )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_get_jp_fuel.


ns2amx_giveitem
NS (ns2amx.inc)
Description
ns2amx_giveitem - Same as ns_give_item.
Syntax
ns2amx_giveitem ( index, classname[] )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_giv_item.


ns2amx_isdigesting
NS (ns2amx.inc)
Description
ns2amx_isdigesting - Returns whether or not the player has the MASK_DIGESTING flag set.
Syntax
ns2amx_isdigesting ( index )
Type
Stock
Notes
This is the same as: ns_get_mask(index,MASK_DIGESTING)


ns2amx_nspopup
NS (ns2amx.inc)
Description
ns2amx_nspopup - Same as ns_popup, except length of message parameter.
Syntax
ns2amx_nspopup ( index, message[190] )
Type
Native
Notes
Used for backwards compatabilty. The new name is ns_popup.


ns2amx_setammo
NS (ns2amx.inc)
Description
ns2amx_setammo - Same as ns_set_weap_reserve.
Syntax
ns2amx_setammo ( index, weapon, value )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_set_weap_reserve.


ns2amx_setjpfuel
NS (ns2amx.inc)
Description
ns2amx_setjpfuel - Same as ns_set_jp_fuel, except this takes value as an integer as opposed to a float.
Syntax
ns2amx_setjpfuel ( index, value )
Type
Native
Notes
Used for backwards compatabilty. The new name is ns_set_jp_fuel.


ns2amx_setres
NS (ns2amx.inc)
Description
ns2amx_setres - Same as ns_set_res.
Syntax
ns2amx_setres ( index, value )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_set_res.


ns_get_build
NS (ns.inc)
Description
ns_get_build - Returns built/unbuilt structures.
Syntax
ns_get_build ( classname[], [ builtOnly = 1 ], [ Number = 0 ] )
Type
Native
Notes
If builtOnly is 1 (default): Only fully built structures are counted.

If builtOnly is 0: Any structure meeting the classname is counted.

If Number is 0 (default): The total number of matching structures is returned.

If Number is any other value: The index of the #th matching structure is returned.


ns_get_class
NS (ns.inc)
Description
ns_get_class - Returns the class of the player.
Syntax
ns_get_class ( index )
Type
Native
Notes
Refer to ns_const.inc for the CLASS_* constants for the return value's meaning.


ns_get_deaths
NS (ns.inc)
Description
ns_get_deaths - Gets a player's death count.
Syntax
ns_get_deaths ( index )
Type
Native


ns_get_energy
NS (ns.inc)
Description
ns_get_energy - Returns a player's percentage of adrenaline. (alien players only)
Syntax
Float: ns_get_energy ( index )
Type
Native


ns_get_ent
NS (ns.inc)
Description
ns_get_ent - DEPRECATED. Returns the number of specified entities in the map.
Syntax
ns_get_ent ( classname[], value )
Type
Native
Notes
This native is DEPRECATED and no longer available for use.

If value is not 0, returns the index of the nth entry in of that entity in the world.


ns_get_exp
NS (ns.inc)
Description
ns_get_exp - Returns a player's experience. (combat maps only)
Syntax
Float: ns_get_exp ( index )
Type
Native


ns_get_hive_trait
NS (ns.inc)
Description
ns_get_hive_trait - Gets the trait type tied to the hive.
Syntax
ns_get_hive_trait ( idHive )
Type
Native
Notes
Refer to ns_const.inc for the HIVETRAIT_* constants.


ns_get_jpfuel
NS (ns.inc)
Description
ns_get_jpfuel - Returns a player's percentage of JP fuel.
Syntax
Float: ns_get_jpfuel ( index )
Type
Native


ns_get_mask
NS (ns.inc)
Description
ns_get_mask - Returns whether or not this mask is set from the entity's iuser4 field.
Syntax
ns_get_mask ( index, mask )
Type
Native
Notes
Use the MASK_* constants in ns_const.inc for referenece.


ns_get_maxspeed
NS (ns.inc)
Description
ns_get_maxspeed - Returns a player's maxspeed.
Syntax
ns_get_maxspeed ( index )
Type
Native
Notes
Returns a player's maxspeed before the speed change is factored in.


ns_get_points
NS (ns.inc)
Description
ns_get_points - Gets a player's point spent value in combat.
Syntax
ns_get_points ( index )
Type
Native


ns_get_res
NS (ns.inc)
Description
ns_get_res - Returns a player's resources.
Syntax
Float: ns_get_res ( index )
Type
Native
Notes
If player is an Alien, returns individual resources. If player is a Marine, returns team resources.


ns_get_score
NS (ns.inc)
Description
ns_get_score - Gets a player's score.
Syntax
ns_get_score ( index )
Type
Native
Notes
Score from level is automatically factored into the scoreboard display in combat maps.


ns_get_spawn
NS (ns.inc)
Description
ns_get_spawn - Gets spawn points for specified team.
Syntax
ns_get_spawn ( team, [ number = 0 ], Float:ret[3] )
Type
Native
Notes
If team is equal to 0: Ready room spawns are returned.

If team is greater than 0: Spawns for the team are returned.

If number is equal to 0 (default): Total number of spawns is returned.

If number is greater than 0: The location of the specified spawn is passed into ret.


ns_get_speedchange
NS (ns.inc)
Description
ns_get_speedchange - Returns the speed change of a player.
Syntax
ns_get_speedchange ( index )
Type
Native


ns_get_struct_owner
NS (ns.inc)
Description
ns_get_struct_owner - Gets the index of the owner of a structure.
Syntax
ns_get_struct_owner ( idStructure )
Type
Native
Notes
-1 is returned for no owner.


ns_get_weap_clip
NS (ns.inc)
Description
ns_get_weap_clip - Gets a weapon's clip ammo.
Syntax
ns_get_weap_clip ( weapon )
Type
Native
Notes
Use the weapon index, not the player index.


ns_get_weap_dmg
NS (ns.inc)
Description
ns_get_weap_dmg - Gets a weapon's damage.
Syntax
Float: ns_get_weap_dmg ( weapon )
Type
Native
Notes
Use the weapon index, not the player index.


ns_get_weap_range
NS (ns.inc)
Description
ns_get_weap_range - Gets a weapon's range.
Syntax
Float: ns_get_weap_range ( weapon )
Type
Native
Notes
Use the weapon index, not the player index.


ns_get_weap_reserve
NS (ns.inc)
Description
ns_get_weap_reserve - Gets the player's weapon reserve for the specified type of weapon.
Syntax
ns_get_weap_reserve ( index, weapon )
Type
Native
Notes
Refer to ns_const.inc for the WEAPON_* constants.


ns_give_item
NS (ns.inc)
Description
ns_give_item - Give a player an item.
Syntax
ns_give_item ( index, const className[] )
Type
Native


ns_has_weapon
NS (ns.inc)
Description
ns_has_weapon - Returns if the player has the weapon or not in their pev->weapons field.
Syntax
ns_has_weapon ( index, NSWeapon:weapon, [ setweapon = -1 ] )
Type
Native
Notes
Set setweapon to 0 to turn the bit off, set to 1 to turn it on, or omit it to just return the value.
User Contributed Notes
slayerized at gmail dot com Mar-14-05 23:20:26
Refer to the weapon constants.

anonymous Mar-11-05 00:02:56
What do you use for NSWeapon:weapon?


ns_is_combat
NS (ns.inc)
Description
ns_is_combat - Returns 1 if the map is in combat, 0 otherwise.
Syntax
ns_is_combat ( )
Type
Native


ns_popup
NS (ns.inc)
Description
ns_popup - Sends a popup to a player.
Syntax
ns_popup ( index, szMsg[180], ah )
Type
Native
Notes
Set index to 0 to send to everybody. The last parameter, if set to 1, will only display when the player has cl_autohelp set to 1.


ns_set_deaths
NS (ns.inc)
Description
ns_set_deaths - Sets a player's death count.
Syntax
ns_set_deaths ( index, numdeaths )
Type
Native


ns_set_energy
NS (ns.inc)
Description
ns_set_energy - Sets a player's percentage of adrenaline. (alien players only)
Syntax
ns_set_energy ( index, Float:energy )
Type
Native


ns_set_exp
NS (ns.inc)
Description
ns_set_exp - Set's a player's experience. (combat maps only)
Syntax
ns_set_exp ( index, Float:exp )
Type
Native


ns_set_fov
NS (ns.inc)
Description
ns_set_fov - Sets the players field of view.
Syntax
ns_set_fov ( index, [ Float:fov = 0.0 ] )
Type
Native
Notes
Set fov to 0.0 (or omit it) to return to normal. FOV change will persist until disconnect unless reset by a plugin.


ns_set_hive_trait
NS (ns.inc)
Description
ns_set_hive_trait - Sets the trait type tied to the hive.
Syntax
ns_set_hive_trait ( idHive, trait )
Type
Native
Notes
Refer to ns_const.inc for the HIVETRAIT_* constants.


ns_set_jpfuel
NS (ns.inc)
Description
ns_set_jpfuel - Sets a player's percentage of JP fuel.
Syntax
ns_set_jpfuel ( index, Float:fuel )
Type
Native


ns_set_mask
NS (ns.inc)
Description
ns_set_mask - Sets or removes the mask from the entity's iuser4 field.
Syntax
ns_set_mask ( index, mask, value )
Type
Native
Notes
Set "value" to 1 to turn the mask on, 0 to turn it off.

Refer to the MASK_* constants in ns_const.inc for the mask parameter.


ns_set_menu
NS (ns.inc)
Description
ns_set_menu - DEPRECATED. Configures display of the custom menus.
Syntax
ns_set_menu ( player, r, g, b, x, y, effects, Float:fadeintime, Float:fadeouttime, channel1, channel2 )
Type
Native
Notes
This native is DEPRECATED and no longer available for use.

Full parameter listing:

(player, r = NSMENU_R, g = NSMENU_G , b = NSMENU_B, x = NSMENU_X, y = NSMENU_Y, effects = 0, Float:fadeintime =0.0, Float:fadeouttime = 0.0, channel1 = 4, channel2 = 3)

This display is _very_ similar to set_hudmessage.


ns_set_player_body
NS (ns.inc)
Description
ns_set_player_body - Sets a player's body.
Syntax
ns_set_player_body ( index, [ body = -1 ] )
Type
Native
Notes
Forces ns2amx to set the player's model/skin/body to the specified each frame. Note that the model will not go back to standard when the player dies/changes classes. Your plugin will have to tell the module to stop using the custom model.

Leave the second parameter out of any of these commands to force the module to go back to standard.


ns_set_player_model
NS (ns.inc)
Description
ns_set_player_model - Sets a player's model.
Syntax
ns_set_player_model ( index, [ model[] = "" ] )
Type
Native
Notes
Forces ns2amx to set the player's model/skin/body to the specified each frame. Note that the model will not go back to standard when the player dies/changes classes. Your plugin will have to tell the module to stop using the custom model.

Leave the second parameter out of any of these commands to force the module to go back to standard.


ns_set_player_skin
NS (ns.inc)
Description
ns_set_player_skin - Sets a player's skin.
Syntax
ns_set_player_skin ( index, [ skin = -1 ] )
Type
Native
Notes
Forces ns2amx to set the player's model/skin/body to the specified each frame. Note that the model will not go back to standard when the player dies/changes classes. Your plugin will have to tell the module to stop using the custom model.

Leave the second parameter out of any of these commands to force the module to go back to standard.


ns_set_points
NS (ns.inc)
Description
ns_set_points - Sets a player's point spent value in combat.
Syntax
ns_set_points ( index, points )
Type
Native


ns_set_res
NS (ns.inc)
Description
ns_set_res - Sets a player's resources. (alien players only)
Syntax
ns_set_res ( index, Float:res )
Type
Native


ns_set_score
NS (ns.inc)
Description
ns_set_score - Sets a player's score.
Syntax
ns_set_score ( index, score )
Type
Native
Notes
Score from level is automatically factored into the scoreboard display in combat maps.


ns_set_speedchange
NS (ns.inc)
Description
ns_set_speedchange - Used to change a player's speed change.
Syntax
ns_set_speedchange ( index, [ speedchange = 0 ] )
Type
Native
Notes
Since this can vary, a static speed isn't set. Rather, the module will add the speedchange to the player's maxspeed every frame.

Omit the second parameter to return to default .


ns_set_struct_owner
NS (ns.inc)
Description
ns_set_struct_owner - Sets the index of the owner of a structure.
Syntax
ns_set_struct_owner ( idStructure, indexOwner )
Type
Native
Notes
Use -1 for no owner.


ns_set_weap_clip
NS (ns.inc)
Description
ns_set_weap_clip - Sets a weapon's clip ammo.
Syntax
ns_set_weap_clip ( weapon, clipsize )
Type
Native
Notes
Use the weapon index, not the player index.


ns_set_weap_dmg
NS (ns.inc)
Description
ns_set_weap_dmg - Sets a weapon's damage.
Syntax
ns_set_weap_dmg ( weapon, Float:damage )
Type
Native
Notes
Use the weapon index, not the player index.


ns_set_weap_range
NS (ns.inc)
Description
ns_set_weap_range - Sets a weapon's range.
Syntax
ns_set_weap_range ( weapon, Float:range )
Type
Native
Notes
Use the weapon index, not the player index.


ns_set_weap_reserve
NS (ns.inc)
Description
ns_set_weap_reserve - Sets the player's weapon reserve for the specified type of weapon.
Syntax
ns_set_weap_reserve ( index, weapon, ammo )
Type
Native
Notes
Refer to ns_const.inc for the WEAPON_* constants.


ns_show_menu
NS (ns.inc)
Description
ns_show_menu - DEPRECATED. Displays a custom menu.
Syntax
ns_show_menu ( player, command[], text[], keys, time )
Type
Native
Notes
This native is DEPRECATED and no longer available for use.

Displays a custom menu. It will execute command(id,keys) when the menu is pressed.


ns_spawn_player
NS (ns.inc)
Description
ns_spawn_player - DEPRECATED. Forces a player to spawn.
Syntax
ns_spawn_player ( player, [ class=1, health=100, armor=25 ] )
Type
Native
Notes
This native is DEPRECATED and no longer available for use.

I would not use this while the player's deadflags is 1 or 0. Only use when the player is dead with deadflags of 2 or higher. For class, use the fields specified in the NS Mini SDK (1=marine,3=skulk,4=gorge,5=lerk,6=fade,7=onos).


set_mask
NS (ns2amx.inc)
Description
set_mask - Same as ns_set_mask.
Syntax
set_mask ( index, mask, value )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_set_mask.


set_player_body
NS (ns2amx.inc)
Description
set_player_body - Same as ns_set_player_body.
Syntax
set_player_body ( index, [ body = -1 ] )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_set_player_body.


set_player_model
NS (ns2amx.inc)
Description
set_player_model - Same as ns_set_player_model.
Syntax
set_player_model ( index, [ model = "" ] )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_set_player_model.


set_player_skin
NS (ns2amx.inc)
Description
set_player_skin - Same as ns_set_player_skin.
Syntax
set_player_skin ( index, [ skin = -1 ] )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_set_player_skin.


set_speedchange
NS (ns2amx.inc)
Description
set_speedchange - Same as ns_set_speedchange.
Syntax
set_speedchange ( index, speed )
Type
Stock
Notes
Used for backwards compatabilty. The new name is ns_set_speedchange.


nVault
Content:
  • Notes
  • Functions
  • User Contributed Notes
Notes
nVault is a binary vault implementation. It allows you to open named vaults (which are stored in data\vault) and read/write to them at any time.

The vault is implemented with a simple hash lookup, and the binary file format is primitive. However, it should be much faster than AMX Mod X's built-in vault for most things. Each entry is also timestamped, so you can prune for old entries.

Furthermore, the vault attempts to be journaled. That is, it keeps a log of everything it does, so if the server crashes, it can "replay" the journal and recover damage. The journal is erased on synchronization to the vault binary, which occurs on vault close/mapchange.
  • nvault.inc (nVault Natives)
Functions
nvault_close - Closes a vault.
nvault_get - Gets a vault value by returning an int setting a byref float or setting a string & maxlength.
nvault_lookup - Looks up a vault value for full information.
nvault_open - Opens a vault by name (such as "myvault").
nvault_prune - Prunes the vault for entries that are within the given timestamps.
nvault_pset - Sets a permanent vault value with no timestamp.
nvault_set - Sets a vault value with current timestamp.
User Contributed Notes
tfrcclan at yahoo dot com Sep-18-05 13:28:33
im wondering how can i make the server say stuff by its elf? like say its own csay and tsay because my friend server does it but his server is gizmos and its hekping him so he doesnt know how its doing it...do you guys know how to do it?


nvault_close
nVault (nvault.inc)
Description
nvault_close - Closes a vault.
Syntax
nvault_close ( vault )
Type
Native


nvault_get
nVault (nvault.inc)
Description
nvault_get - Gets a vault value by returning an int setting a byref float or setting a string & maxlength.
Syntax
nvault_get ( vault, const key[], ... )
Type
Native


nvault_lookup
nVault (nvault.inc)
Description
nvault_lookup - Looks up a vault value for full information.
Syntax
nvault_lookup ( vault, const key[], value[], maxlen, ×tamp )
Type
Native
Notes
Returns 0 if the entry is not found.


nvault_open
nVault (nvault.inc)
Description
nvault_open - Opens a vault by name (such as "myvault").
Syntax
nvault_open ( const name[] )
Type
Native
Notes
Returns a vault id or INVALID_HANDLE (-1).


nvault_prune
nVault (nvault.inc)
Description
nvault_prune - Prunes the vault for entries that are within the given timestamps.
Syntax
nvault_prune ( vault, start , end )
Type
Native
Notes
This will not erase values set with nvault_pset.


nvault_pset
nVault (nvault.inc)
Description
nvault_pset - Sets a permanent vault value with no timestamp.
Syntax
nvault_pset ( vault, const key[], const value[] )
Type
Native


nvault_set
nVault (nvault.inc)
Description
nvault_set - Sets a vault value with current timestamp.
Syntax
nvault_set ( vault, const key[], const value[] )
Type
Native


Regex
Content:
  • Notes
  • Functions
Notes
Provides Regular Expression functions. Regular Expressions let you describe ways in which to break down strings. They are extremely powerful. AMX Mod X uses the Perl Compatible RE library, you can read the specifics at their site. The PCRE AMX Mod X Module is maintained by BAILOPAN.
  • regex.inc (Regex functions)
Functions
regex_free - Frees regex handle
regex_match - Initiates a regular expression match
regex_substr - Retrieves a matched substring


regex_free
Regex (regex.inc)
Description
regex_free - Frees regex handle
Syntax
regex_free ( &Regex:id )
Type
Native
Notes
Frees the memory associated with a regex results and sets the handle to 0.
You must do this if the handle >=1 or REGEX_OK, once you're done using the information, or you will have memory leaks.


regex_match
Regex (regex.inc)
Description
regex_match - Initiates a regular expression match
Syntax
regex_match ( const string[], const pattern[], &ret, error[], maxLen )
Type
Native
Notes
Return values:
-2 = Matching error (error code stored in ret)
-1 = Error in pattern (error message and offset # in error[] and ret)
0 = No match
>1 = Id for getting more info (you must call regex_free() later on, or have a memory leak.).

The return value is a Regex tag, so you must declare a variable like this:
new Regex:re

Note that the third parameter to regex_match is special. It's either the number of substrings, a match error code, or a pattern error position (depending on the return value).

The return codes above are aliased:

enum Regex
{
REGEX_MATCH_FAIL = -2,
REGEX_PATTERN_FAIL,
REGEX_NO_MATCH,
REGEX_OK
};


regex_substr
Regex (regex.inc)
Description
regex_substr - Retrieves a matched substring
Syntax
regex_substr ( Regex:id, str_id, buffer[], maxLen )
Type
Native
Notes
Returns a matched substring from a regex handle. Substring ids start at 0 and end at Num-1, where Num is the return value from the third parameter of regex_match.


Sockets
Content:
  • Notes
  • Functions
Notes
The Sockets module provides basic network socket manipulation functions. It was originally written by Ivan for AMX 0.9.3, and then rewritten by Kenterfie from the HLSW Dev Team.
  • sockets.inc (Natives for the Sockets module.)
Functions
socket_change - Returns true if the socket state has changed.
socket_close - Closes a socket.
socket_open - Opens a new connection to hostname:port and returns its handler.
socket_recv - Receives data from a socket, for a maximum length.
socket_send - Sends data to a socket.


socket_change
Sockets (sockets.inc)
Description
socket_change - Returns true if the socket state has changed.
Syntax
socket_change ( socket, [ timeout = 100000 ] )
Type
Native
Notes
This function will return true if the state (buffer content) have changed within the last recieve or the timeout, where timeout is a value in µSeconds, (1 sec = 1000000 µsec). Use this to check if new data is in the socket.


socket_close
Sockets (sockets.inc)
Description
socket_close - Closes a socket.
Syntax
socket_close ( socket )
Type
Native


socket_open
Sockets (sockets.inc)
Description
socket_open - Opens a new connection to hostname:port and returns its handler.
Syntax
socket_open ( hostname[], port, protocol, &error )
Type
Native
Notes
Protocol can be either SOCKET_TCP or SOCKET_UDP.

Returns a socket (positive) or negative or zero on error.

If there is an error, the error variable (passed by reference) will contain the code.

There are four return values -
0 - No error
1 - Error creating socket
2 - Could not resolve hostname
3 - Couldn't connect to given hostname:port


socket_recv
Sockets (sockets.inc)
Description
socket_recv - Receives data from a socket, for a maximum length.
Syntax
socket_recv ( socket, data[], maxLength )
Type
Native


socket_send
Sockets (sockets.inc)
Description
socket_send - Sends data to a socket.
Syntax
socket_send ( socket, data[], length )
Type
Native


SQL
Content:
  • Notes
  • Functions
Notes
Provides SQL access functions. It is part of a universal DB API used by AMX Mod X, so it exports the same functions as any other AMX Mod X database driver, but interfaces with SQL. The SQL API is maintained by BAILOPAN.

  • dbi.inc (Provides a universal databasing layer.)
DBI only has a few constants:
  • Sql Constants
  • Return Constants

"Sql Constants:
enum Sql
{
    SQL_FAILED=0,
    SQL_OK
}

"Return Constants:
enum Result
{
    RESULT_FAILED=-1,
    RESULT_NONE,
    RESULT_OK
}

Functions
dbi_close - Closes a database connection handle.
dbi_connect - Connects to a mysql database.
dbi_error - Returns an error message set on an SQL connection handle.
dbi_field - Returns a field from an SQL result row.
dbi_free_result - Frees the memory used by a result handle.
dbi_nextrow - Advances the row pointer for an SQL result handle.
dbi_num_rows - Returns the number of rows returned from a query.
dbi_query - Executes a query on an SQL resource handle.
dbi_result - Gets a field result by name instead of number.
dbi_type - Gets the type of database being used.


dbi_close
SQL (dbi.inc)
Description
dbi_close - Closes a database connection handle.
Syntax
dbi_close ( &Sql:sql )
Type
Native
Notes
Internally, it will also mark the handle as free, so this particular handle may be re-used in the future to save time.


dbi_connect
SQL (dbi.inc)
Description
dbi_connect - Connects to a mysql database.
Syntax
dbi_connect ( host[], user[], pass[], dbname[], [ error[] = "", maxLength = 0 ] )
Type
Native
Notes
Return type is Sql, which means you have to declare your variable as Sql:name, just as you declare a float as Float:name.

Returns a resource handle greater than 0 on success.

If an error was found, it is stored into error[] for a maximum of len characters.


dbi_error
SQL (dbi.inc)
Description
dbi_error - Returns an error message set on an SQL connection handle.
Syntax
dbi_error ( Sql:sql, error[], maxLength )
Type
Native
Notes
For MSSQL, this is the last error found from a thrown exception. For PgSQL and MySQL, it is from the direct API.


dbi_field
SQL (dbi.inc)
Description
dbi_field - Returns a field from an SQL result row.
Syntax
dbi_field ( Result:result, fieldnum, [ ... ] )
Type
Native
Notes
Returns 0 on failure. Although internally fields always start from 0, this function takes fieldnum starting from 1.

Examples of how to get SQL rows:
ret = dbi_query(sql, query)
new Float:fResult
new string[32]
new iResult

dbi_nextrow(ret)

iResult = dbi_field(ret, 1)
dbi_field(ret, 2, fResult)
dbi_field(ret, 3, string, 31)


dbi_free_result
SQL (dbi.inc)
Description
dbi_free_result - Frees the memory used by a result handle.
Syntax
dbi_free_result ( &Result:result )
Type
Native
Notes
If you do not use this after a dbi_query() that returns a result handle, you risk having memory leaks!


dbi_nextrow
SQL (dbi.inc)
Description
dbi_nextrow - Advances the row pointer for an SQL result handle.
Syntax
dbi_nextrow ( Result:result )
Type
Native
Notes
Unlike the AMX Mod SQL interfaces, you pass a result handle instead of an SQL handle.

For backwards compatibility, if nothing is specifed, it will default to a global pointer.

Returns 0 on failure or end of result list.


dbi_num_rows
SQL (dbi.inc)
Description
dbi_num_rows - Returns the number of rows returned from a query.
Syntax
dbi_num_rows ( result )
Type
Native


dbi_query
SQL (dbi.inc)
Description
dbi_query - Executes a query on an SQL resource handle.
Syntax
dbi_query ( Sql:sql, query[], [ ... ] )
Type
Native
Notes
Return type is Result, which means you have to declare your variable as Result:name, just as you declare a float as Float:name.

Query can be formatted according to format.

IMPORTANT
If the query FAILS, it will return a negative number.
If the query SUCCEEDS, it will return 0.
If the query SUCCEEDS and has a result set, it will return a result handle which is greater than 0.

This is not backwards compatible with the old MySQL handlers. This is invalid:
if (dbi_query(query)


dbi_result
SQL (dbi.inc)
Description
dbi_result - Gets a field result by name instead of number.
Syntax
dbi_result ( Result:result, field[], [ ... ] )
Type
Native
Notes
With one extra parameter, this returns a float by reference. With two extra parameters, this stores into string with length.

Examples of how to get SQL rows:
ret = dbi_query(sql, query)
new Float:fResult
new string[32]
new iResult

dbi_nextrow(ret)

iResult = dbi_result(ret, "id")
dbi_result(ret, "score", fResult)
dbi_result(ret, "name", string, 31)
dbi_free_result(ret)


dbi_type
SQL (dbi.inc)
Description
dbi_type - Gets the type of database being used.
Syntax
dbi_type ( type[], maxLength )
Type
Native
Notes
Will return either "mysql", "pgsql", or "mssql" as of this writing.


TFCX
Content:
  • Notes
  • Functions
Notes
The Team Fortress Classic module (TFCX) was developed by SidLuke/ It has two main portions, generic Team Fortress Classic natives and a TFC statistical package. The statistical functions are not listed because they are the same as in the DoDX module.
  • tfcx.inc (Team Fortress Classic natives)
  • tfcstats.inc (TFC statistical natives)
  • tfcconst.inc (TFC constants)
TFCX contains the following constats:
  • Ammo Constants
  • Weapon Constants
  • Class Constants
Ammo Constants
enum {
    TFC_AMMO_SHELLS = 0,
    TFC_AMMO_BULLETS,
    TFC_AMMO_CELLS,
    TFC_AMMO_ROCKETS,
    TFC_AMMO_NADE1,
    TFC_AMMO_NADE2,
};

Weapon Constants
enum {
    TFC_WPN_NONE = 0,
    TFC_WPN_TIMER,//TFC_WPN_UNK1,
    TFC_WPN_SENTRYGUN,//TFC_WPN_UNK2,
    TFC_WPN_MEDIKIT,
    TFC_WPN_SPANNER,
    TFC_WPN_AXE,
    TFC_WPN_SNIPERRIFLE,
    TFC_WPN_AUTORIFLE,
    TFC_WPN_SHOTGUN,
    TFC_WPN_SUPERSHOTGUN,
    TFC_WPN_NG,
    TFC_WPN_SUPERNG,
    TFC_WPN_GL,
    TFC_WPN_FLAMETHROWER,
    TFC_WPN_RPG,
    TFC_WPN_IC,
    TFC_WPN_FLAMES,//TFC_WPN_UNK16,
    TFC_WPN_AC,
    TFC_WPN_UNK18,
    TFC_WPN_UNK19,
    TFC_WPN_TRANQ,
    TFC_WPN_RAILGUN,
    TFC_WPN_PL,
    TFC_WPN_KNIFE,
    TFC_WPN_CALTROP, // 24
    TFC_WPN_CONCUSSIONGRENADE,
    TFC_WPN_NORMALGRENADE,
    TFC_WPN_NAILGRENADE,
    TFC_WPN_MIRVGRENADE,
    TFC_WPN_NAPALMGRENADE,
    TFC_WPN_GASGRENADE,
    TFC_WPN_EMPGRENADE,
};

Class Constants
enum {
    TFC_PC_SCOUT = 1,
    TFC_PC_SNIPER,
    TFC_PC_SOLDIER,
    TFC_PC_DEMOMAN,
    TFC_PC_MEDIC,
    TFC_PC_HWGUY,
    TFC_PC_PYRO,
    TFC_PC_SPY,
    TFC_PC_ENGENEER,
    TFC_PC_CIVILIAN,
};

Functions
client_damage - Function is called after player to player attacks
client_death - Called when a player dies.
get_stats - Gets overall stats.
get_statsnum - Returns number of all entries in stats.
get_user_astats - Gets stats with which a player has been killed/hurt.
get_user_rstats - Gets round stats of player.
get_user_stats - Gets overall stats.
get_user_vstats - Gets stats with which the player has killed/hurt a victim.
get_user_wrstats - Gets round stats from given weapon index.
get_user_wstats - Gets stats from given weapon index.
reset_user_wstats - Resets life, weapon, victims and attackers user stats.
tfc_clearmodel - Resets a model on a TFC player.
tfc_getbammo - Gets ammo in the backpack for a user's weapon.
tfc_getgrenadename - DEPRECATED. Gets the name of a grenade.
tfc_getweaponbammo - Returns the amount of ammo in weapon's clip.
tfc_getwpnlogname - DEPRECATED. Gets the logged name of a weapon.
tfc_getwpnname - DEPRECATED. Gets the name of a weapon.
tfc_isgrenade - Returns 1 if a weapon is a grenade, 0 otherwise.
tfc_ismelee - DEPRECATED. Returns 1 if the weapon is a melee weapon, 0 otherwise.
tfc_setbammo - Sets ammo in the backpack for a user's weapon.
tfc_setmodel - Sets a model on a TFC player.
tfc_setpddata - Sets private data if needed.
tfc_setweaponbammo - Sets the amount of ammo in weapon's clip.
tfc_userkill - Kills a user.


client_damage
TFCX (tfcx.inc)
Description
client_damage - Function is called after player to player attacks
Syntax
client_damage ( attacker, victim, damage, wpnindex, hitplace, TA )
Type
Forward
Notes
If the player was damaged by a teammate then TA is set to 1.


client_death
TFCX (tfcx.inc)
Description
client_death - Called when a player dies.
Syntax
client_death ( killer, victim, wpnindex, hitplace, TK )
Type
Forward
Notes
If the player was killed by a teammate then TK is set to 1.


get_stats
TFCX (tfcstats.inc)
Description
get_stats - Gets overall stats.
Syntax
get_stats ( player, stats[8], bodyhits[8], name[], len )
Type
Native
Notes
Gets overall stats which stored in stats.dat file in amxx folder and updated on every mapchange or user disconnect. Function returns next index of stats entry or 0 if no more exists.


get_statsnum
TFCX (tfcstats.inc)
Description
get_statsnum - Returns number of all entries in stats.
Syntax
get_statsnum ( )
Type
Native


get_user_astats
TFCX (tfcstats.inc)
Description
get_user_astats - Gets stats with which a player has been killed/hurt.
Syntax
get_user_astats ( index, wpnindex, stats[8], bodyhits[8], [ wpnname = "", len = 0] )
Type
Native
Notes
Gets stats with which user have been killed/hurt. If killer is 0 then stats are from all attacks. If killer has not hurt user, function returns 0 in other case 1. User stats are reset on his respawn.


get_user_rstats
TFCX (tfcstats.inc)
Description
get_user_rstats - Gets round stats of player.
Syntax
get_user_rstats ( index, stats[8], bodyhits[8] )
Type
Native


get_user_stats
TFCX (tfcstats.inc)
Description
get_user_stats - Gets overall stats.
Syntax
get_user_stats ( index, stats[8], bodyhits[8] )
Type
Native
Notes
Gets overall stats which are stored in file on server and updated on every respawn or user disconnect. Function returns the position in stats by diff. kills to deaths.


get_user_vstats
TFCX (tfcstats.inc)
Description
get_user_vstats - Gets stats with which the player has killed/hurt a victim.
Syntax
get_user_vstats ( index, victim, stats[8], bodyhits[8], [ wpnname[] = "", len = 0 ] )
Type
Native
Notes
Gets stats with which user have killed/hurt his victim. If victim is 0 then stats are from all victims. If victim has not been hurt, function returns 0 in other case 1. User stats are reset on his respawn.


get_user_wrstats
TFCX (tfcstats.inc)
Description
get_user_wrstats - Gets round stats from given weapon index.
Syntax
get_user_wrstats ( index, wpnindex, stats[8], bodyhits[8] )
Type
Native


get_user_wstats
TFCX (tfcstats.inc)
Description
get_user_wstats - Gets stats from given weapon index.
Syntax
get_user_wstats ( index, wpnindex, stats[8], bodyhits[8] )
Type
Native
Notes
If wpnindex is 0 then the stats are from all weapons. If weapon has not been used function returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* 7 - score
For body hits fields see amxconst.inc.


reset_user_wstats
TFCX (tfcstats.inc)
Description
reset_user_wstats - Resets life, weapon, victims and attackers user stats.
Syntax
reset_user_wstats ( index )
Type
Native


tfc_clearmodel
TFCX (tfcx.inc)
Description
tfc_clearmodel - Resets a model on a TFC player.
Syntax
tfc_clearmodel ( index )
Type
Native
Notes


tfc_getbammo
TFCX (tfcx.inc)
Description
tfc_getbammo - Gets ammo in the backpack for a user's weapon.
Syntax
tfc_getbammo ( index, ammo )
Type
Native
Notes
See tfcconst.inc for a list of TFC_AMMO_* indexes.


tfc_getgrenadename
TFCX (tfcx.inc)
Description
tfc_getgrenadename - DEPRECATED. Gets the name of a grenade.
Syntax
tfc_getgrenadename ( weapon, name[], len )
Type
Native
Notes
This native is DEPRECATED and is no longer available.


tfc_getweaponbammo
TFCX (tfcx.inc)
Description
tfc_getweaponbammo - Returns the amount of ammo in weapon's clip.
Syntax
tfc_getweaponbammo ( player, weapon )
Type
Native
Notes
See tfcconst.inc for a list of TFC_WPN_* indexes.


tfc_getwpnlogname
TFCX (tfcx.inc)
Description
tfc_getwpnlogname - DEPRECATED. Gets the logged name of a weapon.
Syntax
tfc_getwpnlogname ( weapon, name[], len )
Type
Native
Notes
This native is DEPRECATED and is no longer available. Use xmod_get_wpnlogname(wpnindex,name[],len) instead.


tfc_getwpnname
TFCX (tfcx.inc)
Description
tfc_getwpnname - DEPRECATED. Gets the name of a weapon.
Syntax
tfc_getwpnname ( weapon, name[], len )
Type
Native
Notes
This native is DEPRECATED and is no longer available. Use xmod_get_wpnname(wpnindex,name[],len) instead.


tfc_isgrenade
TFCX (tfcx.inc)
Description
tfc_isgrenade - Returns 1 if a weapon is a grenade, 0 otherwise.
Syntax
tfc_isgrenade ( weapon )
Type
Stock
Notes


tfc_ismelee
TFCX (tfcx.inc)
Description
tfc_ismelee - DEPRECATED. Returns 1 if the weapon is a melee weapon, 0 otherwise.
Syntax
tfc_ismelee ( weapon )
Type
Native
Notes
This native is DEPRECATED and is no longer available. Use xmod_is_melee_weapon(wpnindex) instead.


tfc_setbammo
TFCX (tfcx.inc)
Description
tfc_setbammo - Sets ammo in the backpack for a user's weapon.
Syntax
tfc_setbammo ( index, ammo, value )
Type
Native
Notes
See tfcconst.inc for a list of TFC_AMMO_* indexes.


tfc_setmodel
TFCX (tfcx.inc)
Description
tfc_setmodel - Sets a model on a TFC player.
Syntax
tfc_setmodel ( index, const Model[], const Skin[] )
Type
Native
Notes


tfc_setpddata
TFCX (tfcx.inc)
Description
tfc_setpddata - Sets private data if needed.
Syntax
tfc_setpddata ( timer, sentrygun, shells, bullets, cells, rockets, nade1, nade2 )
Type
Native
Notes
Default offsets:
timer: 932
sentrygun: 83
shells: 53
bullets: 55
cells: 57
rockets: 59
nade1: 14
nade2: 15


tfc_setweaponbammo
TFCX (tfcx.inc)
Description
tfc_setweaponbammo - Sets the amount of ammo in weapon's clip.
Syntax
tfc_setweaponbammo ( player, weapon, value )
Type
Native
Notes
See tfcconst.inc for a list of TFC_WPN_* indexes.


tfc_userkill
TFCX (tfcx.inc)
Description
tfc_userkill - Kills a user.
Syntax
tfc_userkill ( index )
Type
Native
Notes


TSFUN
Content:
  • Notes
  • Functions
Notes
The TS Fun module, developed and maintained by Twilight Suzuka, provides TS only natives and forwards that go beyond the TSX module.
It is not steam update proof, so be sure to always have the latest version

  • tsfun.inc (Provides fun functions for TS)
The TSFUN module includes some constants, listed below.
  • Powerup Constants
  • Kill Constants
  • Message Constants
  • Stunt Constants
  • Weapon Constants
Powerup Constants
#define TSPWUP_NONE			0
#define TSPWUP_RANDOM			0
#define TSPWUP_SLOWMO 			1
#define TSPWUP_INFAMMO		 	2
#define TSPWUP_KUNGFU		 	4
#define TSPWUP_SLOWPAUSE 		8
#define TSPWUP_DFIRERATE		16
#define TSPWUP_GRENADE			32
#define TSPWUP_HEALTH			64
#define TSPWUP_ARMOR			128
#define TSPWUP_SUPERJUMP		256

#define TSITEM_KUNGFU			1<<0
#define TSITEM_SUPERJUMP		1<<1

Kill Constants
#define TSKF_STUNTKILL			1<<0
#define TSKF_SLIDINGKILL		1<<1
#define TSKF_DOUBLEKILL			1<<2
#define TSKF_ISSPEC			1<<3
#define TSKF_KILLEDSPEC			1<<4

Message Constants
#define TSMSG_NORMAL			6
#define TSMSG_WAITING			11
#define TSMSG_DEAD			1
#define TSMSG_KILLER			2
#define TSMSG_DEMOLITION		3
#define TSMSG_SPECIALIST		4
#define TSMSG_UNSTOPPABLE		5
#define TSMSG_THEONE			10

Stunt Constants
#define STUNT_NONE 0
#define STUNT_DUCK 1
#define STUNT_ROLL 2
#define STUNT_DIVE 3
#define STUNT_GETUP 4
#define STUNT_FLIP 5

Weapon Constants
#define TSA_SILENCER			1
#define TSA_LASERSIGHT			2
#define TSA_FLASHLIGHT			4
#define TSA_SCOPE				8

#define TSMAX_WEAPONS 44	// 37 + throwing knife + brekable + 5 custom weapon slots

enum {
  TSW_GLOCK18 = 1,
  TSW_UNK1,
  TSW_UZI,
  TSW_M3,
  TSW_M4A1,
  TSW_MP5SD,
  TSW_MP5K,
  TSW_ABERETTAS,
  TSW_MK23,
  TSW_AMK23,
  TSW_USAS,
  TSW_DEAGLE,
  TSW_AK47,
  TSW_57,
  TSW_AUG,
  TSW_AUZI,
  TSW_TMP,
  TSW_M82A1,
  TSW_MP7,
  TSW_SPAS,
  TSW_GCOLTS,
  TSW_GLOCK20,
  TSW_UMP,
  TSW_M61GRENADE,
  TSW_CKNIFE,
  TSW_MOSSBERG,
  TSW_M16A4,
  TSW_MK1,
  TSW_C4,
  TSW_A57,
  TSW_RBULL,
  TSW_M60E3,
  TSW_SAWED_OFF,
  TSW_KATANA,
  TSW_SKNIFE,
  TSW_KUNG_FU,
  TSW_TKNIFE,
}

Functions
client_powerup - Called when client uses powerup
client_stunt - Called when client stunts
KungFoo_Attack - Called when someone executes a kung foo move
Melee_Attack - Called on any melee attack
ts_getuserslots - Returns players slots
ts_getusertime - Returns clients time in the server
ts_setuserslots - Sets clients slots
ts_setusertime - Sets clients time in server
ts_set_fuattack - Alters a clients attack


client_powerup
TSFUN (tsfun.inc)
Description
client_powerup - Called when client uses powerup
Syntax
client_powerup ( id, powerupid )
Type
Forward
Notes
Returns value of powerup. Use TSPWUP_*'s to find exactly which one it is.

Note: May call until powerup stops running.


client_stunt
TSFUN (tsfun.inc)
Description
client_stunt - Called when client stunts
Syntax
client_stunt ( id, stunt_type )
Type
Forward
Notes
Returns an integer defining what kind of stunt it was. Use the STUNT_* constants to determine which type it was.


KungFoo_Attack
TSFUN (tsfun.inc)
Description
KungFoo_Attack - Called when someone executes a kung foo move
Syntax
KungFoo_Attack ( id, Float:time, Float:damage )
Type
Forward
Notes
Depreciated, use Melee_Attack forward.
returns the id of the player attempting to attack, along with the time the attack lasts, and the damage it deals (if it hits)

Use ts_set_fuattack to alter, and return PLUGIN_HANDLED to block.


Melee_Attack
TSFUN (tsfun.inc)
Description
Melee_Attack - Called on any melee attack
Syntax
Melee_Attack ( id, Float:time, Float:damage )
Type
Forward
Notes
Use this instead of KungFoo_Attack

Returns the id of the player attempting to attack, along with the time the attack lasts, and the damage it deals (if it hits)

Use ts_set_fuattack to alter, and return PLUGIN_HANDLED to block.


ts_getuserslots
TSFUN (tsfun.inc)
Description
ts_getuserslots - Returns players slots
Syntax
ts_getuserslots ( id )
Type
Native
Notes
Can be used to discover how many weapons someone has.


ts_getusertime
TSFUN (tsfun.inc)
Description
ts_getusertime - Returns clients time in the server
Syntax
Float: ts_getusertime ( id )
Type
Native
Notes
Returns time in terms of frames.


ts_setuserslots
TSFUN (tsfun.inc)
Description
ts_setuserslots - Sets clients slots
Syntax
ts_setuserslots ( id, slots )
Type
Native
Notes
Do not set above 1000. Can cause errors.


ts_setusertime
TSFUN (tsfun.inc)
Description
ts_setusertime - Sets clients time in server
Syntax
ts_setusertime ( id, Float:time )
Type
Native
Notes
Can be used to fool some scripts and TS features


ts_set_fuattack
TSFUN (tsfun.inc)
Description
ts_set_fuattack - Alters a clients attack
Syntax
ts_set_fuattack ( id, Float:time, Float:damage )
Type
Native
Notes
Use with Melee_Attack to change attacks before they happen.


TSX
Content:
  • Notes
  • Functions
Notes
The Specialists module (TSX) was developed by SidLuke, originally ported from his earlier AMX Mod module. It has two main portions, generic The Specialists natives and a The Specialists statistical package.
  • tsx.inc (The Specialists natives)
  • tsstats.inc (The Specialists statistical natives)
  • tsconst.inc (The Specialists constants)
TSX contains the following constants:
  • Powerup Constants
  • Item Constants
  • Kill Flag Constants
  • Weapon Mode Constants
  • Weapon Constants
Powerup Constants
#define TSPWUP_RANDOM			0
#define TSPWUP_SLOWMO			1
#define TSPWUP_INFAMMO			2
#define TSPWUP_KUNGFU			4
#define TSPWUP_SLOWPAUSE			8
#define TSPWUP_DFIRERATE			16
#define TSPWUP_GRENADE			32
#define TSPWUP_HEALTH			64
#define TSPWUP_ARMOR			128
#define TSPWUP_SUPERJUMP			256

Item Constants
#define TSITEM_KUNGFU			1<<0
#define TSITEM_SUPERJUMP			1<<1

Kill Flag Constants
#define TSKF_STUNTKILL			1<<0
#define TSKF_SLIDINGKILL			1<<1
#define TSKF_DOUBLEKILL			1<<2
#define TSKF_ISSPEC			1<<3 // is specialist
#define TSKF_KILLEDSPEC			1<<4 // killed specialist

Weapon Mode Constants
#define TSA_SILENCER			1
#define TSA_LASERSIGHT			2
#define TSA_FLASHLIGHT			4
#define TSA_SCOPE				8

Weapon Constants
#define TSMAX_WEAPONS 44	// 37 + throwing knife + breakable + 5 custom weapon slots
enum {
  TSW_GLOCK18 = 1,
  TSW_UNK1,
  TSW_UZI,
  TSW_M3,
  TSW_M4A1,
  TSW_MP5SD,
  TSW_MP5K,
  TSW_ABERETTAS,
  TSW_MK23,
  TSW_AMK23,
  TSW_USAS,
  TSW_DEAGLE,
  TSW_AK47,
  TSW_57,
  TSW_AUG,
  TSW_AUZI,
  TSW_TMP,
  TSW_M82A1,
  TSW_MP7,
  TSW_SPAS,
  TSW_GCOLTS,
  TSW_GLOCK20,
  TSW_UMP,
  TSW_M61GRENADE,
  TSW_CKNIFE,
  TSW_MOSSBERG,
  TSW_M16A4,
  TSW_MK1,
  TSW_C4,
  TSW_A57,
  TSW_RBULL,
  TSW_M60E3,
  TSW_SAWED_OFF,
  TSW_KATANA,
  TSW_SKNIFE,
  TSW_KUNG_FU,
  TSW_TKNIFE,
}

Functions
get_stats - Gets overall stats.
get_statsnum - Returns number of all entries in stats.
get_user_astats - Gets stats with which user have been killed/hurt.
get_user_rstats - Gets round stats of player.
get_user_stats - Gets overall stats.
get_user_vstats - Gets stats with which user have killed/hurt his victim.
get_user_wlstats - Gets life (from spawn to spawn) stats from given weapon index.
get_user_wrstats - Gets round stats from given weapon index.
get_user_wstats - Gets stats from given weapon index.
reset_user_wstats - Resets life, weapon, victims and attackers user stats.
ts_createpwup - Creates a powerup entity and returns its index.
ts_getkillingstreak - Returns player's killing streak.
ts_getusercash - Returns player's cash.
ts_getuseritems - Returns player's items.
ts_getuserkillflags - Returns player's kill flags.
ts_getuserlastfrag - Returns player's last frag.
ts_getuserpwup - Returns a user's powerup and amount.
ts_getuserspace - Returns a user's space.
ts_getuserwpn - Gets info about the user's current weapon.
ts_givepwup - Gives a user powerup created with ts_createpwup.
ts_giveweapon - Gives player a weapon.
ts_setpdata - Adjusts private data offset.
ts_wpnlogtoid - Gets the id of a logged weapon name.
ts_wpnlogtoname - Converts a weapon's logname to normal name.


get_stats
TSX (tsstats.inc)
Description
get_stats - Gets overall stats.
Syntax
get_stats ( index, stats[8], bodyhits[8], name[], len )
Type
Native
Notes
Gets overall stats which stored in stats.dat file in amx folder and updated on every mapchange or user disconnect. Function returns next index of stats entry or 0 if no more exists.


get_statsnum
TSX (tsstats.inc)
Description
get_statsnum - Returns number of all entries in stats.
Syntax
get_statsnum ( )
Type
Native


get_user_astats
TSX (tsstats.inc)
Description
get_user_astats - Gets stats with which user have been killed/hurt.
Syntax
get_user_astats ( index, wpnindex, stats[8], bodyhits[8], [ wpnname[] = "", len = 0 ] )
Type
Native
Notes
Gets stats with which user have been killed/hurt. If killer is 0 then stats are from all attacks. If killer has not hurt user, function returns 0 in other case 1. User stats are reset on his respawn.


get_user_rstats
TSX (tsstats.inc)
Description
get_user_rstats - Gets round stats of player.
Syntax
get_user_rstats ( index, stats[8], bodyhits[8] )
Type
Native


get_user_stats
TSX (tsstats.inc)
Description
get_user_stats - Gets overall stats.
Syntax
get_user_stats ( index, stats[8], bodyhits[8] )
Type
Native
Notes
Gets overall stats which are stored in file on server and updated on every respawn or user disconnect. Function returns the position in stats by diff. kills to deaths.


get_user_vstats
TSX (tsstats.inc)
Description
get_user_vstats - Gets stats with which user have killed/hurt his victim.
Syntax
get_user_vstats ( index, victim, stats[8], bodyhits[8], [ wpnname[] = "", len = 0 ] )
Type
Native
Notes
Gets stats with which user have killed/hurt his victim. If victim is 0 then stats are from all victims. If victim has not been hurt, function returns 0 in other case 1. User stats are reset on his respawn.


get_user_wlstats
TSX (tsstats.inc)
Description
get_user_wlstats - Gets life (from spawn to spawn) stats from given weapon index.
Syntax
get_user_wlstats ( index, wpnindex, stats[8], bodyhits[8] )
Type
Native


get_user_wrstats
TSX (tsstats.inc)
Description
get_user_wrstats - Gets round stats from given weapon index.
Syntax
get_user_wrstats ( index, wpnindex, stats[8], bodyhits[8] )
Type
Native


get_user_wstats
TSX (tsstats.inc)
Description
get_user_wstats - Gets stats from given weapon index.
Syntax
get_user_wstats ( index, wpnindex, stats[8], bodyhits[8] )
Type
Native
Notes
Gets stats from given weapon index. If wpnindex is 0 then the stats are from all weapons. If weapon has not been used function returns 0 in other case 1. Fields in stats are:
0 - kills
1 - deaths
2 - headshots
3 - teamkilling
4 - shots
5 - hits
6 - damage
For body hits fields see amxconst.inc.


reset_user_wstats
TSX (tsstats.inc)
Description
reset_user_wstats - Resets life, weapon, victims and attackers user stats.
Syntax
reset_user_wstats ( index )
Type
Native


ts_createpwup
TSX (tsx.inc)
Description
ts_createpwup - Creates a powerup entity and returns its index.
Syntax
ts_createpwup ( pwup )
Type
Native
Notes
Use ts_givepwup(index,powerupid) to give this powerup to a player, where powerupid is the return value of this function.

Otherwise, give this entity an origin, or it will cause severe errors such as lag.


ts_getkillingstreak
TSX (tsx.inc)
Description
ts_getkillingstreak - Returns player's killing streak.
Syntax
ts_getkillingstreak ( index )
Type
Native


ts_getusercash
TSX (tsx.inc)
Description
ts_getusercash - Returns player's cash.
Syntax
ts_getusercash ( index )
Type
Native


ts_getuseritems
TSX (tsx.inc)
Description
ts_getuseritems - Returns player's items.
Syntax
ts_getuseritems ( index )
Type
Native
Notes
Refer to the TSITEM_* constants in tsconst.inc for the return value.


ts_getuserkillflags
TSX (tsx.inc)
Description
ts_getuserkillflags - Returns player's kill flags.
Syntax
ts_getuserkillflags ( killer )
Type
Native
Notes
Refer to the TSKF_* constants in tsconst.inc for the return value.


ts_getuserlastfrag
TSX (tsx.inc)
Description
ts_getuserlastfrag - Returns player's last frag.
Syntax
ts_getuserlastfrag ( index )
Type
Native


ts_getuserpwup
TSX (tsx.inc)
Description
ts_getuserpwup - Returns a user's powerup and amount.
Syntax
ts_getuserpwup ( index, &Value )
Type
Native
Notes
Refer to the TSPWUP_* constants in tsconst.inc for the return value. The amount of powerup remaining (ie: time left, in seconds) is passed into Value.


ts_getuserspace
TSX (tsx.inc)
Description
ts_getuserspace - Returns a user's space.
Syntax
ts_getuserspace ( index )
Type
Native


ts_getuserwpn
TSX (tsx.inc)
Description
ts_getuserwpn - Gets info about the user's current weapon.
Syntax
ts_getuserwpn ( index, &clip, &ammo, &mode, &extra )
Type
Native
Notes
Returns the index of the current weapon. Refer to the TSW_* constants in tsconst.inc for the return value. mode is the mode of fire and extra are the extras such as silencer and flashlight.


ts_givepwup
TSX (tsx.inc)
Description
ts_givepwup - Gives a user powerup created with ts_createpwup.
Syntax
ts_givepwup ( index, pwupent )
Type
Native


ts_giveweapon
TSX (tsx.inc)
Description
ts_giveweapon - Gives player a weapon.
Syntax
ts_giveweapon ( index, weapon, clips, extra )
Type
Native
Notes
Refer to the TSW_* constants in tsconst.inc for weapon values.


ts_setpdata
TSX (tsx.inc)
Description
ts_setpdata - Adjusts private data offset.
Syntax
ts_setpdata ( knifeoffset )
Type
Native


ts_wpnlogtoid
TSX (tsx.inc)
Description
ts_wpnlogtoid - Gets the id of a logged weapon name.
Syntax
ts_wpnlogtoid ( logname[] )
Type
Native


ts_wpnlogtoname
TSX (tsx.inc)
Description
ts_wpnlogtoname - Converts a weapon's logname to normal name.
Syntax
ts_wpnlogtoname ( logname[], name[], len )
Type
Native


Troubleshooting

1. Troubleshooting

Questions:
  • AMX Mod X doesn't load (bad load)
  • A module doesn't load
  • Modules or plugins don't load
  • A plugin doesn't load (badload)
  • How do I add admins?
  • My admin doesn't work!
  • I get "ML_LNOTFOUND"!
  • I get "ML_NOTFOUND"!
  • I get "Run time error 10!"
  • I get "Run time error <x>!"

Q: AMX Mod X doesn't load (bad load)
A: This could be caused by a number of things. On windows, it's almost always caused by the file being named incorrectly, being in the wrong place, or having the \addons\metamod\plugins.ini entry incorrect. On linux, it could be the above or a dependency failure. To see the error, type this at your server console: (make sure logging is on with "log on")
meta refresh
This will show you where AMX Mod X failed to load. If the file could not be found, make sure all locations above are correct. If you get an error about "_gxx_personality" or "lstdc++", it's possible your binary was compiled incorrectly. Contact the development team. If you get another error, your binary could be corrupt or for the wrong system.

Q: A module doesn't load
A: Read the above information on the AMX Mod X Core binary. Contact the developer of the module for more information.

Q: Modules or plugins don't load
A: Make sure your core.ini is correct - if you used AMX Mod X 0.16 before, it may be pointing toward the old path (addons/amxx).

Q: A plugin doesn't load (badload)
A: This could be caused by a number of things. First, make sure the plugin was downloaded correctly. If the file size is 0KB, the compile failed. If you compiled the plugin and/or used it with AMX Mod X 0.20-TP2, you should recompile it with the new compiler as the file format and compression changed. For other errors, see the Plugin Troubleshooting section.

Q: How do I add admins?
A: Please read the documentation for adding administrators.

Q: My admin doesn't work!
A: This is a loaded question as just about anything could be causing it. For general purposes, it's recommended that you authenticate by SteamID because then there's no need to set a password. Make sure your users.ini looks like this:
"STEAM_ID:0:1:1234" "" "abcdefghijklmnopqrstu" "ce"
Make sure your Steam ID is set correctly, that the second parameter "" is empty (two quotes), that you aren't using access flags "y" or "z", and that the last parameter is "ce" (c=steamid, e=no password).

Q: I get "ML_LNOTFOUND"!
A: This means that a plugin is attempting to translate a multi-lingual phrase which could not be found in any of the dictionaries. You should check to see what language key it is attempting to translate and ask the plugin author if it's incorrect, or check to make sure you have the latest dictionary files for the plugin.

Q: I get "ML_NOTFOUND"!
A: This means that a plugin is attempting to translate a multi-lingual phrase which was found in the dictionary files, but couldn't be translated to the language selected. You should check to make sure you have the latest dictionary files for the plugin or ask the author (or provide one yourself) with an acceptable translation for the key phrase.

Q: I get "Run time error 10!"
A: This an error that is extremely vague. It usually means a function failed to operate the way it should, or that there is a logic error in a plugin. For example, if a plugin tries to access a MySQL connection that does not exist, you will get a run time error 10. You should contact the plugin author to let him know what's failing.

Q: I get "Run time error <x>!"
A: Most run-time errors are harmless, but they can point out a serious logic error. If they occur once in a while they're probably safe to ignore, but repeated and frequent RTEs on similar lines of code in a plugin usually point to a flaw. You should contact the plugin author about the error.