dvander@954: /** dvander@954: * vim: set ts=4 : ds@1330: * ============================================================================= ds@1947: * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. ds@1330: * ============================================================================= ds@1330: * ds@1330: * This file is part of the SourceMod/SourcePawn SDK. dvander@954: * ds@1330: * This program is free software; you can redistribute it and/or modify it under ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the ds@1330: * Free Software Foundation. ds@1330: * ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ds@1330: * details. dvander@954: * ds@1330: * You should have received a copy of the GNU General Public License along with ds@1330: * this program. If not, see . ds@1330: * ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants ds@1330: * this exception to all derivative works. AlliedModders LLC defines further ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), ds@1330: * or . ds@1330: * ds@1330: * Version: $Id$ dvander@954: */ dvander@954: dvander@954: #if defined _sdktools_functions_included dvander@954: #endinput dvander@954: #endif dvander@954: #define _sdktools_functions_included dvander@954: dvander@954: /** dvander@954: * Removes a player's item. dvander@954: * dvander@954: * @param client Client index. dvander@954: * @param item CBaseCombatWeapon entity index. dvander@954: * @return True on success, false otherwise. dvander@954: * @error Invalid client or entity, lack of mod support, or client not in dvander@954: * game. dvander@954: */ dvander@954: native bool:RemovePlayerItem(client, item); dvander@954: dvander@954: /** dvander@954: * Gives a named item to a player. dvander@954: * dvander@954: * @param client Client index. dvander@954: * @param item Item classname (such as weapon_ak47). dvander@954: * @param iSubType Unknown. dvander@954: * @return Entity index on success, or -1 on failure. dvander@954: * @error Invalid client or client not in game, or lack of mod support. dvander@954: */ dvander@954: native GivePlayerItem(client, const String:item[], iSubType=0); dvander@954: dvander@954: /** dvander@954: * Returns the weapon in a player's slot. dvander@954: * dvander@954: * @param client Client index. dvander@954: * @param slot Slot index (mod specific). dvander@954: * @return Entity index on success, -1 if no weapon existed. dvander@955: * @error Invalid client or client not in game, or lack of mod support. dvander@955: */ dvander@955: native GetPlayerWeaponSlot(client, slot); dvander@955: dvander@955: /** dvander@980: * Ignites an entity on fire. dvander@955: * dvander@980: * @param entity Entity index. dvander@955: * @param time Number of seconds to set on fire. dvander@955: * @param npc True to only affect NPCs. dvander@955: * @param size Unknown. dvander@955: * @param level Unknown. dvander@955: * @noreturn dvander@980: * @error Invalid entity or client not in game, or lack of mod support. dvander@954: */ dvander@980: native IgniteEntity(entity, Float:time, bool:npc=false, Float:size=0.0, bool:level=false); dvander@955: dvander@955: /** dvander@955: * Extinguishes a player that is on fire. dvander@955: * dvander@980: * @param entity Entity index. dvander@955: * @noreturn dvander@980: * @error Invalid entity or client not in game, or lack of mod support. dvander@955: */ dvander@980: native ExtinguishEntity(client); dvander@955: dvander@955: /** dvander@980: * Teleports an entity. dvander@955: * dvander@980: * @param entity Client index. dvander@955: * @param origin New origin, or NULL_VECTOR for no change. dvander@955: * @param angles New angles, or NULL_VECTOR for no change. dvander@955: * @param velocity New velocity, or NULL_VECTOR for no change. dvander@955: * @noreturn dvander@980: * @error Invalid entity or client not in game, or lack of mod support. dvander@980: */ dvander@980: native TeleportEntity(entity, const Float:origin[3], const Float:angles[3], const Float:velocity[3]); dvander@980: dvander@980: /** dvander@1151: * Forces a player to commit suicide. dvander@1151: * dvander@1151: * @param client Client index. dvander@1151: * @noreturn dvander@1169: * @error Invalid client or client not in game, or lack of mod support. dvander@1151: */ dvander@1151: native ForcePlayerSuicide(client); dvander@1151: dvander@1151: /** dvander@1169: * Slaps a player in a random direction. dvander@1169: * dvander@1169: * @param client Client index. dvander@1169: * @param health Health to subtract. dvander@1169: * @param sound False to disable the sound effects. dvander@1169: * @noreturn dvander@1169: * @error Invalid client or client not in game, or lack of mod support. dvander@1169: */ dvander@1169: native SlapPlayer(client, health=5, bool:sound=true); dvander@1169: dvander@1169: /** ds@1240: * Searches for an entity by classname. ds@1240: * dvander@1918: * @param startEnt The entity index after which to begin searching from. ds@1240: * Use -1 to start from the first entity. ds@1240: * @param classname Classname of the entity to find. ds@1240: * @return Entity index >= 0 if found, -1 otherwise. ds@1240: * @error Lack of mod support. ds@1240: */ ds@1240: native FindEntityByClassname(startEnt, const String:classname[]); ds@1240: ds@1240: /** faluco@1219: * Returns the client's eye angles. faluco@1219: * faluco@1219: * @param client Player's index. faluco@1219: * @param ang Destination vector to store the client's eye angles. dvander@1611: * @return True on success, false on failure. faluco@1219: * @error Invalid client index, client not in game, or no mod support. faluco@1219: */ dvander@1611: native bool:GetClientEyeAngles(client, Float:ang[3]); faluco@1219: faluco@1219: /** faluco@1428: * Creates an entity by string name, but does not spawn it (see DispatchSpawn). faluco@1428: * If ForceEdictIndex is not -1, then it will use the edict by that index. If the index is faluco@1428: * invalid or there is already an edict using that index, it will error out. faluco@1428: * dvander@1611: * @param classname Entity classname. faluco@1428: * @param ForceEdictIndex Edict index used by the created entity. dvander@1611: * @return Entity index on success, or -1 on failure. dvander@1611: * @error Invalid edict index, or no mod support. faluco@1428: */ faluco@1428: native CreateEntityByName(const String:classname[], ForceEdictIndex=-1); faluco@1428: faluco@1428: /** faluco@1428: * Spawns an entity into the game. faluco@1428: * faluco@1428: * @param entity Entity index of the created entity. dvander@1611: * @return True on success, false otherwise. dvander@1611: * @error Invalid entity index, or no mod support. faluco@1428: */ faluco@1428: native bool:DispatchSpawn(entity); faluco@1428: faluco@1428: /** faluco@1504: * Dispatches a KeyValue into given entity using a string value. faluco@1504: * faluco@1504: * @param entity Destination entity index. faluco@1504: * @param keyName Name of the key. faluco@1504: * @param value String value. dvander@1611: * @return True on success, false otherwise. dvander@1611: * @error Invalid entity index, or no mod support. faluco@1504: */ faluco@1504: native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[]); faluco@1504: faluco@1504: /** faluco@1504: * Dispatches a KeyValue into given entity using a floating point value. faluco@1504: * faluco@1504: * @param entity Destination entity index. faluco@1504: * @param keyName Name of the key. faluco@1504: * @param value Floating point value. dvander@1611: * @return True on success, false otherwise. dvander@1611: * @error Invalid entity index, or no mod support. faluco@1504: */ faluco@1504: native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value); faluco@1504: faluco@1504: /** faluco@1504: * Dispatches a KeyValue into given entity using a vector value. faluco@1504: * faluco@1504: * @param entity Destination entity index. faluco@1504: * @param keyName Name of the key. faluco@1504: * @param vec Vector value. dvander@1611: * @return True on success, false otherwise. dvander@1611: * @error Invalid entity index, or no mod support. faluco@1504: */ faluco@1504: native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:vector[3]); faluco@1504: faluco@1504: /** dvander@1611: * Returns the entity a client is aiming at. dvander@1611: * dvander@1611: * @param client Client performing the aiming. dvander@1611: * @param only_clients True to exclude all entities but clients. dvander@1611: * @return Entity index being aimed at. dvander@1611: * -1 if no entity is being aimed at. dvander@1611: * -2 if the function is not supported. dvander@1612: * @error Invalid client index or client not in game. dvander@1611: */ dvander@1611: native GetClientAimTarget(client, bool:only_clients=true); dvander@1611: dvander@1611: /** faluco@1613: * Returns the total number of teams in a game. faluco@1993: * Note: This native should not be called before OnMapStart. faluco@1613: * faluco@1613: * @return Total number of teams. faluco@1613: */ faluco@1613: native GetTeamCount(); faluco@1613: faluco@1613: /** faluco@1613: * Retrieves the team name based on a team index. faluco@1993: * Note: This native should not be called before OnMapStart. faluco@1613: * faluco@1613: * @param index Team index. faluco@1613: * @param name Buffer to store string in. faluco@1613: * @param maxlength Maximum length of string buffer. faluco@1613: * @noreturn faluco@1613: * @error Invalid team index. faluco@1613: */ faluco@1613: native GetTeamName(index, String:name[], maxlength); faluco@1613: faluco@1613: /** faluco@1613: * Returns the score of a team based on a team index. faluco@1993: * Note: This native should not be called before OnMapStart. faluco@1613: * faluco@1613: * @param index Team index. faluco@1613: * @return Score. faluco@1613: * @error Invalid team index. faluco@1613: */ faluco@1613: native GetTeamScore(index); faluco@1613: faluco@1613: /** faluco@1613: * Sets the score of a team based on a team index. faluco@1993: * Note: This native should not be called before OnMapStart. faluco@1613: * faluco@1613: * @param index Team index. faluco@1615: * @param value New score value. faluco@1613: * @return Score. faluco@1613: * @error Invalid team index. faluco@1613: */ faluco@1615: native SetTeamScore(index, value); faluco@1613: faluco@1613: /** faluco@1613: * Retrieves the number of players in a certain team. faluco@1993: * Note: This native should not be called before OnMapStart. faluco@1613: * faluco@1613: * @param index Team index. faluco@1613: * @return Number of players in the team. faluco@1613: * @error Invalid team index. faluco@1613: */ faluco@1613: native GetTeamClientCount(index); faluco@1613: faluco@1613: /** faluco@1720: * Sets the model to a given entity. faluco@1720: * faluco@1720: * @param entity Entity index. faluco@1720: * @param model Model name. faluco@1720: * @noreturn faluco@1720: * @error Invalid entity index, or no mod support. faluco@1720: */ faluco@1720: native SetEntityModel(entity, const String:model[]); faluco@1720: faluco@1720: /** faluco@1769: * Retrieves the decal file name associated to a given client. faluco@1769: * faluco@1769: * @param client Player's index. faluco@1769: * @param hex Buffer to store the logo filename. faluco@1769: * @param maxlength Maximum length of string buffer. faluco@1769: * @return True on success, otherwise false. faluco@1769: * @error Invalid client or client not in game. faluco@1769: */ faluco@1769: native bool:GetPlayerDecalFile(client, String:hex[], maxlength); faluco@1769: faluco@1769: /** faluco@1769: * Returns the average server network traffic in bytes/sec. faluco@1769: * faluco@1769: * @param in Buffer to store the input traffic velocity. faluco@1769: * @param out Buffer to store the output traffic velocity. faluco@1769: * @noreturn faluco@1769: */ faluco@1769: native GetServerNetStats(&Float:in, &Float:out); pred@1956: pred@1956: /** pred@1956: * Equip's a player's weapon. pred@1956: * pred@1956: * @param client Client index. pred@1956: * @param item CBaseCombatWeapon entity index. pred@1956: * @noreturn pred@1956: * @error Invalid client or entity, lack of mod support, or client not in pred@1956: * game. pred@1956: */ pred@1956: native EquipPlayerWeapon(client, weapon); dvander@2007: dvander@2007: /** dvander@2007: * Activates an entity (CBaseAnimating::Activate) dvander@2007: * dvander@2007: * @param entity Entity index. dvander@2007: * @noreturn dvander@2007: * @error Invalid entity or lack of mod support. dvander@2007: */ dvander@2007: native ActivateEntity(entity); pred@2107: pred@2107: /** pred@2107: * Sets values to client info buffer keys and notifies the engine of the change. pred@2107: * The change does not get propogated to mods until the next frame. pred@2107: * pred@2107: * @param client Player's index. pred@2107: * @param key Key string. pred@2107: * @param value Value string. pred@2107: * @noreturn pred@2107: * @error Invalid client index, or client not connected. pred@2107: */ pred@2107: native SetClientInfo(client, const String:key[], const String:value[]);