Raised This Month: $32 Target: $400
 8% 

[EXTENSION] Tempents Extension with example


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
API
Veteran Member
Join Date: May 2006
Old 04-16-2007 , 22:34   [EXTENSION] Tempents Extension with example
Reply With Quote #1

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.
Attached Files
File Type: zip tempents_fixed.zip (111.0 KB, 716 views)
File Type: zip tempents_src_june132007.zip (16.7 KB, 454 views)

Last edited by API; 06-13-2007 at 22:03. Reason: fixed crash problems as well as added TEExplosion and removed traceline
API is offline
Send a message via AIM to API
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 04-17-2007 , 00:18   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #2

Dude...you're fast and awesome much much <3 this will provide so much nifty stuff!
FlyingMongoose is offline
otstrel
SourceMod Donor
Join Date: Aug 2004
Old 04-17-2007 , 03:32   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #3

Wow, that's nice!
__________________
don't shoot the lamer, he's doing the best he can
otstrel is offline
API
Veteran Member
Join Date: May 2006
Old 04-17-2007 , 09:42   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #4

Oh... I forgot... If you want to define a variable for color, you would do the following:
Code:
new color[4];
color[0]=255; // all red
color[1]=128; // half green
color[2]=0; // no blue
color[3]=128; // half visible
Then you just pass color.
Thanks
API is offline
Send a message via AIM to API
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 04-17-2007 , 13:33   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #5

okay so it's a color array, 0,1,2 are RGB, and 3 = Alpha
Awesome.
FlyingMongoose is offline
DiscoBBQ
Veteran Member
Join Date: Jan 2005
Location: Clemson, South Carolina
Old 04-23-2007 , 20:46   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #6

pwn pwn
__________________
"Every man is guilty of all the good he did not do"
DiscoBBQ is offline
API
Veteran Member
Join Date: May 2006
Old 04-24-2007 , 21:14   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #7

I added the sourcecode.
API is offline
Send a message via AIM to API
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 04-25-2007 , 16:40   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #8

I've kicked this into gear in one of my plugins: expect niftyness on SpawnProtect soon ;).
FlyingMongoose is offline
API
Veteran Member
Join Date: May 2006
Old 04-29-2007 , 11:22   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #9

Update
Added TETraceline and TEEmitSound.
API is offline
Send a message via AIM to API
API
Veteran Member
Join Date: May 2006
Old 04-29-2007 , 20:43   Re: [EXTENSION] Tempents Extension with example
Reply With Quote #10

Update
Fixed EmitSound problem playing throughout the whole map.
API is offline
Send a message via AIM to API
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode