Jump to content

Sound


Tekken

Recommended Posts

Posted

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 

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

  • Moderators
Posted

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted

I don't get any error

i tried with /debugscript 3 and nothing

I am not just talking about /debugscript 3.

I am talking about the other strategies, as you would see if you did read the page carefully.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...