rusztamas Posted November 23, 2016 Share Posted November 23, 2016 Hello! I want to play a sound effect on the player's location, when he typed the command in, but my script is just not working, can somebody help me? Server: function pocsomoccseLejatszas() triggerClientEvent (getRootElement(), pocsomoccse) end addCommandHandler ("pocsomoccse", pocsomoccseLejatszas) Client: function pocsomoccseHangLejatszas() local jatekosX, jatekosY, jatekosZ = getElementPosition(localPlayer) local pocsomoccseHangEffekt = playSound3D("pocsomoccse.mp3", jatekosX, jatekosY, jatekosZ, false) end addEvent ("pocsomoccse", true) addEventHandler ("pocsomoccse", getRootElement(), pocsomoccseHangLejatszas) Meta: <meta> <info type="script" version="1.0.0"></info> <script src="codeC.lua" type="client"></script> <script src="codeC2.lua" type="client"></script> <script src="pocsomoccse_c.lua" type="client"></script> <script src="pocsomoccse_s.lua" type="server"></script> <file src="italy.mp3"></file> <file src="inferno.mp3"></file> <file src="jinglejingle.mp3"></file> <file src="alarm.mp3"></file> <file src="peddiendre.mp3"></file> <file src="putin_putout.mp3"></file> <file src="pocsomoccse.mp3"></file> </meta> Sorry for the Hungarian language. Link to comment
MTA Team ccw Posted November 23, 2016 MTA Team Share Posted November 23, 2016 Check the server log for script errors when the command is used Link to comment
rusztamas Posted November 23, 2016 Author Share Posted November 23, 2016 http://imgur.com/a/izlQj debugscript 3 writes this. Link to comment
pa3ck Posted November 23, 2016 Share Posted November 23, 2016 So the error says it's expecting string, right? Your line of code is this: triggerClientEvent (getRootElement(), pocsomoccse) Is that a string? No, strings are between " " so it should be this: triggerClientEvent (getRootElement(), "pocsomoccse") Link to comment
rusztamas Posted November 23, 2016 Author Share Posted November 23, 2016 fixed! the 3d argument must be an element,(thePlayer) and i put thePlayer parameter into the function's arguments and now its working. thank you! 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