All pastes #360696 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-17 17:44 UTC
rendered paste body
function GM:SetPlayerAnimation( pl, anim )
    local wep = tostring(pl:GetActiveWeapon())
    local Speed = pl:GetVelocity():Length()
    local OnGround = pl:OnGround()
	local Wep_name = pl:GetActiveWeapon():GetClass()
	
    // ----------------------------------------------------------
    // IDLE
    // ----------------------------------------------------------
    local anim = "idle_angry"
	//----------------------------------------------------------
	// SMG/Idle
	//----------------------------------------------------------
	if (OnGround && Wep_name == "weapon_smg1") then
		anim = "Idle_Angry_SMG1"
	end
   
    // ----------------------------------------------------------
    // CROUCHING & NOT MOVING
    // ----------------------------------------------------------
    if ( OnGround && pl:Crouching() ) then
        anim = "Sit_Ground"
    end
    // ----------------------------------------------------------
    // CROUCHING & MOVING
    // ----------------------------------------------------------
    if ( Speed > 0 && OnGround && pl:Crouching() ) then
        anim = "Crouch_walk_all"
    end
   
    // ----------------------------------------------------------
    // RUNNING/WALKING
    // ----------------------------------------------------------
    if (Speed > 0 && OnGround && !pl:Crouching() ) then
        if (Speed > 150) then
            anim = "run_all"
        else
            anim = "walk_all"
        end
    end
 
    // ----------------------------------------------------------
    // JUMPING
    // ----------------------------------------------------------
    if ( !OnGround ) then
        anim = "jump_holding_glide"
    end
	
	// ----------------------------------------------------------
	// Firing SMG
	//-----------------------------------------------------------
/*	if ( OnGround && pl:GetActiveWeapon():GetClass() == "weapon_smg1" && pl:KeyPressed( IN_ATTACK ) && Weapon:Clip1() != 0 ) then
	anim = "shoot_smg1"
	end
   */
    // ----------------------------------------------------------
    // TRANSLATION AND UPDATING ANIM
    // ----------------------------------------------------------
    anim = pl:LookupSequence(anim)
    if (pl:GetSequence() == anim) then return end
    pl:SetPlaybackRate( 1.0 )   
    pl:ResetSequence( anim )
    pl:SetCycle( 0 )
   
end