Jump to content

playsound


orcun99

Recommended Posts

server

    
	addEvent("sess",true)
	function asd (player) 
 local sound = playSound("money.mp3")
    setSoundVolume(sound, 1.0) 
addEventHandler("sess", getRootElement(), asd)

client

function pickupUse ( player )
 if getElementModel(source) == 1212 then
	  triggerClientEvent ( root, "sess", root ) 
	end
end
addEventHandler ( "onPickupUse", resourceRoot, pickupUse )

 

I want just localplayer player can hear this song not all 

Link to comment
  • Moderators
triggerClientEvent ( source, "sess", root ) 

Syntax:

bool triggerClientEvent ( [table/element sendTo=getRootElement()], string name, element sourceElement, [arguments...] )

https://wiki.multitheftauto.com/wiki/TriggerClientEvent

 


Required Arguments

  • sourceElement: The element that is the source of the event.
  • name: The name of the event to trigger client side. You should register this event with addEvent and add at least one event handler using addEventHandler
 

 

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • sendTo: The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements.
  • arguments...: A list of arguments to trigger with the event. You can pass any lua data type (except functions). You can also pass elements.

 





You might want to reply here as well...

 

  • Thanks 1
Link to comment
9 minutes ago, IIYAMA said:

triggerClientEvent ( source, "sess", root ) 

Syntax:

bool triggerClientEvent ( [table/element sendTo=getRootElement()], string name, element sourceElement, [arguments...] )

https://wiki.multitheftauto.com/wiki/TriggerClientEvent

 


Required Arguments

  • sourceElement: The element that is the source of the event.
  • name: The name of the event to trigger client side. You should register this event with addEvent and add at least one event handler using addEventHandler
 

 

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • sendTo: The event will be sent to all players that are children of the specified element. By default this is the root element, and hence the event is sent to all players. If you specify a single player it will just be sent to that player. This argument can also be a table of player elements.
  • arguments...: A list of arguments to trigger with the event. You can pass any lua data type (except functions). You can also pass elements.

 





You might want to reply here as well...

 

triggerClientEvent ( root, "sess", root )      ok I changed to     triggerClientEvent ( source, "sess", root )     but still don't work 

now there is no play song  no one can't hear song

Edited by orcun99
Link to comment

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