Jump to content

Set ped animation


Lorder

Recommended Posts

I am having trouble with the code, I want to give all of them a separate skin, and they all make separate animations, and when I give the command to animate one, they all do the same animation @Fist

peds = {
  {28,29,30},
}

pedAnim = {
  {"crc","crack","crckidle2"},
}

function pedArmy()
  for _,v in ipairs(peds) do
    local rot,x,y,z = unpack(v);
  	createPed(rot, -1302, 2508, 87)
	createPed(rot, -1305, 2515, 87)
	createPed(rot, -1307, 2528, 87)
	createPed(rot, -1320, 2512, 92)
	createPed(rot, -1311, 2522, 89)
  end
end
addCommandHandler("spawnpeds",pedArmy)

function doAnim(source,cmd,anim)
  if (anim) then
  	  for _,v in ipairs(pedAnim) do
      	local animName,animBlock,actualAnimName = unpack(v);
      	if (tostring(anim) == animName) then
            for _,p in ipairs(getElementsByType("ped")) do
        		  setPedAnimation(p,animBlock,actualAnimName)
          	end
        end
      end
  end
end
addCommandHandler("action",doAnim)

 

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...