MrGTAmodsgerman Posted June 14, 2013 Share Posted June 14, 2013 Hello guys Im new in this forum and i really need your help I don't know how to script in Lua and i don't even want to learn it, because i'm skilled enough in VBS,GTA modding and HTML... the thing is: i'd like to have a script for my upcoming server: when you're driving as a player with the freight train thorugh markers which are located on the tracks there should be caused a mp3 sound which will be played at the exact same time at the next train station but the marker would be a client and the soundplayer would be a script please, i really need your help i'd really appreciate it, as a countermove i would give you a customized modded original car from the original car list for example that theres written on a car something like "Big City reallife" or a "flash" stretch limousine please answer, i'd appreciate any answer Link to comment
Castillo Posted June 14, 2013 Share Posted June 14, 2013 We don't accept requests here, and if you already come by "I don't even want to learn", well, you're in the wrong forum then. Link to comment
MrGTAmodsgerman Posted June 14, 2013 Author Share Posted June 14, 2013 We don't accept requests here, and if you already come by "I don't even want to learn", well, you're in the wrong forum then. i mean mean,i have to lean it but i dont know how?Lua is like VBS and i can speak VBS please im ready to learn if i must to do it Link to comment
MrGTAmodsgerman Posted June 14, 2013 Author Share Posted June 14, 2013 https://forum.multitheftauto.com/viewtopic.php?f=148&t=40809 is my script idea even possible? Link to comment
Castillo Posted June 14, 2013 Share Posted June 14, 2013 It should be, but since trains aren't synced, you'll have to do some tricks I think. Link to comment
MrGTAmodsgerman Posted June 14, 2013 Author Share Posted June 14, 2013 It should be, but since trains aren't synced, you'll have to do some tricks I think. what do you mean with trains aren't synced? Link to comment
MrGTAmodsgerman Posted June 16, 2013 Author Share Posted June 16, 2013 It should be, but since trains aren't synced, you'll have to do some tricks I think. how to get it work? function MarkerHit( hitElement, matchingDimension ) if hitElement== getLocalPlayer() then outputChatBox( "warned train station" ) end addEventHandler("onClientMarkerHit", getLocalPlayer(), MarkerHit) function playHBFMusic() local uSound = playSound3D( 'sound/sirene.mp3', -1901.9541015625, 341.8291015625, 43.750392913818 ) setSoundMaxDistance( uSound, 3000 ) setSoundMinDistance( uSound, 1000 ) end addEventHandler("onClientResourceStart", getRootElement(), playHBFMusic) Link to comment
PaiN^ Posted June 16, 2013 Share Posted June 16, 2013 Your errors : - The root of "onClientMarkerHit" can be the root element or a marker ( can't be a player ) . - You're missing an "end" for the "if" at the first function . * And the "onClientResourceStart", If set the root of it to the root element, The function will be called every time a resource starts ( any resource ) . You should use getResourceRootElement instead . Link to comment
AlvareZ_ Posted June 16, 2013 Share Posted June 16, 2013 local hi = createMarker ( 0, 0, 2, "cylinder", 1.5, 255, 255, 0, 170 ) -- This its the Marker function MarkerHit( hitElement, matchingDimension ) outputChatBox( "warned train station", source, 255, 255, 255, 255, false ) -- This output send on player hit the marker (hi) end addEventHandler("onClientMarkerHit", hi, MarkerHit) function playHBFMusic() local uSound = playSound3D( 'sound/sirene.mp3', -1901.9541015625, 341.8291015625, 43.750392913818 ) setSoundMaxDistance( uSound, 3000 ) setSoundMinDistance( uSound, 1000 ) end addEventHandler("onClientResourceStart", getRootElement(), playHBFMusic) Link to comment
iPrestege Posted June 16, 2013 Share Posted June 16, 2013 local hi = createMarker ( 0, 0, 2, "cylinder", 1.5, 255, 255, 0, 170 ) -- This its the Marker function MarkerHit( hitElement, matchingDimension ) outputChatBox( "warned train station", source, 255, 255, 255, 255, false ) -- This output send on player hit the marker (hi) end addEventHandler("onClientMarkerHit", hi, MarkerHit) function playHBFMusic() local uSound = playSound3D( 'sound/sirene.mp3', -1901.9541015625, 341.8291015625, 43.750392913818 ) setSoundMaxDistance( uSound, 3000 ) setSoundMinDistance( uSound, 1000 ) end addEventHandler("onClientResourceStart", getRootElement(), playHBFMusic) OutputchatBox function there's no player text visible argument. Also read Pain's code again. Link to comment
PaiN^ Posted June 16, 2013 Share Posted June 16, 2013 And he used getRootElement with onClientResourceStart * And the "onClientResourceStart", If set the root of it to the root element, The function will be called every time a resource starts ( any resource ) .You should use getResourceRootElement instead . Link to comment
iPrestege Posted June 16, 2013 Share Posted June 16, 2013 -- Client Side ! local marker = createMarker ( 0, 0, 2, "cylinder", 1.5, 255, 255, 0, 170 ) function MarkerHit( hitElement, matchingDimension ) if ( hitElement == getLocalPlayer() ) then outputChatBox( "warned train station" ) end end addEventHandler( "onClientMarkerHit",marker,MarkerHit,false ) function playHBFMusic() local uSound = playSound3D( 'sound/sirene.mp3', -1901.9541015625, 341.8291015625, 43.750392913818 ) setSoundMaxDistance( uSound, 3000 ) setSoundMinDistance( uSound, 1000 ) end addEventHandler( "onClientResourceStart",resourceRoot, playHBFMusic ) Use it client side make sure the sound is added to meta . Link to comment
MrGTAmodsgerman Posted June 16, 2013 Author Share Posted June 16, 2013 Use it client side make sure the sound is added to meta . thanks but it play my sound when i start the script not if the freight hit the marker it comes only my outputchatbox -- Client Side ! local marker = createMarker ( -1873.587890625, -1262.5078125, 15.474542617798, "cylinder", 1.5, 255, 255, 0, 170 ) function MarkerHit( hitElement, matchingDimension ) if ( hitElement == getLocalPlayer() ) then outputChatBox( "Zugstation wurde gewarnt!" ) end end addEventHandler( "onClientMarkerHit",marker,MarkerHit,false ) function playHBFMusic() local uSound = playSound3D( 'ansage/ansage.mp3',-1937.876953125, 128.0166015625, 26.273441314697 ) setSoundMaxDistance( uSound, 10000 ) setSoundMinDistance( uSound, 5000 ) end addEventHandler( "onClientResourceStart",resourceRoot, playHBFMusic ) how i can make to play the sound when the freight hit the marker? thanks for your code but not fix Link to comment
iPrestege Posted June 16, 2013 Share Posted June 16, 2013 Not sure but i think you want this : -- Client Side ! local marker = createMarker ( -1873.587890625, -1262.5078125, 15.474542617798, "cylinder", 1.5, 255, 255, 0, 170 ) function MarkerHit( hitElement, matchingDimension ) if ( hitElement == getLocalPlayer() ) then if uSound and isElement ( uSound ) then destroyElement ( uSound ) end uSound = playSound3D( 'ansage/ansage.mp3',-1937.876953125, 128.0166015625, 26.273441314697 ) setSoundMaxDistance( uSound, 10000 ) setSoundMinDistance( uSound, 5000 ) outputChatBox( "Zugstation wurde gewarnt!" ) end end addEventHandler( "onClientMarkerHit",marker,MarkerHit,false ) Link to comment
MrGTAmodsgerman Posted June 16, 2013 Author Share Posted June 16, 2013 Not sure but i think you want this : -- Client Side ! local marker = createMarker ( -1873.587890625, -1262.5078125, 15.474542617798, "cylinder", 1.5, 255, 255, 0, 170 ) function MarkerHit( hitElement, matchingDimension ) if ( hitElement == getLocalPlayer() ) then if uSound and isElement ( uSound ) then destroyElement ( uSound ) end uSound = playSound3D( 'ansage/ansage.mp3',-1937.876953125, 128.0166015625, 26.273441314697 ) setSoundMaxDistance( uSound, 10000 ) setSoundMinDistance( uSound, 5000 ) outputChatBox( "Zugstation wurde gewarnt!" ) end end addEventHandler( "onClientMarkerHit",marker,MarkerHit,false ) OMG THANKS ALOT But tell me your idea of a custom gta car and it is still possible the marker utilizable only for trains to pacemakers?i mean the freight Link to comment
MrGTAmodsgerman Posted July 1, 2013 Author Share Posted July 1, 2013 You're welcome , No idea. Now i just test it with a friend! but he doesnt hear the sound what is the problem Edit: find my train horn topic is locked the same problem on the train horn script. No player hear the horn only the player who takes the horn any ideas? how to unlock a topic? Link to comment
iPrestege Posted July 1, 2013 Share Posted July 1, 2013 Because it's client side return for the local player .. Ask solid snake. Link to comment
MrGTAmodsgerman Posted July 2, 2013 Author Share Posted July 2, 2013 Because it's client side return for the local player .. Ask solid snake. clientsite=for everyone i think it was that! but local player is not the mp player hööö? now I'm confused i mean like a real train station speaker 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