orcun99 Posted February 26, 2018 Share Posted February 26, 2018 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 IIYAMA Posted February 26, 2018 Moderators Share Posted February 26, 2018 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... 1 Link to comment
orcun99 Posted February 26, 2018 Author Share Posted February 26, 2018 (edited) 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 February 26, 2018 by orcun99 Link to comment
Moderators IIYAMA Posted February 26, 2018 Moderators Share Posted February 26, 2018 triggerClientEvent ( player, "sess", root ) * It would be nice if you correct me instead of saying that it doesn't work. 1 Link to comment
orcun99 Posted February 26, 2018 Author Share Posted February 26, 2018 13 minutes ago, IIYAMA said: triggerClientEvent ( player, "sess", root ) * It would be nice if you correct me instead of saying that it doesn't work. works now thank u 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now