plugins/include/sdktools_tempents.inc
author David Anderson <dvander@alliedmods.net>
Wed Jul 25 20:23:34 2007 +0000 (2007-07-25)
changeset 1169 47a8892d2c81
parent 1053 6d642ebae456
child 1255 e3db1a9eb578
permissions -rw-r--r--
added amb416 - SlapPlayer()
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     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
    12  *
    13  * Version: $Id$
    14  */
    15 
    16 #if defined _sdktools_tempents_included
    17  #endinput
    18 #endif
    19 #define _sdktools_tempents_included
    20 
    21 /**
    22  * Starts a temp entity transmission.
    23  *
    24  * @param te_name	TE name.
    25  * @noreturn
    26  * @error		Temp Entity name not available.
    27  */
    28 native TE_Start(const String:te_name[]);
    29 
    30 /**
    31  * Checks if a certain TE property exists.
    32  *
    33  * @param prop		Property to use.
    34  * @return		True if the property exists, otherwise false.
    35  */
    36 native bool:TE_IsValidProp(const String:prop[]);
    37 
    38 /**
    39  * Sets an integer value in the current temp entity.
    40  *
    41  * @param prop		Property to use.
    42  * @param value		Integer value to set.
    43  * @noreturn
    44  * @error		Property not found.
    45  */
    46 native TE_WriteNum(const String:prop[], value);
    47 
    48 /**
    49  * Sets a floating point number in the current temp entity.
    50  *
    51  * @param prop		Property to use.
    52  * @param value		Floating point number to set.
    53  * @noreturn
    54  * @error		Property not found.
    55  */
    56 native TE_WriteFloat(const String:prop[], Float:value);
    57 
    58 /**
    59  * Sets a vector in the current temp entity.
    60  *
    61  * @param prop		Property to use.
    62  * @param vector	Vector to set.
    63  * @noreturn
    64  * @error		Property not found.
    65  */
    66 native TE_WriteVector(const String:prop[], const Float:vector[3]);
    67 
    68 /**
    69  * Sets a QAngle in the current temp entity.
    70  *
    71  * @param prop		Property to use.
    72  * @param angles	Angles to set.
    73  * @return		True on success, otherwise false.
    74  * @error		Property not found.
    75  */
    76 native TE_WriteAngles(const String:prop[], const Float:angles[3]);
    77 
    78 /**
    79  * Sets an array of floats in the current temp entity.
    80  *
    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.
    86  */
    87 native TE_WriteFloatArray(const String:prop[], const Float:array[], arraySize);
    88 
    89 /**
    90  * Sends the current temp entity to one or more clients.
    91  *
    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.
    95  * @noreturn
    96  * @error		Invalid client index or client not in game.
    97  */
    98 native TE_Send(clients[], numClients, Float:delay=0.0);
    99 
   100 /**
   101  * Sets an encoded entity index in the current temp entity.
   102  * (This is usually used for m_nStartEntity and m_nEndEntity).
   103  *
   104  * @param prop		Property to use.
   105  * @param value		Value to set.
   106  * @noreturn
   107  * @error		Property not found.
   108  */
   109 stock TE_WriteEncodedEnt(const String:prop[], value)
   110 {
   111 	new encvalue = (value & 0x0FFF) | ((1 & 0xF)<<12);
   112 	return TE_WriteNum(prop, encvalue);
   113 }
   114 
   115 /**
   116  * Broadcasts the current temp entity to all clients.
   117  * @note See TE_Start().
   118  *
   119  * @param delay		Delay in seconds to send the TE.
   120  * @noreturn
   121  */
   122 stock TE_SendToAll(Float:delay=0.0)
   123 {
   124 	new maxClients = GetMaxClients();
   125 	new total = 0;
   126 	new clients[maxClients];
   127 	for (new i=1; i<=maxClients; i++)
   128 	{
   129 		if (IsClientInGame(i))
   130 		{
   131 			clients[total++] = i;
   132 		}
   133 	}
   134 	return TE_Send(clients, total, delay);
   135 }
   136 
   137 /**
   138  * Sends the current TE to only a client.
   139  * @note See TE_Start().
   140  *
   141  * @param client	Client to send to.
   142  * @param delay		Delay in seconds to send the TE.
   143  * @noreturn
   144  * @error		Invalid client index or client not in game.
   145  */
   146 stock TE_SendToClient(client, Float:delay=0.0)
   147 {
   148 	new players[1];
   149 
   150 	players[0] = client;
   151 
   152 	return TE_Send(players, 1, delay);
   153 }