v36u Posted July 19, 2017 Posted July 19, 2017 Hi guys, i get these errors in the debugscript ERROR : zombies/sounds.lua:67: attempt to call global 'setPedVoice' ( a nil value ) ERROR : zombies/sounds.lua:75: attempt to call global 'isElementStreamedIn' ( a nil value ) And here is the script : function stopZombieSound() local zombies = getElementsByType ( "ped" ) for theKey,theZomb in ipairs(zombies) do setPedVoice(theZomb, "PED_TYPE_DISABLED") -- line 67 end end setTimer(stopZombieSound,1000,0) function playZombieSounds() local zombies = getElementsByType("ped") for theKey,theZomb in ipairs(zombies) do if theZomb and isElement(theZomb) and isElementStreamedIn(theZomb) and getElementData(theZomb,"zombie") and not getElementData(theZomb,"animal") then -- line 75 local Zx,Zy,Zz = getElementPosition(theZomb) zedSound = playSound3D(zombiesounds[math.random(1,#zombiesounds)], Zx, Zy, Zz, false) setSoundMaxDistance(zedSound,5) end if getElementData(theZomb,"deadman") then if zedSound then stopSound(zedSound) end end end end setTimer(playZombieSounds,6000,0) And if i do this local setPedVoice(theZomb, "PED_TYPE_DISABLED") i get this error in the console ERROR: Loading script failed: UNION_DAYZ/sounds/sounds.lua:67: ')' expected near ',' Some help please? Thanks in advance.
MTA Team Lpsd Posted July 19, 2017 MTA Team Posted July 19, 2017 (edited) Make sure the script is set to clientside in meta.xml Also you can't do something such as this: local setPedVoice() The correct way would be this: local voice = setPedVoice() Edited July 19, 2017 by LopSided_ 1
v36u Posted July 19, 2017 Author Posted July 19, 2017 Nice idea but.. didnt work, i even restarted the whole server and.. same error. Any ideas?..
pa3ck Posted July 20, 2017 Posted July 20, 2017 If it says isElementStreamedIn is nil, the script is deffo not set to client side 1
v36u Posted July 20, 2017 Author Posted July 20, 2017 Oh, i solved it, i was so blind. Thank you guys, much appreciated.
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