Boa noite, eu fiz um sistema de taser, porém ele está com problemas, preciso de ajuda para aprimorar o código, e ajudar a fazer ele a funcionar a opção setanimation, porque ele até funciona, porém não está executando a função setpedanimation, o erro identificado no debug é o seguinte > server.lua:77: Bad Argument @ 'setPedAnimation' [Expected number at argument 4, got boolean (true)]
addEventHandler("onPlayerWeaponFire", root,
function (weapon, endX, endY, endZ, hitElement, startX, startY, startZ)
local weaponType = getPlayerWeapon (source)
if weaponType == 23 then
local x,y,z = getElementPosition(source)
if (isElement(hitElement) and getElementType(hitElement) == "player") then
local hx,hy,hz = getElementPosition(hitElement)
else
local hx,hy,hz = endX, endY, endZ
end
for key, value in ipairs(getElementsByType("player")) do
local px, py, pz = getElementPosition(value)
local distance = getDistanceBetweenPoints3D(x, y, z, px, py, pz)
if distance < 15 then
triggerClientEvent(value, "fire_effect", root, source, hitElement, weapon, endX, endY, endZ)
print("tiro")
end
end
end
end)
for key, value in ipairs(getElementsByType("player")) do
toggleControl ( value, "fire", true )
setElementData(value, "teaser:caido", false)
setPedAnimation(value)
end
addEvent("teaser_letal", true )
addEventHandler("teaser_letal", getRootElement(),
function ()
if not (getElementData(source, "teaser:caido")) then
setElementData(source, "teaser:caido", true)
setTimer(setElementData, 15000, 1, source, "teaser:caido", false)
setElementFrozen(source, true)
setTimer(setElementFrozen, 16000, 1, source, false)
setPedAnimation(source, "crack", "crckidle"..math.random(1,4), true, false, false, false )
setTimer(setPedAnimation, 15000, 1, source)
end
end)
imagem https://i.postimg.cc/vB5cygQH/image.png