Raised This Month: $13 Target: $400
 3% 

Tail with a beam


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Master Cake
Junior Member
Join Date: May 2020
Location: Planet Earth
Old 05-27-2020 , 19:09   Tail with a beam
Reply With Quote #1

Hello again! I have a question.

I want to create tail for players with a beam sprite for TF2.

Here is code:
Code:
public OnMapStart()
{
	g_sprite = PrecacheModel("materials/sprites/laser.vmt");
}

public Action:OnPlayerRunCmd(myClient, &myButtons, &myImpulse, Float:fVel[3], Float:fAngles[3], &myWeapon)
{
	if(IsPlayerAlive(myClient) && IsValidClient(myClient) && JB_ENABLED[myClient] && ((myButtons & IN_FORWARD) || (myButtons & IN_BACK) || (myButtons & IN_MOVERIGHT) || (myButtons & IN_MOVELEFT) || (myButtons & IN_DUCK) || (myButtons & IN_JUMP)))
	{
    	color[0] = 255;
    	color[1] = 0;
    	color[2] = 239;
    	color[3] = 255;

    	GetClientEyePosition(myClient, FL_PosEnd[myClient]);
    	CreateTimer(0.1, DrawBeam, myClient);
	}
}

public Action:DrawBeam(Handle timer, int myClient)
{
    GetClientEyePosition(myClient, FL_Pos[myClient]);
    TE_SetupBeamPoints(FL_Pos[myClient], FL_PosEnd[myClient], g_sprite, 0, 0, 0, 5.0, 5.0, 5.0, 10, 0.0, color, 0);
    TE_SendToAll();
    return Plugin_Continue;
}
I use timer for this effect but that doesn't work properly. It has to be solid but it's not. It's just dotted when I move



How can I fix it?

P.s. I know about TE_SetupBeamFollow function but I don't want to use it

Last edited by Master Cake; 05-27-2020 at 19:15.
Master Cake is offline
Master Cake
Junior Member
Join Date: May 2020
Location: Planet Earth
Old 05-30-2020 , 07:42   Re: Tail with a beam
Reply With Quote #2

Solved. Just don't use timer and check for client's velocity. Or you can create beam on each server frame.
Master Cake is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-30-2020 , 08:18   Re: Tail with a beam
Reply With Quote #3

Quote:
Originally Posted by Master Cake View Post
Solved. Just don't use timer and check for client's velocity. Or you can create beam on each server frame.
Not sure if you noticed it, but this is the AMX Mod X section.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 05:43.


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