AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Tail with a beam (https://forums.alliedmods.net/showthread.php?t=324805)

Master Cake 05-27-2020 19:09

Tail with a beam
 
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

https://imageup.ru/img280/3612050/1.jpg

How can I fix it?

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

Master Cake 05-30-2020 07:42

Re: Tail with a beam
 
Solved. Just don't use timer and check for client's velocity. Or you can create beam on each server frame.

OciXCrom 05-30-2020 08:18

Re: Tail with a beam
 
Quote:

Originally Posted by Master Cake (Post 2703133)
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.


All times are GMT -4. The time now is 17:09.

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