Hey guys,
For those of you that do not know what tempents is, it is the interface in-which allows you to make special effects, like a beam for hookmod, or things like rings around players.
Credit
Thanks to everyone in IRC, especially BAILOPAN and cybermind, FlyingMongoose inspired me to do it.
Installation
1. Extract 'tempents.ext.dll' and 'tempents.ext.so' to the 'addons/sourcemod/extensions' folder.
2. Extract 'tempents.inc' to the 'addons/sourcemod/scripting/include' folder.
Functions
There are
8 different functions that you can use in your plugins.
They are documented and called as follows.
Code:
/**
* Create a Armor Ricochet effect
*
* @param index Index of player to display to
* @param delay Delay before effect is emitted
* @param position Position of effect
* @param direction Direction of effect
* @return -1 means you passed the incorrect number of parameters
*/
native TEArmorRicochet(index, Float:delay, Float:position[3], Float:direction[3]);
/**
* Create a beam between 2 points
*
* @param modelindex Index of the precached texture
* @param index Index of player to display to
* @param delay Delay before the effect is displayed
* @param startpos The position the beam starts at
* @param endpos The position the beam ends at
* @param life How long the beam lives
* @param width How wide the beam is
* @param endwidth How wide the end of the beam is
* @param color[4] The color [0]=r, [1]=g, [2]=b, [3]=alpha
* @param startframe The frame for the model to start on, usually just 0
* @param framerate The frame rate
* @param fadelength The fade length of the effect
* @param amplitude The amplitude of the effect
* @param speed The speed of the effect
* @return -1 means you passed the incorrect number of parameters
*/
native TEBeamPoints(modelindex, index, Float:delay, Float:startpos[3], Float:endpos[3], Float:life, Float:width, Float:endwidth, color[4], startframe, framerate, fadelength, Float:amplitude, speed);
/**
* Create an effect to follow an entity
*
* @param modelindex Index of the precached texture
* @param index Index of player to display to
* @param entindex Index of entity to follow
* @param delay Delay before the effect is displayed
* @param life How long the beam lives
* @param width How wide the beam is
* @param endwidth How wide the end of the beam is
* @param color[4] The color [0]=r, [1]=g, [2]=b, [3]=alpha
* @param fadelength The fade length of the effect
* @return -1 means you passed the incorrect number of parameters
*/
native TEBeamFollow(modelindex, index, entindex, Float:delay, Float:life, Float:width, Float:endwidth, color[4], fadelength);
/**
* Create a ring around a point
*
* @param modelindex Index of the precached texture
* @param index Index of player to display to
* @param delay Delay before the effect is displayed
* @param centerpos The position of the ring's center
* @param startradius The radius at the beginning of the effect
* @param endradius The radius at the ending of the effect
* @param life How long the beam lives
* @param width How wide the beam is
* @param color[4] The color [0]=r, [1]=g, [2]=b, [3]=alpha
* @param startframe The frame for the model to start on, usually just 0
* @param framerate The frame rate
* @param amplitude The amplitude of the effect
* @param spread The spread of the effect
* @param speed The speed of the effect
* @return -1 means you passed the incorrect number of parameters
*/
native TEBeamRingPoint(modelindex, index, Float:delay, Float:centerpos[3], Float:startradius, Float:endradius, Float:life, Float:width, color[4], startframe, framerate, Float:amplitude, spread, speed);
/**
* Create a Smoke effect
*
* @param modelindex Index of the precached texture
* @param index Index of player to display to
* @param delay Delay before effect is emitted
* @param position Position of effect
* @param scale Scale of texture
* @param framerate The frame rate
* @return -1 means you passed the incorrect number of parameters
*/
native TESmoke(modelindex, index, Float:delay, Float:position[3], Float:scale, framerate);
/**
* Create a Metal Spark effect
*
* @param index Index of player to display to
* @param delay Delay before effect is emitted
* @param position Position of effect
* @param direction Direction of effect
* @return -1 means you passed the incorrect number of parameters
*/
native TEMetalSparks(index, Float:delay, Float:position[3], Float:direction[3]);
/**
* Emit a sound to an entity from an entity
*
* @param emit_to Player to Emit the sound to
* @param source Entity to Emit the sound from
* @param sound Path to the sound file
* @param volume Volume of the sound
* @return -1 means wrong number of params
*/
native TEEmitSound(emit_to,source,const String:sound[],Float:volume);
native TEExplosion(modelindex,emit_to,Float:delay,Float:pos[3],Float:scale,framerate,radius,magnitude,Float:normal[3]);
Here is a small example on usage of the functions, note, the effect is only displayed to player with index 1, you need to call it multiple times for multiple players, the best way to do that is a loop.
Code:
#include <sourcemod>
#include <tempents>
public Plugin:myinfo =
{
name = "Tempents Test",
author = "PimpinJuice",
description = "Testing out the tempents extension",
version = "1.0.0.0",
url = "http://pimpinjuice.net/"
};
public OnPluginStart()
{
RegServerCmd("test_command", Command_Test)
}
public Action:Command_Test(args)
{
new Float:delay=0.0;
new Float:pos[3];
pos[0]=138.0;
pos[1]=-1548.0;
pos[2]=64.0;
new Float:dir[3];
dir[0]=0.0;
dir[1]=0.0;
dir[2]=0.0;
TEMetalSparks(1, delay, pos, dir);
}
Have fun.