Jump to content

CowBoy69

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by CowBoy69

  1. WOW, AMAZING! It works! Thank you so much! No words By the way, first the server script issued a warning. But, then, one of my friends showed me a mistake, and everything works! Here's how it should look right: function say1Command ( playerSource, commandName ) triggerClientEvent (root, "onSay1", playerSource) end addCommandHandler ( "say1", say1Command ) [The topic is closed, thank you very much]
  2. Everything works, thanks a lot. But I, the idiot, forgot to say more: it is necessary that this sound is heard by the nearest player near the one who reproduced the sound. I tried to do the following: Created a script say1_s.lua (server): function say1Command ( playerSource, commandName ) triggerClientEvent ( "onSay1", root) end addCommandHandler ( "say1", say1Command ) and created a script say1_c.lua (client): local sound function onSay1() if isElement(sound) then stopSound (sound) end local x, y, z = getElementPosition(localPlayer) sound = playSound3D('say1.mp3',x,y,z) setSoundMaxDistance(sound, 25) end addEventHandler("onClientRender", root, function () if isElement(sound) then local x,y,z = getElementPosition(localPlayer) setElementPosition (sound, x, y, z) end end) addEvent("onSay1",true) addEventHandler("onSay1",localPlayer,say1) But when the player enters /say1 the sound is heard from all the players of the server, regardless of the distance. How to fix this?
  3. If I'm not mistaken, then, like, I should have done this: function say1(source,x,y,z) if (source and x and y and z) then local x,y,z = getElementPosition(source) if (x and y and z) then sound = playSound3D('say1.mp3',x,y,z) attachElements (sound,source) setSoundMaxDistance(sound,25) end end end addCommandHandler('say1',say1,source,x,y,z) But, anyway, the sound does not play. Can you show how to define variables x, y, z?
  4. The essence of the script: The player enters the /say1 command and the sound is played inside the player. But when I enter this command, the sound does not play. There are no warnings and errors in the log. What could be the problem? Script: function say1(source) if (source) and x and y and z then local x,y,z = getElementPosition(source) if x and y and z then sound = playSound3D('say1.mp3',x,y,z) attachElements (sound,source) setSoundMaxDistance(sound,25) end end end addCommandHandler('say1',say1) meta.xml: <meta> <script src="say1.lua" type="server"/> -- tried type="client"- did not help <file src="say1.mp3" type="server"/> -- tried type="client" - did not help </meta> P.S.: Maybe, my english is not very good...
×
×
  • Create New...