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