Jump to content

[HELP] Stop SetPedAnimation


IceBrasill

Recommended Posts

function onPlayerBuildAWireFence(itemName) 
  setElementData(source, itemName, getElementData(source, itemName) -1) 
  setPedAnimation(source, "BOMBER", "BOM_Plant", -1, false, false, nil, false) 
  local source = source 
  setTimer(function() 
    local x, y, z = getElementPosition(source) 
    local xr, yr, zr = getElementRotation(source) 
    px, py, pz = getElementPosition(source) 
    prot = getPedRotation(source) 
    local offsetRot = math.rad(prot + 90) 
    local vx = px + 1 * math.cos(offsetRot) 
    local vy = py + 1 * math.sin(offsetRot) 
    local vz = pz + 2 
    local vrot = prot + 90 
    tent = createObject(983, vx, vy, pz, xr, yr, vrot) 
    setObjectScale(tent, 1) 
    tentCol = createColSphere(x, y, z, 2) 
    attachElements(tentCol, tent, 0, 0, 0) 
    setElementData(tentCol, "parent", tent) 
    setElementData(tent, "parent", tentCol) 
    setElementData(tentCol, "wirefence", true) 
    triggerClientEvent(source, "refreshInventoryManual", source) 
  end, 1500, 1) 
end 

Video, dont stop animation: https://www.youtube.com/watch?v=Beap01g ... e=youtu.be

Link to comment
function onPlayerBuildAWireFence(itemName) 
  setElementData(source, itemName, getElementData(source, itemName) -1) 
  setPedAnimation(source, "BOMBER", "BOM_Plant", -1, false, false, nil, false) 
  setPedAnimation(source, false) 
  local source = source 
  setTimer(function() 
    local x, y, z = getElementPosition(source) 
    local xr, yr, zr = getElementRotation(source) 
    px, py, pz = getElementPosition(source) 
    prot = getPedRotation(source) 
    local offsetRot = math.rad(prot + 90) 
    local vx = px + 1 * math.cos(offsetRot) 
    local vy = py + 1 * math.sin(offsetRot) 
    local vz = pz + 2 
    local vrot = prot + 90 
    tent = createObject(983, vx, vy, pz, xr, yr, vrot) 
    setObjectScale(tent, 1) 
    tentCol = createColSphere(x, y, z, 2) 
    attachElements(tentCol, tent, 0, 0, 0) 
    setElementData(tentCol, "parent", tent) 
    setElementData(tent, "parent", tentCol) 
    setElementData(tentCol, "wirefence", true) 
    triggerClientEvent(source, "refreshInventoryManual", source) 
  end, 1500, 1) 
end 

Like this ?

Link to comment

Try this

function onPlayerBuildAWireFence(itemName) 
  setElementData(source, itemName, getElementData(source, itemName) -1) 
  setPedAnimation(source, "BOMBER", "BOM_Plant", -1, false, false, nil, false) 
   
  local source = source 
  setTimer(function() 
    local x, y, z = getElementPosition(source) 
    local xr, yr, zr = getElementRotation(source) 
    px, py, pz = getElementPosition(source) 
    prot = getPedRotation(source) 
    local offsetRot = math.rad(prot + 90) 
    local vx = px + 1 * math.cos(offsetRot) 
    local vy = py + 1 * math.sin(offsetRot) 
    local vz = pz + 2 
    local vrot = prot + 90 
    tent = createObject(983, vx, vy, pz, xr, yr, vrot) 
    setObjectScale(tent, 1) 
    tentCol = createColSphere(x, y, z, 2) 
    attachElements(tentCol, tent, 0, 0, 0) 
    setElementData(tentCol, "parent", tent) 
    setElementData(tent, "parent", tentCol) 
    setElementData(tentCol, "wirefence", true) 
    triggerClientEvent(source, "refreshInventoryManual", source) 
    setPedAnimation(source) 
  end, 1500, 1) 
end 

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