UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Play anim on player

broken avatar :(
Created 10 years ago
by Backslash
0 Members and 1 Guest are viewing this topic.
860 views
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 1 October 2016
Last active: 10 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Backslash's Groups
Backslash's Contact & Social Links
Hey guys.
I'm currently trying to play an animation on the players weapon.
I want to play the fire animation per script.


Spoiler: click to open...
Code Snippet
Plaintext
#using scripts\shared\callbacks_shared;

#using_animtree( "test" );
#precache( "xanim", "a_view_test_fire");

function init()
{
    callback::on_spawned( &onPlayerSpawned );
}

function onPlayerSpawned()
{
    self endon("death");
    self endon("disconnect");

    self thread animTest();
}

function animTest()
{
    player = self;

    while (isDefined(player))
    {
        if(player AdsButtonPressed() && !player AttackButtonPressed())
        {
            //Test 4 - Crash on button press
            // player UseAnimTree( #animtree );
            // player AnimScripted( "test_anim", self.origin, self.angles, "a_view_test_fire" );
            // player waittill( "test_anim" );


            //Test 3 - No crash, no Anim.
            // currentweapon = player GetCurrentWeapon();
            // currentweapon UseAnimTree(#animtree);
            // currentweapon AnimScripted("test_anim", currentweapon.origin, currentweapon.angles, %a_view_test_fire);
            // currentweapon waittill( "test_anim" );


            //Test 2 - No crash, no Anim.
            // currentweapon = player GetCurrentWeapon();
            // currentweapon UseAnimTree(#animtree);
            // currentweapon SetAnim(%a_view_test_fire);


            //Test 1 - Crash on button press
            // player UseAnimTree(#animtree);
            // player SetAnim(%a_view_test_fire);
        }
       
        wait 0.1;
    }
}

I tried many different ways that many different people told me to test.
Nothing is working. Whats wrong with my code?
What do i have to do, to actually play the anim on the player?

 
Loading ...