IceBrasill Posted September 26, 2014 Share Posted September 26, 2014 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
darhal Posted September 26, 2014 Share Posted September 26, 2014 The animation dont stop because you dont stop it. Use this to stop it setPedAnimation(source, false) Link to comment
IceBrasill Posted September 26, 2014 Author Share Posted September 26, 2014 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
UnG//Macaus Posted September 26, 2014 Share Posted September 26, 2014 Why do not you test it? and if any mistake, let us know here and we will help you solve them Link to comment
lcd1232 Posted September 26, 2014 Share Posted September 26, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now