thebossofc Posted April 26 Share Posted April 26 (edited) 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 Edited April 27 by Lord Henry Script convertido de texto para Lua. Link to comment
Human Resources Trainee Vinyard Posted April 27 Human Resources Trainee Share Posted April 27 Hi, Your topic has been moved to the Portuguese scripting section so that you can get better assistance in your native language. Make sure to always use English when posting out of this language-specific section. Link to comment
Other Languages Moderators Lord Henry Posted April 27 Other Languages Moderators Share Posted April 27 @thebossofc O erro está dizendo que o 4º argumento do seu setPedAnimation deveria ser um número, mas vc colocou um true no lugar. setPedAnimation(source, "crack", "crckidle"..math.random(1,4), true, false, false, false ) -- 1 2 3 4 (era pra ser um número inteiro, o true é só depois) Faltou você declarar o parâmetro time. Normalmente o valor dele é -1. 1 Link to comment
thebossofc Posted April 28 Author Share Posted April 28 Você poderia me ajustar para mim? eu tentei substituir, nada da certo, estou realmente frustrado com esse sistema, estou quase desistindo Link to comment
Other Languages Moderators Lord Henry Posted April 28 Other Languages Moderators Share Posted April 28 setPedAnimation(source, "crack", "crckidle"..math.random(1,4), -1, true, false, false, false) 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