|
faluco@1031
|
1 |
/** |
|
faluco@1031
|
2 |
* vim: set ts=4 : |
|
faluco@1031
|
3 |
* =============================================================== |
|
faluco@1031
|
4 |
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved. |
|
faluco@1031
|
5 |
* =============================================================== |
|
faluco@1031
|
6 |
* |
|
faluco@1031
|
7 |
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used |
|
faluco@1031
|
8 |
* or modified under the Terms and Conditions of its License Agreement, which is found |
|
faluco@1031
|
9 |
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins |
|
faluco@1031
|
10 |
* may change at any time. To view the latest information, see: |
|
faluco@1031
|
11 |
* http://www.sourcemod.net/license.php |
|
faluco@1031
|
12 |
* |
|
faluco@1031
|
13 |
* Version: $Id$ |
|
faluco@1031
|
14 |
*/ |
|
faluco@1031
|
15 |
|
|
faluco@1031
|
16 |
#if defined _sdktools_tempents_included |
|
faluco@1031
|
17 |
#endinput |
|
faluco@1031
|
18 |
#endif |
|
faluco@1031
|
19 |
#define _sdktools_tempents_included |
|
faluco@1031
|
20 |
|
|
faluco@1031
|
21 |
/** |
|
faluco@1031
|
22 |
* Starts a temp entity transmission. |
|
faluco@1031
|
23 |
* |
|
faluco@1031
|
24 |
* @param te_name TE name. |
|
faluco@1031
|
25 |
* @noreturn |
|
faluco@1031
|
26 |
* @error Temp Entity name not available. |
|
faluco@1031
|
27 |
*/ |
|
faluco@1031
|
28 |
native TE_Start(const String:te_name[]); |
|
faluco@1031
|
29 |
|
|
faluco@1031
|
30 |
/** |
|
faluco@1031
|
31 |
* Checks if a certain TE property exists. |
|
faluco@1031
|
32 |
* |
|
faluco@1031
|
33 |
* @param prop Property to use. |
|
faluco@1031
|
34 |
* @return True if the property exists, otherwise false. |
|
faluco@1031
|
35 |
*/ |
|
faluco@1031
|
36 |
native bool:TE_IsValidProp(const String:prop[]); |
|
faluco@1031
|
37 |
|
|
faluco@1031
|
38 |
/** |
|
faluco@1031
|
39 |
* Sets an integer value in the current temp entity. |
|
faluco@1031
|
40 |
* |
|
faluco@1031
|
41 |
* @param prop Property to use. |
|
faluco@1031
|
42 |
* @param value Integer value to set. |
|
faluco@1031
|
43 |
* @noreturn |
|
faluco@1031
|
44 |
* @error Property not found. |
|
faluco@1031
|
45 |
*/ |
|
faluco@1031
|
46 |
native TE_WriteNum(const String:prop[], value); |
|
faluco@1031
|
47 |
|
|
faluco@1031
|
48 |
/** |
|
faluco@1031
|
49 |
* Sets a floating point number in the current temp entity. |
|
faluco@1031
|
50 |
* |
|
faluco@1031
|
51 |
* @param prop Property to use. |
|
faluco@1031
|
52 |
* @param value Floating point number to set. |
|
faluco@1031
|
53 |
* @noreturn |
|
faluco@1031
|
54 |
* @error Property not found. |
|
faluco@1031
|
55 |
*/ |
|
faluco@1031
|
56 |
native TE_WriteFloat(const String:prop[], Float:value); |
|
faluco@1031
|
57 |
|
|
faluco@1031
|
58 |
/** |
|
faluco@1031
|
59 |
* Sets a vector in the current temp entity. |
|
faluco@1031
|
60 |
* |
|
faluco@1031
|
61 |
* @param prop Property to use. |
|
faluco@1031
|
62 |
* @param vector Vector to set. |
|
faluco@1031
|
63 |
* @noreturn |
|
faluco@1031
|
64 |
* @error Property not found. |
|
faluco@1031
|
65 |
*/ |
|
faluco@1039
|
66 |
native TE_WriteVector(const String:prop[], const Float:vector[3]); |
|
faluco@1031
|
67 |
|
|
faluco@1031
|
68 |
/** |
|
faluco@1031
|
69 |
* Sets a QAngle in the current temp entity. |
|
faluco@1031
|
70 |
* |
|
faluco@1031
|
71 |
* @param prop Property to use. |
|
faluco@1031
|
72 |
* @param angles Angles to set. |
|
faluco@1031
|
73 |
* @return True on success, otherwise false. |
|
faluco@1031
|
74 |
* @error Property not found. |
|
faluco@1031
|
75 |
*/ |
|
faluco@1039
|
76 |
native TE_WriteAngles(const String:prop[], const Float:angles[3]); |
|
faluco@1039
|
77 |
|
|
faluco@1039
|
78 |
/** |
|
faluco@1039
|
79 |
* Sets an array of floats in the current temp entity. |
|
faluco@1039
|
80 |
* |
|
faluco@1039
|
81 |
* @param prop Property to use. |
|
faluco@1039
|
82 |
* @param array Array of values to copy. |
|
faluco@1039
|
83 |
* @param arraySize Number of values to copy. |
|
faluco@1039
|
84 |
* @return True on success, otherwise false. |
|
faluco@1039
|
85 |
* @error Property not found. |
|
faluco@1039
|
86 |
*/ |
|
faluco@1039
|
87 |
native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize); |
|
faluco@1031
|
88 |
|
|
faluco@1031
|
89 |
/** |
|
faluco@1031
|
90 |
* Sends the current temp entity to one or more clients. |
|
faluco@1031
|
91 |
* |
|
faluco@1031
|
92 |
* @param clients Array containing player indexes to broadcast to. |
|
faluco@1031
|
93 |
* @param numClients Number of players in the array. |
|
faluco@1031
|
94 |
* @param delay Delay in seconds to send the TE. |
|
faluco@1031
|
95 |
* @noreturn |
|
faluco@1031
|
96 |
* @error Invalid client index or client not in game. |
|
faluco@1031
|
97 |
*/ |
|
faluco@1031
|
98 |
native TE_Send(clients[], numClients, Float:delay=0.0); |
|
faluco@1031
|
99 |
|
|
faluco@1031
|
100 |
/** |
|
faluco@1031
|
101 |
* Sets an encoded entity index in the current temp entity. |
|
faluco@1031
|
102 |
* (This is usually used for m_nStartEntity and m_nEndEntity). |
|
faluco@1031
|
103 |
* |
|
faluco@1031
|
104 |
* @param prop Property to use. |
|
faluco@1031
|
105 |
* @param value Value to set. |
|
faluco@1031
|
106 |
* @noreturn |
|
faluco@1031
|
107 |
* @error Property not found. |
|
faluco@1031
|
108 |
*/ |
|
faluco@1031
|
109 |
stock TE_WriteEncodedEnt(const String:prop[], value) |
|
faluco@1031
|
110 |
{ |
|
faluco@1031
|
111 |
new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12); |
|
faluco@1031
|
112 |
return TE_WriteNum(prop, encvalue); |
|
faluco@1031
|
113 |
} |
|
faluco@1031
|
114 |
|
|
faluco@1031
|
115 |
/** |
|
faluco@1031
|
116 |
* Broadcasts the current temp entity to all clients. |
|
faluco@1031
|
117 |
* @note See TE_Start(). |
|
faluco@1031
|
118 |
* |
|
faluco@1031
|
119 |
* @param delay Delay in seconds to send the TE. |
|
faluco@1031
|
120 |
* @noreturn |
|
faluco@1031
|
121 |
*/ |
|
faluco@1031
|
122 |
stock TE_SendToAll(Float:delay=0.0) |
|
faluco@1031
|
123 |
{ |
|
faluco@1031
|
124 |
new maxClients = GetMaxClients(); |
|
faluco@1031
|
125 |
new total = 0; |
|
faluco@1031
|
126 |
new clients[maxClients]; |
|
faluco@1031
|
127 |
for (new i=1; i<=maxClients; i++) |
|
faluco@1031
|
128 |
{ |
|
faluco@1031
|
129 |
if (IsClientInGame(i)) |
|
faluco@1031
|
130 |
{ |
|
faluco@1031
|
131 |
clients[total++] = i; |
|
faluco@1031
|
132 |
} |
|
faluco@1031
|
133 |
} |
|
faluco@1031
|
134 |
return TE_Send(clients, total, delay); |
|
faluco@1031
|
135 |
} |
|
faluco@1031
|
136 |
|
|
faluco@1031
|
137 |
/** |
|
faluco@1031
|
138 |
* Sends the current TE to only a client. |
|
faluco@1031
|
139 |
* @note See TE_Start(). |
|
faluco@1031
|
140 |
* |
|
faluco@1031
|
141 |
* @param client Client to send to. |
|
faluco@1031
|
142 |
* @param delay Delay in seconds to send the TE. |
|
faluco@1031
|
143 |
* @noreturn |
|
faluco@1031
|
144 |
* @error Invalid client index or client not in game. |
|
faluco@1031
|
145 |
*/ |
|
dvander@1053
|
146 |
stock TE_SendToClient(client, Float:delay=0.0) |
|
faluco@1031
|
147 |
{ |
|
faluco@1031
|
148 |
new players[1]; |
|
faluco@1031
|
149 |
|
|
faluco@1031
|
150 |
players[0] = client; |
|
faluco@1031
|
151 |
|
|
faluco@1031
|
152 |
return TE_Send(players, 1, delay); |
|
faluco@1031
|
153 |
} |