PDA

View Full Version : Temp Ent Troubles


Peoples Army
08-11-2007, 01:15
i cant seem to get any effects out of this in game



/*
Special Effects

This Will Give Grenade Explosions And Bullet Impacts Cool Fx

Avalailable Effects:

1. Sparks
2. Metal Sparks
3. Energy Splash

*/
#include <sourcemod>
#include <sdktools>
#define VERSION "0.1"
new Handle:gSwitch;
new Handle:HeNade;
new Handle:Smoke;
new Handle:Flash;
new Handle:Slug;
new Float:Origin[3];
public Plugin:myinfo =
{
name = "Special Effects",
author = "Peoples Army",
description = "Gives Special Effects ",
version = VERSION,
url = "www.sourcemod.net (http://www.sourcemod.net)"
};
// set cvars and hook nade detonation events
public OnPluginStart()
{
gSwitch = CreateConVar("nade_fx_on","1","1 tuns the plugin on 0 is off",FCVAR_NOTIFY);
HeNade = CreateConVar("he_nade_fx","1","Sets The Mode Of The HE Fx",FCVAR_NOTIFY);
Smoke = CreateConVar("sg_nade_fx","1","sets The Mode Of The Smoke Nade",FCVAR_NOTIFY);
Flash = CreateConVar("fb_nade_fx","1","sets the mode of the flash bang",FCVAR_NOTIFY);
Slug = CreateConVar("slug_fx","1","sets the mode of the slug fx",FCVAR_NOTIFY);

HookEvent("hegrenade_detonate",HeExplode);
HookEvent("flashbang_detonate",FbExplode);
HookEvent("smokegrenade_detonate",SgExplode);
HookEvent("bullet_impact",SlugImpact);
}
// catch the x,y,and z of the he nade and do effects based on convar
public HeExplode(Handle:event,const String:name[],bool:dontBroadcast)
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(HeNade)== 1)
{
TE_SetupSparks(Origin,Origin,255,2);
}else if( GetConVarInt(HeNade)==2)
{
TE_SetupMetalSparks(Origin,Origin);
}else if (GetConVarInt(HeNade)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
}
}
// catch x,y,z of the flashbang nade and do effects based on convar
public FbExplode(Handle:event,const String:name[],bool:dontBroadcast)
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(Flash)== 1)
{
TE_SetupSparks(Origin,Origin,255,2);
}else if( GetConVarInt(Flash)==2)
{
TE_SetupMetalSparks(Origin,Origin);
}else if (GetConVarInt(Flash)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
}
}
// catch x,y,z of the smoke nade and do effects based on cvar
public SgExplode(Handle:event,const String:name[],bool:dontBroadcast)
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(Smoke)== 1)
{
TE_SetupSparks(Origin,Origin,255,2);
}else if( GetConVarInt(Smoke)==2)
{
TE_SetupMetalSparks(Origin,Origin);
}else if (GetConVarInt(Smoke)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
}
}
// catch x,y,z of the bullet impact and do effects based on cvar
public SlugImpact(Handle:event,const String:name[],bool:dontBroadcast)
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(Slug)== 1)
{
TE_SetupSparks(Origin,Origin,255,2);
}else if( GetConVarInt(Slug)==2)
{
TE_SetupMetalSparks(Origin,Origin);
}else if (GetConVarInt(Slug)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
}
}



any ideas?:|

API
08-11-2007, 01:54
You call setup but you never call do it

Peoples Army
08-11-2007, 01:55
:| this is my first experiment with temps ents in sourcemod . how do u send them ?

bl4nk
08-11-2007, 01:56
http://wiki.alliedmods.net/SDKTools_%28SourceMod_Development%29#TempEnt_ Functions

Peoples Army
08-11-2007, 02:34
works perfectly now :up: thanks guys !

Peoples Army
08-11-2007, 04:20
im getting this new problem ,


home/groups/sourcemod/upload_tmp/phpJ49b5u.sp(73) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpJ49b5u.sp(99) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpJ49b5u.sp(125) : warning 213: tag mismatch
/home/groups/sourcemod/upload_tmp/phpJ49b5u.sp(151) : warning 213: tag mismatch





/*
Special Effects

This Will Give Grenade Explosions And Bullet Impacts Cool Fx

Avalailable Effects:

1. Sparks
2. Glow Effect
3. Energy Splash

*/
#include <sourcemod>
#include <sdktools>
#define VERSION "0.2"
new Handle:gSwitch;
new Handle:HeNade;
new Handle:Smoke;
new Handle:Flash;
new Handle:Slug;
new Float:Origin[3];
new Glow;
public Plugin:myinfo =
{
name = "Special Effects",
author = "Peoples Army",
description = "Gives Special Effects ",
version = VERSION,
url = "www.sourcemod.net (http://www.sourcemod.net)"
};
// set cvars and hook nade detonation events
public OnMapStart()
{
Glow = PrecacheModel("sprites/blueglow1.vmt");
}
public OnPluginStart()
{
gSwitch = CreateConVar("nade_fx_on","1","1 tuns the plugin on 0 is off",FCVAR_NOTIFY);
HeNade = CreateConVar("he_nade_fx","1","Sets The Mode Of The HE Fx",FCVAR_NOTIFY);
Smoke = CreateConVar("sg_nade_fx","1","sets The Mode Of The Smoke Nade",FCVAR_NOTIFY);
Flash = CreateConVar("fb_nade_fx","1","sets the mode of the flash bang",FCVAR_NOTIFY);
Slug = CreateConVar("slug_fx","1","sets the mode of the slug fx",FCVAR_NOTIFY);

HookEvent("hegrenade_detonate",HeExplode);
HookEvent("flashbang_detonate",FbExplode);
HookEvent("smokegrenade_detonate",SgExplode);
HookEvent("bullet_impact",SlugImpact);
}
// catch the x,y,and z of the he nade and do effects based on convar
public HeExplode(Handle:event,const String:name[],bool:dontBroadcast)
{
if(GetConVarInt(gSwitch))
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(HeNade)== 1)
{
TE_SetupSparks(Origin,Origin,255,1);
TE_SendToAll();
}else if( GetConVarInt(HeNade)== 2)
{
TE_SetupGlowSprite(Origin,Glow,3.0,5,255);
TE_SendToAll();
}else if (GetConVarInt(HeNade)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
TE_SendToAll();
}
}
}
// catch x,y,z of the flashbang nade and do effects based on convar
public FbExplode(Handle:event,const String:name[],bool:dontBroadcast)
{
if(GetConVarInt(gSwitch))
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(Flash)== 1)
{
TE_SetupSparks(Origin,Origin,255,1);
TE_SendToAll();
}else if( GetConVarInt(Flash)== 2)
{
TE_SetupGlowSprite(Origin,Glow,3.0,5,255);
TE_SendToAll();
}else if (GetConVarInt(Flash)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
TE_SendToAll();
}
}
}
// catch x,y,z of the smoke nade and do effects based on cvar
public SgExplode(Handle:event,const String:name[],bool:dontBroadcast)
{
if(GetConVarInt(gSwitch))
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(Smoke)== 1)
{
TE_SetupSparks(Origin,Origin,255,1);
TE_SendToAll();
}else if( GetConVarInt(Smoke)== 2)
{
TE_SetupGlowSprite(Origin,Glow,3.0,5,255);
TE_SendToAll();
}else if (GetConVarInt(Smoke)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
TE_SendToAll();
}
}
}
// catch x,y,z of the bullet impact and do effects based on cvar
public SlugImpact(Handle:event,const String:name[],bool:dontBroadcast)
{
if(GetConVarInt(gSwitch))
{
Origin[0] = GetEventFloat(event,"x");
Origin[1] = GetEventFloat(event,"y");
Origin[2] = GetEventFloat(event,"z");

if(GetConVarInt(Slug)== 1)
{
TE_SetupSparks(Origin,Origin,255,1);
TE_SendToAll();
}else if( GetConVarInt(Slug)== 2)
{
TE_SetupGlowSprite(Origin,Glow,3.0,5,255);
TE_SendToAll();
}else if (GetConVarInt(Slug)== 3)
{
TE_SetupEnergySplash(Origin,Origin,false);
TE_SendToAll();
}
}
}



any ideas why ?:|

dalto
08-11-2007, 09:17
You are getting those warnings because the third parameter is supposed to be a float. Just change 5 to 5.0

Peoples Army
08-11-2007, 15:46
oh whoops , i thought it was becuase of my precache model . :mrgreen: