Jump to content

Sonidos con outputChatBox.


RuSO

Recommended Posts

Hola a todos!,vengo al foro de MTA para preguntarles sobre una cosa que encerio no puedo resolver y en la wiki no viene y tampoco encontré un tema sobre esto en el Foro,bueno al grano,estoy haciendo un script que se "supone" debes de poner un comando en el chat y al mismo tiempo empieza el sonido seleccionado junto con un mensaje para todo el servidor.

Quisiera que me ayudaran de que hacer con esto :D

Aquí el script que activa el sonido y despues de el los comandos de tal script(SOLO EL PRIMER SONIDO DE OTROS):

function onSoundEvent () 
   outputDebugString("command used") 
   local sound = playSound("files/gallina.mp3",false) 
   outputDebugString(tostring(sound)) 
end 
  
addCommandHandler("buk", onSoundEvent) 

Y aquí los comandos del outputChatBox(CON LOS MISMOS COMANDOS DE LOS SONIDOS):

function colouredChat ( message, theType ) 
    if theType == 0 then --if its normal chat (not /me or teamchat) then 
        cancelEvent() --prevent MTA from outputting chat 
        message = string.gsub(message, "#%x%x%x%x%x%x", "") --remove any hex tags in a player's chat to prevent custom colours by using lua's string.gsub 
        local r,g,b = getPlayerNametagColor ( source ) --get the player's nametag colour 
        local chatterName = getPlayerName ( source ) --get his name 
        --output a message with the name as his nametag colour, and the rest in white. 
        outputChatBox ( chatterName..":#FFFFFF<-#FF6600Started a #ffffffSOUND! "..message, getRootElement(), r, g, b, true ) 
    end 
end 
addEventHandler("onPlayerChat", getRootElement(), colouredChat) 
  
addEventHandler("buk", getRootElement(), colouredChat) 
addEventHandler("hell", getRootElement(), colouredChat) 
addEventHandler("gs", getRootElement(), colouredChat) 
addEventHandler("noob", getRootElement(), colouredChat) 
addEventHandler("ding", getRootElement(), colouredChat) 
addEventHandler("yea", getRootElement(), colouredChat) 
  

El chiste es que solo se activan los sonidos y los mensajes no, quizá sea porque tienen los mismos comandos o se les tiene que agregar el outputchatbox al mismo script de los sonidos, Favor de ayudarme :D.

GRACIAS POR LEER.

Link to comment
  • Recently Browsing   0 members

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