Leyenda!_ed Posted August 19, 2018 Share Posted August 19, 2018 Hola Necesito Ayuda es mi primer post :,v Como hago que al poner el parlante de musica se pegue ala espalda del jugador soy novato en esto aca el codigo del script Spoiler local isSpeaker = false function print ( player, message, r, g, b ) outputChatBox ( message, player, r, g, b ) end speakerBox = { } addCommandHandler ( "sound", function ( thePlayer ) if ( isElement ( speakerBox [ thePlayer] ) ) then isSpeaker = true end triggerClientEvent ( thePlayer, "onPlayerViewSpeakerManagment", thePlayer, isSpeaker ) end ) addEvent ( "onPlayerPlaceSpeakerBox", true ) addEventHandler ( "onPlayerPlaceSpeakerBox", root, function ( url, isCar ) if ( url ) then if ( isElement ( speakerBox [ source ] ) ) then local x, y, z = getElementPosition ( speakerBox [ source ] ) print ( source, "Parlante Quitado: "..math.floor ( x )..", "..math.floor ( y )..", "..math.floor ( z ), 255, 0, 0 ) destroyElement ( speakerBox [ source ] ) removeEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) end local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) speakerBox [ source ] = createObject ( 2229, x-0.5, y+0.5, z - 1, 0, 0, rx ) print ( source, "Parlante Creado "..math.floor ( x )..", "..math.floor ( y )..", "..math.floor ( z ), 0, 255, 0 ) addEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) triggerClientEvent ( root, "onPlayerStartSpeakerBoxSound", root, source, url, isCar ) if ( isCar ) then local car = getPedOccupiedVehicle ( source ) attachElements ( speakerBox [ source ], car, -0.7, -1.5, -0.5, 0, 90, 0 ) end end end ) addEvent ( "onPlayerDestroySpeakerBox", true ) addEventHandler ( "onPlayerDestroySpeakerBox", root, function ( ) if ( isElement ( speakerBox [ source ] ) ) then destroyElement ( speakerBox [ source ] ) triggerClientEvent ( root, "onPlayerDestroySpeakerBox", root, source ) removeEventHandler ( "onPlayerQuit", source, destroySpeakersOnPlayerQuit ) print ( source, "Parlante Quitado.", 255, 0, 0 ) else print ( source, "El Parlante Ya A Sido Quitado.", 255, 255, 0 ) end end ) addEvent ( "onPlayerChangeSpeakerBoxVolume", true ) addEventHandler ( "onPlayerChangeSpeakerBoxVolume", root, function ( to ) triggerClientEvent ( root, "onPlayerChangeSpeakerBoxVolumeC", root, source, to ) end ) function destroySpeakersOnPlayerQuit ( ) if ( isElement ( speakerBox [ source ] ) ) then destroyElement ( speakerBox [ source ] ) triggerClientEvent ( root, "onPlayerDestroySpeakerBox", root, source ) end end 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