scripting/include/cssdm.inc
author David Anderson <dvander@alliedmods.net>
Sat Jun 25 00:23:32 2011 -0700 (2011-06-25)
changeset 72 e0144d048875
parent 58 69989a9e83ff
child 73 983071070c48
permissions -rw-r--r--
Bumped version.
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
     8  * or modified under the Terms and Conditions of its License Agreement, which is found 
     9  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
    10  * may change at any time.  To view the latest information, see:
    11  *   http://www.sourcemod.net/license.php
    12  *
    13  * Version: $Id: cssdm.inc 416 2007-07-25 04:38:40Z dvander $
    14  */
    15 
    16 #if defined _cssdm_included
    17  #endinput
    18 #endif
    19 #define _cssdm_included
    20 
    21 #define CSSDM_VERSION		"2.1.4"
    22 
    23 #define CSSDM_MAX_WEAPONS		32
    24 
    25 #define CSSDM_TEAM_T			2
    26 #define CSSDM_TEAM_CT			3
    27 
    28 enum DmWeaponType
    29 {
    30 	DmWeapon_Invalid = -1,
    31 	DmWeapon_Primary = 0,
    32 	DmWeapon_Secondary = 1,
    33 	DmWeapon_Grenade = 3,
    34 	DmWeapon_C4 = 4,
    35 };
    36 
    37 /**
    38  * Called when CS:S DM is started/enabled.  If CS:S DM is enabled,
    39  * this will get called at the start of every map.
    40  */
    41 forward DM_OnStartup();
    42 
    43 /**
    44  * Called when CS:S DM is disabled.  If CS:S DM is enabled, this 
    45  * will get called at the end of the map.
    46  */
    47 forward DM_OnShutdown();
    48 
    49 /**
    50  * Called when a player spawns and CS:S DM is active.  This
    51  * is a wrapper around the "player_spawn" event.
    52  *
    53  * @param client		Client index.
    54  * @noreturn
    55  */
    56 forward DM_OnClientSpawned(client);
    57 
    58 /**
    59  * Called when a player spawns and CS:S DM is active.  This 
    60  * is called after all plugins are done processing 
    61  * DM_OnClientSpawned().
    62  *
    63  * @param client		Client index.
    64  * @noreturn
    65  */
    66 forward DM_OnClientPostSpawned(client);
    67 
    68 /**
    69  * Called when a player dies.
    70  * 
    71  *
    72  * @param client		Client index.
    73  * @return				Plugin_Handled to block player from respawning.
    74  */
    75 forward Action:DM_OnClientDeath(client);
    76 
    77 /**
    78  * Called when the cssdm_spawn_method cvar changes.
    79  *
    80  * @param method		Method name.
    81  * @return				Plugin_Stop to handle this method.
    82  */
    83 forward Action:DM_OnSetSpawnMethod(const String:method[]);
    84 
    85 /**
    86  * Returns whether CS:S DM is running or not.  This should be used to 
    87  * check whether non-CS:S DM callbacks should be processed.
    88  *
    89  * @return				True if CS:S DM is running, false otherwise.
    90  */
    91 native bool:DM_IsRunning();
    92 
    93 /**
    94  * Retrieves the CS:S DM spawning method.
    95  *
    96  * @param method		Method name buffer.
    97  * @param maxlength		Maximum size of the method name buffer.
    98  * @noreturn
    99  */
   100 native DM_GetSpawnMethod(const String:method[], maxlength);
   101 
   102 /**
   103  * Provides lookup for a weapon by its short name.
   104  *
   105  * @param name			Weapon short name (such as "usp").
   106  * @return				Weapon ID in CS:S DM, or -1 on failure.
   107  */
   108 native DM_GetWeaponID(const String:name[]);
   109 
   110 /**
   111  * Gets the type of a weapon by index.
   112  *
   113  * @param id			Weapon ID.
   114  * @return				Weapon type.
   115  * @error				Invalid weapon index.
   116  */
   117 native DmWeaponType:DM_GetWeaponType(index);
   118 
   119 /**
   120  * Retrieves the classname of a weapon. 
   121  *
   122  * @param id			Weapon ID.
   123  * @param classname		Class name buffer.
   124  * @param maxlength		Maximum length of the class name buffer.
   125  * @noreturn
   126  * @error				Invalid weapon index.
   127  */
   128 native DM_GetWeaponClassname(id, String:classname[], maxlength);
   129 
   130 /**
   131  * Retrieves the display name of a weapon. 
   132  *
   133  * @param id			Weapon ID.
   134  * @param name			Display name buffer.
   135  * @param maxlength		Maximum length of the display name buffer.
   136  * @noreturn
   137  * @error				Invalid weapon index.
   138  */
   139 native DM_GetWeaponName(id, String:name[], maxlength);
   140 
   141 /**
   142  * Retrieves the entity index of a weapon in a player's weapon slot.
   143  *
   144  * @param client		Client index.
   145  * @param type			Weapon slot type.
   146  * @return				Entity index, or -1 for none.
   147  */
   148 native DM_GetClientWeapon(client, DmWeaponType:type);
   149 
   150 /**
   151  * Drops a client's weapon.  CS:S DM removes dropped weapons from the world.
   152  *
   153  * @param client		Client index.
   154  * @param entity		Weapon entity index.
   155  * @noreturn
   156  * @error				Client index invalid or not in game; weapon entity invalid.
   157  */
   158 native DM_DropWeapon(client, entity);
   159 
   160 /**
   161  * Strips all items from a bot, excluding their player suit.
   162  *
   163  * @param client		Client index.
   164  * @noreturn
   165  * @error				Invalid client index, client not in game, nor client not a bot.
   166  */
   167 native DM_StripBotItems(client);
   168 
   169 /**
   170  * Returns the spawn waiting time.
   171  *
   172  * @return				Spawn wait time, in seconds.
   173  */
   174 native Float:DM_GetSpawnWaitTime();
   175 
   176 /**
   177  * Respawns a player using CS:S's low level respawning function.  This can be 
   178  * called even if the player is not dead.
   179  *
   180  * @param client		Client index.
   181  * @param fullRespawn	If true, client will be forwarded through player_spawn 
   182  *						callbacks.
   183  * @noreturn
   184  * @error				Invalid client index or client not in game.
   185  */
   186 native DM_RespawnClient(client, bool:fullRespawn=true);
   187 
   188 /**
   189  * Returns whether or not a client is alive.
   190  *
   191  * @param client		Client index.
   192  * @return				True if alive, false if dead.
   193  * @error				Invalid client index or client not in game.
   194  */
   195 native DM_IsClientAlive(client);
   196 
   197 /**
   198  * Gives ammo to a player.
   199  *
   200  * @param client		Client index.
   201  * @param type			Ammo type (>=0).
   202  * @param count			Ammo amount to give.
   203  * @param noSound		If true, the ammo sound will be suppressed.
   204  * @return				Actual ammo amount given.
   205  * @error				Invalid client index or client not in game.
   206  */
   207 native DM_GiveClientAmmo(client, type, count, bool:noSound=false);
   208 
   209 /**
   210  * Do not edit below this line!
   211  */
   212 public Extension:__ext_cssdm = 
   213 {
   214 	name = "CS:S DM",
   215 	file = "cssdm.ext",
   216 #if defined AUTOLOAD_EXTENSIONS
   217 	autoload = 1,
   218 #else
   219 	autoload = 0,
   220 #endif
   221 #if defined REQUIRE_EXTENSIONS
   222 	required = 1,
   223 #else
   224 	required = 0,
   225 #endif
   226 };