Castillo Posted June 17, 2013 Share Posted June 17, 2013 -- server side: addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "H", "down", playHorn ) bindKey ( player, "H", "up", playHorn ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "H", "down", playHorn ) bindKey ( source, "H", "up", playHorn ) end ) function playHorn ( thePlayer, key, keyState ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) if ( not theVehicle ) then return end if ( getElementModel ( theVehicle ) == 537 ) then triggerClientEvent ( "vehicleHorn", root, ( keyState == "down" and true or false ), theVehicle ) end end -- client side: addEvent ( "vehicleHorn", true ) addEventHandler ( "vehicleHorn", root, function ( state, theVehicle ) if isElement ( desusound ) then stopSound ( desusound ) end if ( state ) then local x, y, z = getElementPosition ( theVehicle ) desusound = playSound3D ( 'hupe/ZUGHUPE.mp3', x, y, z ) setSoundVolume ( desusound, 5.0 ) setSoundMaxDistance ( desusound, 190 ) attachElements ( desusound, theVehicle ) end end ) Link to comment
MrGTAmodsgerman Posted June 18, 2013 Author Share Posted June 18, 2013 -- server side: addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "H", "down", playHorn ) bindKey ( player, "H", "up", playHorn ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "H", "down", playHorn ) bindKey ( source, "H", "up", playHorn ) end ) function playHorn ( thePlayer, key, keyState ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) if ( not theVehicle ) then return end if ( getElementModel ( theVehicle ) == 537 ) then triggerClientEvent ( "vehicleHorn", root, ( keyState == "down" and true or false ), theVehicle ) end end -- client side: addEvent ( "vehicleHorn", true ) addEventHandler ( "vehicleHorn", root, function ( state, theVehicle ) if isElement ( desusound ) then stopSound ( desusound ) end if ( state ) then local x, y, z = getElementPosition ( theVehicle ) desusound = playSound3D ( 'hupe/ZUGHUPE.mp3', x, y, z ) setSoundVolume ( desusound, 5.0 ) setSoundMaxDistance ( desusound, 190 ) attachElements ( desusound, theVehicle ) end end ) dont hear the horn with it EDIT:i get it to work but i dont know it is really works Meta: Link to comment
MrGTAmodsgerman Posted June 18, 2013 Author Share Posted June 18, 2013 -- server side: just tell me your custom modidea Link to comment
Castillo Posted June 18, 2013 Share Posted June 18, 2013 It works the same as yours did, but everyone nearby will hear it. Link to comment
MrGTAmodsgerman Posted June 20, 2013 Author Share Posted June 20, 2013 It works the same as yours did, but everyone nearby will hear it. cool why you dont need this script Link to comment
Castillo Posted June 20, 2013 Share Posted June 20, 2013 I don't understand what you mean. Link to comment
MrGTAmodsgerman Posted June 20, 2013 Author Share Posted June 20, 2013 I don't understand what you mean. why you dont use the script? its a cool for rp its too nice train coming,player on the rail train driver horn with the train and the player on the rail hear that Link to comment
Castillo Posted June 21, 2013 Share Posted June 21, 2013 Please use private messages for such questions. Link to comment
MrGTAmodsgerman Posted July 6, 2013 Author Share Posted July 6, 2013 Please use private messages for such questions. problem on the train horn script. No player hear the horn only the player who takes the horn any ideas? the horn must hear like a normal gta car horn in the multiplayer Link to comment
Castillo Posted July 6, 2013 Share Posted July 6, 2013 The script I posted has to work. Link to comment
MrGTAmodsgerman Posted July 13, 2013 Author Share Posted July 13, 2013 The script I posted has to work. Thanks it works but is it availible to make the sound like a audio player? i mean if the play press H then the sound comes in full of time. 1x press then play the sound complete Link to comment
MrGTAmodsgerman Posted July 14, 2013 Author Share Posted July 14, 2013 What do you mean? just i mean when the player press H then the sound comes automaticly,no stoping when the player doesnt press H.Like a windows media player.You press play (H key) and the windows media player play the sound to the end. sorry for my bad english 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