Garry's Mod Wiki

Revision Difference

WEAPON:TranslateActivity#512198

<function name="TranslateActivity" parent="WEAPON" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Translate a player's Activity into a weapon's activity, depending on how you want the player to be holding the weapon.⤶ ⤶ For example, ACT_MP_RUN becomes ACT_HL2MP_RUN_PISTOL.⤶ </description>⤶ <realm>Shared</realm>⤶ <predicted>No</predicted>⤶ <args>⤶ <arg name="act" type="number">The activity to translate</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="number">The translated activity</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Default action</description>⤶ <code>⤶ function SWEP:TranslateActivity( act )⤶ ⤶ if ( self.Owner:IsNPC() ) then⤶ if ( self.ActivityTranslateAI[ act ] ) then⤶ return self.ActivityTranslateAI[ act ]⤶ end⤶ return -1⤶ end⤶ ⤶ if ( self.ActivityTranslate[ act ] != nil ) then⤶ return self.ActivityTranslate[ act ]⤶ end⤶ ⤶ return -1⤶ ⤶ end⤶ </code>⤶ ⤶ </example>