PDA

View Full Version : [EXTENSION] Tempents Extension with example


API
04-16-2007, 22:34
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.
/**
* 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,Fl oat: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.
#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. :)

FlyingMongoose
04-17-2007, 00:18
Dude...you're fast and awesome :) much much <3 this will provide so much nifty stuff!

otstrel
04-17-2007, 03:32
Wow, that's nice!

API
04-17-2007, 09:42
Oh... I forgot... If you want to define a variable for color, you would do the following:
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 :)

FlyingMongoose
04-17-2007, 13:33
okay so it's a color array, 0,1,2 are RGB, and 3 = Alpha :)
Awesome.

DiscoBBQ
04-23-2007, 20:46
pwn pwn

API
04-24-2007, 21:14
I added the sourcecode.

FlyingMongoose
04-25-2007, 16:40
I've kicked this into gear in one of my plugins: expect niftyness on SpawnProtect soon ;).

API
04-29-2007, 11:22
Update
Added TETraceline and TEEmitSound.

API
04-29-2007, 20:43
Update
Fixed EmitSound problem playing throughout the whole map.

dutchmeat
05-16-2007, 05:56
I think everyone knows, but for the grasshoppers:

new color[4]; //4 cells for RGBB
color[0]=255; // Red (0 - 255)
color[1]=128; // Green (0 - 255)
color[2]=0; // Blue (0 - 255)
color[3]=128; // Brightness (0 - 255), 255 is fully visible, 128 is half visible


yep, add another useless post to my account

sslice
06-12-2007, 19:21
Got a crash, don't know if the update is related.

Falco
06-13-2007, 20:21
I understand there is an update for the windows dll. Will this be released soon? Currently running atac plugin that requires the update to work properly.

API
06-13-2007, 22:03
Update
See first post for info.

Falco
06-13-2007, 22:07
Thank-you :)

API
06-13-2007, 22:09
No problem, this should be a sturdy update, let me know if you have problems.

[Arnold]
06-15-2007, 04:26
Strange. I updated from SM 937 to 943 and both Tempent and Sigscan Extension refuse to load with it. Don't know whose "fault" that is, but maybe you want to investigate it. Switching back to SM 937 solves the problem instantly.

FlyingMongoose
06-15-2007, 10:27
They probably need recompiled against some source code changes, you're *nix aren't you?

[Arnold]
06-15-2007, 10:41
They probably need recompiled against some source code changes, you're *nix aren't you?
Yes, system runs on Debian Etch Linux.

FlyingMongoose
06-15-2007, 10:49
Seems *nix has given nothing but problems so far, everything's running fine on Windows.

I've seen a history of bad results w/ SrcDS on *nix, but to each his own 'eh?

Anyway. I'll kick pimpin in the shins to try to figure it out.

API
07-05-2007, 16:39
This extension is considered depreciated and is only here for reference.