ApplyAnimation
#1

So: i would like to make a script for the cops who:

*cop uses the baton to another player*

*apply player anymation CRACK*

So whehn a cop uses the baton to another player the other player got a animation for 20 secs
Reply
#2

You'll need:

ApplyAnimation, //Function
OnPlayerTakeDamage, // Callback
SetTimerEx //Function
ClearAnimations //Function

Simply, inside of the callback, check if their weapon (the issuerid) is a police baton, and apply the animation (don't forget to apply it twice, unless you preload animations!) to the playerid (the player taking the damage) and set a timer to clear their animations using ClearAnimations(playerid);

Simple.
Reply
#3

sorry but im a crap at scripting can you post a example? +REP!
Reply
#4

Sure.

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID) {
   
        switch(weaponid) {
       
            case 3: //Police baton!
            {
                ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
                ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); //Apply it twice!
                TogglePlayerControllable(playerid, 0);
                SetTimerEx("ClearAnims", 20*1000, 0, "i", playerid);
            }
        }
   
    }
    return 1;
}

forward ClearAnims(playerid);
public ClearAnims(playerid) { return ClearAnimations(playerid), TogglePlayerControllable(playerid, 1); }
Something like that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)