3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
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
16 #if defined _sdktools_tempents_included
19 #define _sdktools_tempents_included
22 * Starts a temp entity transmission.
24 * @param te_name TE name.
26 * @error Temp Entity name not available.
28 native TE_Start(const String:te_name[]);
31 * Checks if a certain TE property exists.
33 * @param prop Property to use.
34 * @return True if the property exists, otherwise false.
36 native bool:TE_IsValidProp(const String:prop[]);
39 * Sets an integer value in the current temp entity.
41 * @param prop Property to use.
42 * @param value Integer value to set.
44 * @error Property not found.
46 native TE_WriteNum(const String:prop[], value);
49 * Sets a floating point number in the current temp entity.
51 * @param prop Property to use.
52 * @param value Floating point number to set.
54 * @error Property not found.
56 native TE_WriteFloat(const String:prop[], Float:value);
59 * Sets a vector in the current temp entity.
61 * @param prop Property to use.
62 * @param vector Vector to set.
64 * @error Property not found.
66 native TE_WriteVector(const String:prop[], const Float:vector[3]);
69 * Sets a QAngle in the current temp entity.
71 * @param prop Property to use.
72 * @param angles Angles to set.
73 * @return True on success, otherwise false.
74 * @error Property not found.
76 native TE_WriteAngles(const String:prop[], const Float:angles[3]);
79 * Sets an array of floats in the current temp entity.
81 * @param prop Property to use.
82 * @param array Array of values to copy.
83 * @param arraySize Number of values to copy.
84 * @return True on success, otherwise false.
85 * @error Property not found.
87 native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize);
90 * Sends the current temp entity to one or more clients.
92 * @param clients Array containing player indexes to broadcast to.
93 * @param numClients Number of players in the array.
94 * @param delay Delay in seconds to send the TE.
96 * @error Invalid client index or client not in game.
98 native TE_Send(clients[], numClients, Float:delay=0.0);
101 * Sets an encoded entity index in the current temp entity.
102 * (This is usually used for m_nStartEntity and m_nEndEntity).
104 * @param prop Property to use.
105 * @param value Value to set.
107 * @error Property not found.
109 stock TE_WriteEncodedEnt(const String:prop[], value)
111 new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12);
112 return TE_WriteNum(prop, encvalue);
116 * Broadcasts the current temp entity to all clients.
117 * @note See TE_Start().
119 * @param delay Delay in seconds to send the TE.
122 stock TE_SendToAll(Float:delay=0.0)
124 new maxClients = GetMaxClients();
126 new clients[maxClients];
127 for (new i=1; i<=maxClients; i++)
129 if (IsClientInGame(i))
131 clients[total++] = i;
134 return TE_Send(clients, total, delay);
138 * Sends the current TE to only a client.
139 * @note See TE_Start().
141 * @param client Client to send to.
142 * @param delay Delay in seconds to send the TE.
144 * @error Invalid client index or client not in game.
146 stock TE_SendToClient(client, Float:delay=0.0)
152 return TE_Send(players, 1, delay);