Jump to content

voicecommands?


xTravax

Recommended Posts

Posted

Can anyone give me a full script example of voicecommand

like i make sound hi and name it hi.mp3

and when i write command /hi it will play sound hi.mp3

Posted

i don't know to script but i tried to edit wiki script is it good?

-- it was stopSound so i changed it to startSound

function startMySound() 
    sound = playSound( "sound.mp3", true ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), startMySound ) 
addCommandHandler ( "startsound", startMySound )  

Posted

i got this error

BASS ERROR 2 in LoadMedia  path:C:\Program Files (x86)\MTA San Andreas 1.3\mods\deathmatch\resources\voicecommands\hello.mp3  3d:0  loop:1 

Posted
function startMySound() 
    sound = playSound( "hello.mp3", false ) 
end 
addCommandHandler ( "hello", startMySound ) 

i have made mistake in META now its FIXED

but i have another PROBLEM

when i do /hello it will keep repeating without stopping and i want it to stop when it finishes (2 seconds)

Posted
function startMySound() 
    sound = playSound( "hello.mp3", false ) 
end 
addCommandHandler ( "hello", startMySound ) 

i have made mistake in META now its FIXED

but i have another PROBLEM

when i do /hello it will keep repeating without stopping and i want it to stop when it finishes (2 seconds)

setTimer 
destroyElement 

Posted

i tried to make it but it looks all weird and if i give it to you it would look like i never saw lua and i know to make

function startMySound()

sound = playSound( "hello.mp3", false )

end

addCommandHandler ( "hello", startMySound )

but idk to make destroyelement and settimer

Posted

It shouldn't repeat since the loop argument is false, but I guess your mp3 file isn't just a one "hello".

function startMySound() 
helloSound = playSound( "hello.mp3", false ) 
setTimer(stopHelloSound, 2000, 1) 
end 
addCommandHandler ( "hello", startMySound ) 
  
function stopHelloSound() 
stopSound(helloSound) 
end 

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...