Raised This Month: $ Target: $400
 0% 

[CS:S] Team Based Grenade Trails (Not Working)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ehsank1768
Member
Join Date: Aug 2022
Old 08-09-2023 , 13:39   [CS:S] Team Based Grenade Trails (Not Working)
Reply With Quote #1

hi here is the code but i don't get why its not working



CODE:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1

new BeamSprite, g_beamsprite, g_halosprite;
new Handle:GTrailsEnabled;

new Float:FireColorCT[] = {0, 0, 255, 225}; // Blue color for CT team
new Float:FireColorT[] = {255, 0, 0, 225}; // Red color for T team

new Float:FireColor[4];

public Plugin:myinfo =
{
name = "Grenade Trails",
author = "Fredd",
description = "Adds a trail to grenades.",
version = "1.1",
url = "www.sourcemod.net"
}

public OnMapStart()
{
BeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
g_beamsprite = PrecacheModel("materials/sprites/lgtning.vmt");
g_halosprite = PrecacheModel("materials/sprites/halo01.vmt");
}

public OnPluginStart()
{
CreateConVar("gt_version", "1.1", "Grenade Trails Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FC VAR_NOTIFY);
GTrailsEnabled = CreateConVar("gt_enables", "1", "Enables/Disables Grenade Trails");

HookEvent("hegrenade_detonate", OnHeDetonate);
}

public OnHeDetonate(Handle:event, const String:name[], bool:dontBroadcast)
{
new Floatrigin[3];
origin[0] = GetEventFloat(event, "x");
origin[1] = GetEventFloat(event, "y");
origin[2] = GetEventFloat(event, "z");

int thrower = GetEventInt(event, "userid");
int client = GetClientOfUserId(thrower);
int team = GetClientTeam(client);
new Float:FireColor[4];
if (team == 3)
{
FireColor = FireColorCT;
}
else if (team == 2)
{
FireColor = FireColorT;
}

TE_SetupBeamRingPoint(origin, 10.0, 400.0, g_beamsprite, g_halosprite, 1, 1, 0.2, 100.0, 1.0, FireColor, 0, 0);
TE_SendToAll();
}

public OnEntityCreated(Entity, const String:Classname[])
{
if (GetConVarInt(GTrailsEnabled) != 1)
return;

if (strcmp(Classname, "hegrenade_projectile") == 0)
{
int thrower = GetEntPropEnt(Entity, Prop_Send, "m_hThrower");
int client = GetClientOfUserId(thrower);
if (client == -1)
return;

int team = GetClientTeam(client);
new Float:FireColor[4];
if (team == 3)
{
FireColor = FireColorCT;
}
else if (team == 2)
{
FireColor = FireColorT;
}

new Floatrigin[3];
GetEntPropVector(Entity, Prop_Send, "m_vecOrigin", origin);

TE_SetupBeamRingPoint(origin, 10.0, 400.0, BeamSprite, BeamSprite, 1, 1, 0.2, 100.0, 1.0, FireColor, 0, 0);
TE_SendToAll();
}
}
ehsank1768 is offline
ehsank1768
Member
Join Date: Aug 2022
Old 08-09-2023 , 13:40   Re: [CS:S] Team Based Grenade Trails (Not Working)
Reply With Quote #2

file sp
Attached Files
File Type: sp Get Plugin or Get Source (nt.sp - 61 views - 2.5 KB)
ehsank1768 is offline
Reply



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 11:59.


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