Jump to content

Team Chat


ZeyadGTX

Recommended Posts

Posted

Hey Guys , i have script which make sound in chat , but i have something i want this sounds Plays onTeamChat only

because it plays on Any Chat

Client :)

function playSonido() 
local sound = playSound("chat.mp3",false) 
setSoundVolume(sound, 0.9) 
end 
addEvent("sonido",true) 
addEventHandler("sonido",getRootElement(),playSonido) 

Server

function chat (thePlayer) 
triggerClientEvent("sonido",getRootElement()) 
end 
addEventHandler ( "onPlayerChat", getRootElement(), chat ) 

My nick in MTA is Spider

Posted

Next Time , Make sure your in the Scripting Section ,

addEventHandler('onPlayerChat', root, 
function ( msg, msgType ) 
if ( msgType == 2 ) then 
    triggerClientEvent(source, 'Play', source ) 
     end 
   end 
  ) 
   
   
---ServerSide  
addEvent('Play', true ) 
addEventHandler('Play', root, 
function ( ) 
local sound = playSound("chat.mp3" ) 
setSoundVolume(sound, 1.0)  
    end 
) 

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

  • Moderators
Posted
We have helped you with 2 scripts for teamchat already and still you don't know it? Look into the scripts we have 'helped' you with and go understand it. I think you are not even taking time to look into it.

Hij wil het ook niet, dit is alleen maar bedelen.

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

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

Not Working , i added this to server side

addEventHandler('onPlayerChat', root, 
function ( msg, msgType ) 
if ( msgType == 2 ) then 
    triggerClientEvent(source, 'Play', source ) 
     end 
   end 
  ) 
  
  
---ServerSide 
addEvent('Play', true ) 
addEventHandler('Play', root, 
function ( ) 
local sound = playSound("chat.mp3" ) 
setSoundVolume(sound, 1.0) 
    end 
) 

My nick in MTA is Spider

Posted

are you sure chat.mp3 is not inside a file , ?

and show meta.xml

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

Make 2 lua file , file 1 - clientSide witch is the play sound , file 2 the server side , witch is the have triggerClient,

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

Server side

addEventHandler('onPlayerChat', root, 
function ( msg, msgType ) 
if ( msgType == 2 ) then 
    triggerClientEvent(source, 'Play', source ) 
     end 
   end 
  ) 
  
  
---ServerSide 
addEvent('Play', true ) 
addEventHandler('Play', root, 
function ( ) 
local sound = playSound("chat.mp3" ) 
setSoundVolume(sound, 1.0) 
    end 
) 

Client

function playSonido() 
local sound = playSound("chat.mp3",false) 
setSoundVolume(sound, 0.9) 
end 
addEvent("sonido",true) 
addEventHandler("sonido",getRootElement(),playSonido) 

My nick in MTA is Spider

Posted

this is serverSide ,

addEventHandler('onPlayerChat', root, 
function ( msg, msgType ) 
if ( msgType == 2 ) then 
    triggerClientEvent(source, 'Play', source ) 
     end 
   end 
  ) 

ClientSide ,

addEvent('Play', true ) 
addEventHandler('Play', root, 
function ( ) 
local sound = playSound("chat.mp3" ) 
setSoundVolume(sound, 1.0) 
    end 
) 

and change the misc to script

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

thanks , it works good but i have another question . i hear the sound when i send message i want to hear it when others send

My nick in MTA is Spider

Posted

Client Side !

addEvent( "PlaySound", true ) 
addEventHandler( "PlaySound", root, function (  ) 
   if ( isElement( sound ) ) then destroyElement( sound ) end 
   local sound = playSound( "chat.mp3" ) 
   setSoundVolume( sound, 1.0 ) 
end ) 

Server Side !

addEventHandler( "onPlayerChat", root, function ( msg, msgType ) 
  if ( msg ~= "" and msgType == 2 ) then 
         triggerClientEvent( "PlaySound", root ) 
     end 
end ) 

To Contact Me at Skype : [email protected]

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