faluco@1031: /** faluco@1031: * 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. faluco@1031: * 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. ds@1330: * 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 . faluco@1031: * faluco@1031: * Version: $Id$ faluco@1031: */ faluco@1031: faluco@1031: #if defined _sdktools_tempents_included faluco@1031: #endinput faluco@1031: #endif faluco@1031: #define _sdktools_tempents_included faluco@1031: faluco@1031: /** faluco@1255: * Called when a temp entity is going to be sent. faluco@1255: * faluco@1255: * @param te_name TE name. faluco@1255: * @param Players Array containing target player indexes. faluco@1255: * @param numClients Number of players in the array. faluco@1255: * @param delay Delay in seconds to send the TE. faluco@1255: * @return Plugin_Continue to allow the transmission of the TE, Plugin_Stop to block it. faluco@1255: */ dvander@2317: functag public Action:TEHook(const String:te_name[], const Players[], numClients, Float:delay); faluco@1255: faluco@1255: /** faluco@1255: * Hooks a temp entity. faluco@1255: * faluco@1255: * @param te_name TE name to hook. faluco@1255: * @param hook Function to use as a hook. faluco@1255: * @noreturn faluco@1255: * @error Temp Entity name not available or invalid function hook. faluco@1255: */ faluco@1255: native AddTempEntHook(const String:te_name[], TEHook:hook); faluco@1255: faluco@1255: /** faluco@1256: * Removes a temp entity hook. faluco@1255: * faluco@1255: * @param te_name TE name to unhook. faluco@1255: * @param hook Function used for the hook. faluco@1255: * @noreturn faluco@1255: * @error Temp Entity name not available or invalid function hook. faluco@1255: */ faluco@1255: native RemoveTempEntHook(const String:te_name[], TEHook:hook); faluco@1255: faluco@1255: /** faluco@1031: * Starts a temp entity transmission. faluco@1031: * faluco@1031: * @param te_name TE name. faluco@1031: * @noreturn faluco@1031: * @error Temp Entity name not available. faluco@1031: */ faluco@1031: native TE_Start(const String:te_name[]); faluco@1031: faluco@1031: /** faluco@1031: * Checks if a certain TE property exists. faluco@1031: * faluco@1031: * @param prop Property to use. faluco@1031: * @return True if the property exists, otherwise false. faluco@1031: */ faluco@1031: native bool:TE_IsValidProp(const String:prop[]); faluco@1031: faluco@1031: /** faluco@1031: * Sets an integer value in the current temp entity. faluco@1031: * faluco@1031: * @param prop Property to use. faluco@1031: * @param value Integer value to set. faluco@1031: * @noreturn faluco@1031: * @error Property not found. faluco@1031: */ faluco@1031: native TE_WriteNum(const String:prop[], value); faluco@1031: faluco@1031: /** faluco@1255: * Reads an integer value in the current temp entity. faluco@1255: * faluco@1255: * @param prop Property to use. faluco@1255: * @return Property value. faluco@1255: * @error Property not found. faluco@1255: */ faluco@1255: native TE_ReadNum(const String:prop[]); faluco@1255: faluco@1255: /** faluco@1031: * Sets a floating point number in the current temp entity. faluco@1031: * faluco@1031: * @param prop Property to use. faluco@1031: * @param value Floating point number to set. faluco@1031: * @noreturn faluco@1031: * @error Property not found. faluco@1031: */ faluco@1031: native TE_WriteFloat(const String:prop[], Float:value); faluco@1031: faluco@1031: /** faluco@1255: * Reads a floating point number in the current temp entity. faluco@1255: * faluco@1255: * @param prop Property to use. faluco@1255: * @noreturn Property value. faluco@1255: * @error Property not found. faluco@1255: */ faluco@1255: native Float:TE_ReadFloat(const String:prop[]); faluco@1255: faluco@1255: /** faluco@1031: * Sets a vector in the current temp entity. faluco@1031: * faluco@1031: * @param prop Property to use. faluco@1031: * @param vector Vector to set. faluco@1031: * @noreturn faluco@1031: * @error Property not found. faluco@1031: */ faluco@1039: native TE_WriteVector(const String:prop[], const Float:vector[3]); faluco@1031: faluco@1031: /** faluco@1255: * Reads a vector in the current temp entity. faluco@1255: * faluco@1255: * @param prop Property to use. faluco@1255: * @param vector Vector to read. faluco@1255: * @noreturn faluco@1255: * @error Property not found. faluco@1255: */ faluco@1255: native TE_ReadVector(const String:prop[], Float:vector[3]); faluco@1255: faluco@1255: /** faluco@1031: * Sets a QAngle in the current temp entity. faluco@1031: * faluco@1031: * @param prop Property to use. faluco@1031: * @param angles Angles to set. faluco@1031: * @return True on success, otherwise false. faluco@1031: * @error Property not found. faluco@1031: */ faluco@1039: native TE_WriteAngles(const String:prop[], const Float:angles[3]); faluco@1039: faluco@1039: /** faluco@1039: * Sets an array of floats in the current temp entity. faluco@1039: * faluco@1039: * @param prop Property to use. faluco@1039: * @param array Array of values to copy. faluco@1039: * @param arraySize Number of values to copy. faluco@1039: * @return True on success, otherwise false. faluco@1039: * @error Property not found. faluco@1039: */ faluco@1039: native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize); faluco@1031: faluco@1031: /** faluco@1031: * Sends the current temp entity to one or more clients. faluco@1031: * faluco@1031: * @param clients Array containing player indexes to broadcast to. faluco@1031: * @param numClients Number of players in the array. faluco@1031: * @param delay Delay in seconds to send the TE. faluco@1031: * @noreturn faluco@1031: * @error Invalid client index or client not in game. faluco@1031: */ faluco@1031: native TE_Send(clients[], numClients, Float:delay=0.0); faluco@1031: faluco@1031: /** faluco@1031: * Sets an encoded entity index in the current temp entity. faluco@1031: * (This is usually used for m_nStartEntity and m_nEndEntity). faluco@1031: * faluco@1031: * @param prop Property to use. faluco@1031: * @param value Value to set. faluco@1031: * @noreturn faluco@1031: * @error Property not found. faluco@1031: */ faluco@1031: stock TE_WriteEncodedEnt(const String:prop[], value) faluco@1031: { faluco@1031: new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12); faluco@1031: return TE_WriteNum(prop, encvalue); faluco@1031: } faluco@1031: faluco@1031: /** faluco@1031: * Broadcasts the current temp entity to all clients. faluco@1031: * @note See TE_Start(). faluco@1031: * faluco@1031: * @param delay Delay in seconds to send the TE. faluco@1031: * @noreturn faluco@1031: */ faluco@1031: stock TE_SendToAll(Float:delay=0.0) faluco@1031: { faluco@1031: new total = 0; skamonkey@2920: new clients[MaxClients]; skamonkey@2920: for (new i=1; i<=MaxClients; i++) faluco@1031: { faluco@1031: if (IsClientInGame(i)) faluco@1031: { faluco@1031: clients[total++] = i; faluco@1031: } faluco@1031: } faluco@1031: return TE_Send(clients, total, delay); faluco@1031: } faluco@1031: faluco@1031: /** faluco@1031: * Sends the current TE to only a client. faluco@1031: * @note See TE_Start(). faluco@1031: * faluco@1031: * @param client Client to send to. faluco@1031: * @param delay Delay in seconds to send the TE. faluco@1031: * @noreturn faluco@1031: * @error Invalid client index or client not in game. faluco@1031: */ dvander@1053: stock TE_SendToClient(client, Float:delay=0.0) faluco@1031: { faluco@1031: new players[1]; faluco@1031: faluco@1031: players[0] = client; faluco@1031: faluco@1031: return TE_Send(players, 1, delay); faluco@1031: }