scripting/include/cssdm.inc
author David Anderson <dvander@alliedmods.net>
Sun Jun 24 21:58:09 2007 +0000 (2007-06-24)
changeset 0 67dcd379a2d5
child 1 a23c4930415e
permissions -rw-r--r--
initial import of the amazing CS:S DM 2.0.0, so far only Windows is tested
     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$
    14  */
    15 
    16 #if defined _cssdm_included
    17  #endinput
    18 #endif
    19 #define _cssdm_included
    20 
    21 #define CSSDM_VERSION		"2.0.0.0"
    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 /**
   171  * Do not edit below this line!
   172  */
   173 public Extension:__ext_cssdm = 
   174 {
   175 	name = "CS:S DM",
   176 	file = "cssdm.ext",
   177 #if defined AUTOLOAD_EXTENSIONS
   178 	autoload = 1,
   179 #else
   180 	autoload = 0,
   181 #endif
   182 #if defined REQUIRE_EXTENSIONS
   183 	required = 1,
   184 #else
   185 	required = 0,
   186 #endif
   187 };