S7waj Posted June 28, 2020 Share Posted June 28, 2020 Hi Guys I Want To Make Ped Start sound when the ped attack the player but the sound don't start can i know where is the wrong? function tankAttack ( attacker, weapon, bodypart, randnum ) local number = tonumber(randum) if not number then return end if (attacker) then if getElementType ( attacker ) == "ped" then if (getElementData (attacker, "Tank") == true) then local playerHealth = getElementHealth ( getLocalPlayer() ) if playerHealth > 15 then setElementHealth ( source, playerHealth - 20 ) local Zx1, Zy1, Zz1 = getElementPosition( attacker ) local sound = playSound3D("sounds/tgroan"..math.ceil(number)..".wav", Zx1, Zy1, Zz1, false) setSoundMaxDistance(sound, 20) else triggerServerEvent ("killed", source, source, attacker, weapon, bodypart ) end end end end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), tankAttack ) Link to comment
Sisqo0 Posted June 28, 2020 Share Posted June 28, 2020 (edited) Did you define the sound in meta.xml ? & how many numbers of the sounds did you define? It would be better if you did /debugscript 3 ingame and show us Edited June 28, 2020 by Sisqo0 Link to comment
Moderators Patrick Posted June 28, 2020 Moderators Share Posted June 28, 2020 (edited) Solved on Discord. (link) Edited June 28, 2020 by Patrick 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