Jump to content

[HELP] animation on fire


xuaNN

Recommended Posts

Firstly, sorry for my bad english. I don't know it very well.

Hello all, i wanna add a animation on fire with rifle.

When the gun is fired, the animation will start. How can i do this?

I wrote a few lines of code, but it didn't work.

local ped = getLocalPlayer()
local weaponid = getPedWeapon(ped)

addEventHandler( "onWeaponFire", root,
function reload ()
         if weaponid == 33 then 
		 setPedAnimation(ped,"buddy","buddy_crouchreload")
		 end 
end 

 

I understood the mistake I made. Topic deleted.

Clientside:

local ped = getLocalPlayer() -- Get Player
local weaponid = getPlayerWeapon(ped) -- Get Players weapon.

function reload ()
         if weaponid == 33 then -- if player weapon is rifle
		 setPedAnimation(ped,"buddy","buddy_crouchreload") -- Set ped animation 
		 end 
end 
addEventHandler("onClientPlayerWeaponFire",root,reload) -- if player fire with weapon get function reload

It can work.

Edited by xuaNN
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...