DjSt3rios Posted July 23, 2011 Share Posted July 23, 2011 Hello, Im trying to make a code, when the car changes gear, play a small turbo sound, to sound more cool. The problem is, i hear a small sound, like it begins, but it stops immediately, i can only listen a small sound for like 100MS and it stops.. I dont really understand why.. maybe someone can help me? Codes I have so far: in meta.xml: "sounds/turbo.mp3" /> I have a folder named sounds and the file inside. local function begin() setRadioChannel(0) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), begin ) gRootElement = getRootElement() gThisResourceName = getResourceName(getThisResource()) addEvent("soundTurbo", true) addEventHandler("soundTurbo", gRootElement, function() setRadioChannel(0) song = playSound("sounds/turbo.mp3", false) setSoundVolume(song,1) setSoundPaused(song, false) end) local function soundturbo() triggerEvent("soundTurbo", getLocalPlayer()) end addCommandHandler("turbo", soundturbo) Actually, This one is made with command, not when car is changing gear, but its the same. So, I type /turbo, and i have the problem I said before. If someone has any idea what can cause this problem, please let me know. Thank you! Link to comment
bandi94 Posted July 23, 2011 Share Posted July 23, 2011 DjSt3rios if you wana make this for the rpm+gear meter only put playSound("sounds/turbo..mp3") whit a a function what check last gear and the actual gear if gear==lastgear then ... lastgear=gear and setTimer... ( and its for client side and teh rpm is client side ...) Link to comment
DjSt3rios Posted July 23, 2011 Author Share Posted July 23, 2011 Well, im not that stupid, I tried it, I didnt use triggerEvent and all this in the beginning, but its not working.. in the beginning i used only playSound("sounds/turbo..mp3") But no luck.. Link to comment
qaisjp Posted July 23, 2011 Share Posted July 23, 2011 local function begin() setRadioChannel(0) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), begin ) gRootElement = getRootElement() gThisResourceName = getResourceName(getThisResource()) function soundturbo() setRadioChannel(0) song = playSound("sounds/turbo.mp3", false) setSoundVolume(song,1) setSoundPaused(song, false) end addCommandHandler("turbo", soundturbo) Link to comment
DjSt3rios Posted July 23, 2011 Author Share Posted July 23, 2011 I found that the mp3 was the problem. Although i changed mp3, and i did /redo, still was the same. But when i quitted from the server and rejoined, it was fixed.Although the mp3 which had the problem, was playing fine in Windows Media Player, but for some reason in MTA had problem. Anyway its all fixed now, thanks anyway! 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