Problems with :GetActivity()

I’m making a holster script and every thing works fine except I don’t know how to find out when the draw/holster animation is finished.

here’s my script:
[lua]
function HolsterThink()
for k,ply in pairs(player.GetAll()) do
if ply:GetActiveWeapon():GetActivity() != 170 and ply.holstered == true and ply.isholstering == true then – when the holster animation is finished
ply:DrawViewModel(false)
ply.isholstering = false
end
if ply:GetActiveWeapon():GetActivity() != 169 and ply.holstered == false and ply.isholstering == true then – when the draw animation is finished
ply.isholstering = false
ply:GetActiveWeapon():SetNextPrimaryFire(CurTime())
end
end
end
hook.Add(“Think”, “HolsterThink”, HolsterThink)

function Holster(ply)
if ply.holstered == false and ply.isholstering == false then
ply:GetActiveWeapon():SendWeaponAnim( ACT_VM_HOLSTER )
ply.holstered = true
ply:GetActiveWeapon():SetNextPrimaryFire(CurTime() + 9999999999999999) – no shooting!
ply.isholstering = true
elseif ply.isholstering == false then
ply:DrawViewModel(true)
ply:GetActiveWeapon():SendWeaponAnim(ACT_VM_DRAW)
ply.holstered = false
ply.isholstering = true
end
end
concommand.Add(“holster”, Holster)

function HolsterPlySpawn(ply)
ply.holstered = false
ply.isholstering = false
end
hook.Add(“PlayerSpawn”, “HolsterPlySpawn”, HolsterPlySpawn)
[/lua]

the problem is ply:GetActiveWeapon:GetActivity() doesn’t output anything, even when I use MsgN

[editline]01:56PM[/editline]

As a matter of fact, ply:GetActivity() never outputs anything either

You could try this:
**[Entity.SequenceDuration

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.SequenceDuration)**

It worked! Thanks a bunch :slight_smile:

I uploaded the finished version to garrysmod.org
http://www.garrysmod.org/downloads/?a=view&id=110281