So I am working on a bullet tracer plugin but I have reached the limitation of my sm knowledge and need some help filling in the blanks. So far I can detect where a bullet hits and record that location along with the client who fired it. I also have some code that should determine where the location of the clients gun is but I do not know how to get the output from it. I set up an example code that generates sparks so that I knew that temp entities worked. I also know that the model that needs to be used for the effect is "effects/gunshiptracer.vmt"
Below is my code so far, can anyone help me trigger the BeamClient method correctly?
Code:
#include <sourcemod>
#include <sdktools_functions>
#include <sdktools>
#define VERSION "0.1"
new String:Weapon[30];
new Handle:hGetWeapon_ShootPosition;
new Handle:hGameConf;
public Plugin:myinfo =
{
name = "Tracers",
author = "ZERO <ibis>",
description = "Makes tracers follow bullets",
version = VERSION,
url = "www.ibisgaming.com"
};
// create convars and hook event
public OnPluginStart()
{
hGameConf = LoadGameConfigFile("plugin.sdkexamples");
StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "Weapon_ShootPosition");
PrepSDKCall_SetReturnInfo(SDKType_Vector, SDKPass_ByValue);
hGetWeapon_ShootPosition= EndPrepSDKCall();
HookEvent("bullet_impact",Fire);
}
GetWeapon_ShootPosition(client, Float:pos[3])
{
SDKCall(hGetWeapon_ShootPosition, client, pos);
}
//hook the player_hurt event and look for nade damge
public Fire(Handle:event,const String:name[],bool:dontBroadcast)
{
GetEventString(event,"weapon",Weapon,30);
// if plugin is on and nade was found then ignite client
if(StrEqual(Weapon,"hegrenade")!= true)
{
new clientid = GetEventInt(event,"userid");
new client = GetClientOfUserId(clientid);
new x2 = GetEventInt(event,"x");
new y2 = GetEventInt(event,"y");
new z2 = GetEventInt(event,"z");
new Float:end[3];
end[0] = x2;
end[1] = y2;
end[2] = z2;
SparkClient(client,end,end);
}
}
SparkClient(client, const Float:pos[3], const Float:dir[3])
{
TE_SetupMetalSparks(pos, dir);
TE_SendToAll;
}
BeamClient(const Float:start[3], const Float:end[3], ModelIndex, HaloIndex, StartFrame, FrameRate, Float:Life, Float:Width, Float:EndWidth, FadeLength, Float:Amplitude, const Color[4], Speed)
{
TE_SetupBeamPoints(start, end, ModelIndex, HaloIndex, StartFrame, FrameRate, Life, Width, EndWidth, FadeLength, Amplitude, Color, Speed);
TE_SendToAll;
}
Thanks again, I am also attaching the code for those who want to just dl it. Hopefully with your help we can release a public bullet tracer plugin!
(I will credit anyone who helps when I release it)