Hi guys.
Code:
public Action:TestCommand_Used(client, args)
{
decl targetid;
targetid = GetClientAimTarget(client, true);
if(targetid > 0)
{
if(IsClientConnected(targetid))
{
if(IsClientInGame(targetid) && !IsFakeClient(targetid))
{
if(GetUserAdmin(targetid) == INVALID_ADMIN_ID)
{
decl String:username[MAX_NAME_LENGTH];
decl String:targetname[MAX_NAME_LENGTH];
GetClientName(client, username, MAX_NAME_LENGTH);
GetClientName(targetid, targetname, MAX_NAME_LENGTH);
TE_SetupBeamLaser(client, targetid, g_sprite, 0, 0, 0, 1.0, 2.0, 2.0, 3, 0.0, beamcolor, 1);
for(new i=1;i<=MaxClients;i++)
{
if(IsClientConnected(i))
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
if(GetUserAdmin(i) != INVALID_ADMIN_ID)
{
PrintToChat(i, "%s used testcommand on %s", username, targetname);
TE_SendToClient(i);
}
}
}
}
}
}
}
}
return Plugin_Handled;
}
Somehow this beam does not appear between the two entities. However, when I turn around a bit, I see a red flicker (color is 255,0,0,100), so the material (materials/sprites/laserbeam.vmt) is definately being precached correctly when the plugin starts. I have no idea why the beam is not between the two entities but somewhere else and only visible in a glitchy and dislocated/disoriented way in front of my eyes if I turn around and stand still in a certain position.
Clientid and targetid are definately correct because the nicknames in the debugline are as well.
I'm using L4D2 btw.
Any ideas?
I'm clueless on that one.
Also, I wanted to play a laserbeam-sound but unfortunately I can't find any in the L4D2-soundlib, although I'm sure that I just haven't looked properly yet. Maybe one of you can give me the path of a useable soundfile, I'm pretty sure I heard one in a l4d2-plugin before.
Thanks in advance!
House