This script should play zombies moan. But nothing hapend
Client
local zombies = getElementsByType ( "ped" )
for theKey,theZomb in ipairs(zombies) do
if (isElement(theZomb)) then
if (getElementData (theZomb, "zombie") == true) then
setPedVoice(theZomb, "PED_TYPE_DISABLED")
end
end
end
addEvent( "Zomb_Moan", true )
function Zmoan ( ped, randnum )
if (isElement(ped)) then
local Zx,Zy,Zz = getElementPosition( ped )
local sound = playSound3D("sounds/mgroan"..randnum..".ogg", Zx, Zy, Zz, false)
setSoundMaxDistance(sound, 20)
end
end
addEventHandler( "Zomb_Moan", getRootElement(), Zmoan )
Server
function zmoan(zombie)
if moancount < moanlimit then
moancount = moancount+1
local randnum = math.random( 1, 10 )
triggerClientEvent ( "Zomb_Moan", getRootElement(), zombie, randnum )
setTimer ( ReduceMoancount, 800, 1 )
end
end