AlphaMark Posted September 15, 2013 Share Posted September 15, 2013 Hello guys. For some reason my script wont work. 10: Bad argument @ 'createExplosion' 11: Bad argument @ 'createExplosion' 12: Bad argument @ 'createExplosion' function createExplosionForPlayer(thePlayer,command) local x,y,z = getElementPosition(thePlayer) timer = setTimer (createJihadForPlayer, 2500, 1) triggerClientEvent("playTheSound", getRootElement()) end addCommandHandler("Jihad", createExplosionForPlayer) addCommandHandler("jihad", createExplosionForPlayer) function createJihadForPlayer(thePlayer,command) local createdExplosion = createExplosion(x,y,z,2) local createdExplosion = createExplosion(x,y,z,9) local createdExplosion = createExplosion(x,y,z,10) if (createdExplosion == true) then outputChatBox(getPlayerName(thePlayer).." comitted a Jihad!") end end Link to comment
csiguusz Posted September 15, 2013 Share Posted September 15, 2013 Try this: function createExplosionForPlayer(thePlayer,command) local x,y,z = getElementPosition(thePlayer) timer = setTimer (createJihadForPlayer, 2500, 1, thePlayer, x, y, z) triggerClientEvent("playTheSound", getRootElement()) end addCommandHandler("Jihad", createExplosionForPlayer) addCommandHandler("jihad", createExplosionForPlayer) function createJihadForPlayer(thePlayer, x, y, z) local createdExplosion = createExplosion(x,y,z,2) local createdExplosion = createExplosion(x,y,z,9) local createdExplosion = createExplosion(x,y,z,10) if (createdExplosion == true) then outputChatBox(getPlayerName(thePlayer).." comitted a Jihad!") end end Link to comment
AlphaMark Posted September 15, 2013 Author Share Posted September 15, 2013 Yes it worked! Thank you. Link to comment
AlphaMark Posted September 15, 2013 Author Share Posted September 15, 2013 I found an other problem. It wont start the Client script. function playTheSound() sound = playSound("Jihad.mp3", false) setSoundVolume(sound, 2) end addEvent("playTheSound", true) addEventHandler("playTheSound", getRootElement(), playTheSound) Link to comment
csiguusz Posted September 15, 2013 Share Posted September 15, 2013 The sound volume must be between 0 and 1. Mabye this is causing your problem. Link to comment
AlphaMark Posted September 15, 2013 Author Share Posted September 15, 2013 No, I still cant hear the sound Link to comment
csiguusz Posted September 15, 2013 Share Posted September 15, 2013 What is the new value? Any error messages in debugscript? Link to comment
AlphaMark Posted September 15, 2013 Author Share Posted September 15, 2013 Im getting no errors. function playTheSound() sound = playSound("Jihad.mp3", false) setSoundVolume(sound, 1) outputChatBox("Jihad start") end addEvent("playTheSound", true) addEventHandler("playTheSound", getRootElement(), playTheSound) Also i added outputChatBox("Jihad start") to check. It says: Jihad start. But i recieve no sounds Link to comment
csiguusz Posted September 15, 2013 Share Posted September 15, 2013 Weird. It seems to be fine. Aren't your sounds disabled/set to low in the settings? Is it a correct sound file? ( I mean if you play it outside of mta, you can hear it. ) You can check if the sound element was succesfully created by adding outputChatBox ( tostring ( sound ) ) -- this shouldn't say false Link to comment
AlphaMark Posted September 15, 2013 Author Share Posted September 15, 2013 (edited) If i add ( tostring ( sound ) ) it just says False And i hear it outside MTA Edited September 15, 2013 by Guest Link to comment
csiguusz Posted September 15, 2013 Share Posted September 15, 2013 Then it couldn't find or play the sound. Is the path to the sound file correct? Is it added to the meta.xml? Link to comment
AlphaMark Posted September 15, 2013 Author Share Posted September 15, 2013 Yes i forgot to add it in the meta XML Thanks Link to comment
csiguusz Posted September 15, 2013 Share Posted September 15, 2013 Ah... Okay, then it' solved. You are welcome. 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