plugins/include/sdktools_tempents.inc
changeset 1031 d9cf44ddcd9c
child 1039 71e55e3fd8f7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/plugins/include/sdktools_tempents.inc	Mon Jul 02 00:25:46 2007 +0000
     1.3 @@ -0,0 +1,142 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * ===============================================================
     1.7 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     1.8 + * ===============================================================
     1.9 + *
    1.10 + *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
    1.11 + * or modified under the Terms and Conditions of its License Agreement, which is found 
    1.12 + * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
    1.13 + * may change at any time.  To view the latest information, see:
    1.14 + *   http://www.sourcemod.net/license.php
    1.15 + *
    1.16 + * Version: $Id$
    1.17 + */
    1.18 +
    1.19 +#if defined _sdktools_tempents_included
    1.20 + #endinput
    1.21 +#endif
    1.22 +#define _sdktools_tempents_included
    1.23 +
    1.24 +/**
    1.25 + * Starts a temp entity transmission.
    1.26 + *
    1.27 + * @param te_name	TE name.
    1.28 + * @noreturn
    1.29 + * @error		Temp Entity name not available.
    1.30 + */
    1.31 +native TE_Start(const String:te_name[]);
    1.32 +
    1.33 +/**
    1.34 + * Checks if a certain TE property exists.
    1.35 + *
    1.36 + * @param prop		Property to use.
    1.37 + * @return		True if the property exists, otherwise false.
    1.38 + */
    1.39 +native bool:TE_IsValidProp(const String:prop[]);
    1.40 +
    1.41 +/**
    1.42 + * Sets an integer value in the current temp entity.
    1.43 + *
    1.44 + * @param prop		Property to use.
    1.45 + * @param value		Integer value to set.
    1.46 + * @noreturn
    1.47 + * @error		Property not found.
    1.48 + */
    1.49 +native TE_WriteNum(const String:prop[], value);
    1.50 +
    1.51 +/**
    1.52 + * Sets a floating point number in the current temp entity.
    1.53 + *
    1.54 + * @param prop		Property to use.
    1.55 + * @param value		Floating point number to set.
    1.56 + * @noreturn
    1.57 + * @error		Property not found.
    1.58 + */
    1.59 +native TE_WriteFloat(const String:prop[], Float:value);
    1.60 +
    1.61 +/**
    1.62 + * Sets a vector in the current temp entity.
    1.63 + *
    1.64 + * @param prop		Property to use.
    1.65 + * @param vector	Vector to set.
    1.66 + * @noreturn
    1.67 + * @error		Property not found.
    1.68 + */
    1.69 +native TE_WriteVector(const String:prop[], Float:vector[3]);
    1.70 +
    1.71 +/**
    1.72 + * Sets a QAngle in the current temp entity.
    1.73 + *
    1.74 + * @param prop		Property to use.
    1.75 + * @param angles	Angles to set.
    1.76 + * @return		True on success, otherwise false.
    1.77 + * @error		Property not found.
    1.78 + */
    1.79 +native TE_WriteAngles(const String:prop[], Float:angles[3]);
    1.80 +
    1.81 +/**
    1.82 + * Sends the current temp entity to one or more clients.
    1.83 + *
    1.84 + * @param clients	Array containing player indexes to broadcast to.
    1.85 + * @param numClients	Number of players in the array.
    1.86 + * @param delay		Delay in seconds to send the TE.
    1.87 + * @noreturn
    1.88 + * @error		Invalid client index or client not in game.
    1.89 + */
    1.90 +native TE_Send(clients[], numClients, Float:delay=0.0);
    1.91 +
    1.92 +/**
    1.93 + * Sets an encoded entity index in the current temp entity.
    1.94 + * (This is usually used for m_nStartEntity and m_nEndEntity).
    1.95 + *
    1.96 + * @param prop		Property to use.
    1.97 + * @param value		Value to set.
    1.98 + * @noreturn
    1.99 + * @error		Property not found.
   1.100 + */
   1.101 +stock TE_WriteEncodedEnt(const String:prop[], value)
   1.102 +{
   1.103 +	new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12);
   1.104 +	return TE_WriteNum(prop, encvalue);
   1.105 +}
   1.106 +
   1.107 +/**
   1.108 + * Broadcasts the current temp entity to all clients.
   1.109 + * @note See TE_Start().
   1.110 + *
   1.111 + * @param delay		Delay in seconds to send the TE.
   1.112 + * @noreturn
   1.113 + */
   1.114 +stock TE_SendToAll(Float:delay=0.0)
   1.115 +{
   1.116 +	new maxClients = GetMaxClients();
   1.117 +	new total = 0;
   1.118 +	new clients[maxClients];
   1.119 +	for (new i=1; i<=maxClients; i++)
   1.120 +	{
   1.121 +		if (IsClientInGame(i))
   1.122 +		{
   1.123 +			clients[total++] = i;
   1.124 +		}
   1.125 +	}
   1.126 +	return TE_Send(clients, total, delay);
   1.127 +}
   1.128 +
   1.129 +/**
   1.130 + * Sends the current TE to only a client.
   1.131 + * @note See TE_Start().
   1.132 + *
   1.133 + * @param client	Client to send to.
   1.134 + * @param delay		Delay in seconds to send the TE.
   1.135 + * @noreturn
   1.136 + * @error		Invalid client index or client not in game.
   1.137 + */
   1.138 +stock TE_SendToOne(client, Float:delay=0.0)
   1.139 +{
   1.140 +	new players[1];
   1.141 +
   1.142 +	players[0] = client;
   1.143 +
   1.144 +	return TE_Send(players, 1, delay);
   1.145 +}