Detect using anim
#1

Is there a way to detect if the player is using an anim? I want if the player clicks it stops the anim ONLY if they are using the anim. Any easy way then setting 1 and 0 because there are a bunch of animations. Like over 20 so any way to easily do this.
Reply
#2

https://sampwiki.blast.hk/wiki/GetPlayerAnimationIndex

pawn Код:
if(GetPlayerAnimationIndex(playerid) != 0) ClearAnimations(playerid);
Reply
#3

Still makes him clear animations when hes not using a anim.
Reply
#4

i have a work around.

pawn Код:
stock ApplyAnimationEx(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync)
{
    return ApplyAnimnation(playerid,animlib,animname,fDelta,loop,lockx,locky,freeze,time,forcesync),AnimApplied[playerid]=1;
}
Ctrl+H
change all ApplyAnimation to ApplyAnimationEx and done
check id AnimApplied[playerid] = 1 and ClearAnimations
Reply
#5

pawn Код:
-(1338) : error 017: undefined symbol "AnimApplied"
-(1338) : warning 215: expression has no effect
-(1338) : error 001: expected token: ";", but found "]"
-(1338) : error 029: invalid expression, assumed zero
-(1338) : fatal error 107: too many error messages on one line
pawn Код:
return ApplyAnimation(playerid,animlib,animname,fDelta,loop,lockx,locky,freeze,time,forcesync),AnimApplied[playerid]=1;
Reply
#6

Add new AnimApplied[MAX_PLAYERS]; to the top of your script.

To check and clear do:

pawn Код:
if (AnimApplied[playerid])
{
    // Do what ever you do to clear animations..
    AnimApplied[playerid] = 0;
}
Reply
#7

pawn Код:
C:\Users\Robert\Desktop\fs\stunique.pwn(11213) : warning 225: unreachable code
C:\Users\Robert\Desktop\fs\stunique.pwn(11299) : warning 219: local variable "Vehicles" shadows a variable at a preceding level
C:\Users\Robert\Desktop\fs\stunique.pwn(12227) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12471) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12477) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12483) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12489) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12495) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12501) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12507) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12513) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12519) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12525) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12531) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12537) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12543) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12549) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12555) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12561) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12567) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12573) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12579) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12585) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12591) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12597) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12603) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12609) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12627) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12639) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12645) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12651) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12657) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12663) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12669) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12675) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12681) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12687) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12693) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12699) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12705) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12711) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12717) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12723) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12729) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12735) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12741) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12747) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12752) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12758) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12764) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12770) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12776) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12782) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12788) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12794) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12800) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12806) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12812) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12818) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12824) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12830) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12836) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12843) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12849) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12855) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12861) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12867) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12873) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12879) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12885) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12891) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12897) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12902) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12907) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12912) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12917) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12922) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12927) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12932) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12937) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12942) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12948) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12954) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12959) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12965) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12971) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12977) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12983) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12989) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(12995) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13001) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13007) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13013) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13019) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13025) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13031) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13037) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13043) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13049) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13055) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13061) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13067) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13073) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13079) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13086) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13092) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13098) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13104) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13110) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13116) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13122) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13128) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13134) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13140) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13146) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13152) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13158) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13164) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13170) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13176) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13181) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13187) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13193) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13199) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13205) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13211) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13217) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13223) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13229) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13235) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13241) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13247) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13253) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13259) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13265) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13271) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13277) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13283) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13289) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13295) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13301) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13307) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13313) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13319) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13325) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13331) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13336) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13342) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13348) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13354) : warning 202: number of arguments does not match definition
C:\Users\Robert\Desktop\fs\stunique.pwn(13877) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


151 Warnings.
There really has to be another way...
Reply
#8

On top:
pawn Код:
new AnimApplied[MAX_PLAYERS];
At the end of your script:
pawn Код:
stock ApplyAnimationEx(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync)
{
    AnimApplied[playerid]=1
    return ApplyAnimnation(playerid,animlib,animname,fDelta,loop,lockx,locky,freeze,time,forcesync);
}
And use this to know
pawn Код:
if(AnimApplied[playerid] == 1)
Reply
#9

still getting a shit load of errors.
Reply
#10

You can also just check if the player presses the 'AIM'-key, which is called KEY_HANDBRAKE in the SA-MP defines. You might need to check if the player holds a weapon which you can aim, because you can't aim with a baseball bat or a parachute for example.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)