Andres Lahm
-
Posts
6 -
Joined
-
Last visited
Posts posted by Andres Lahm
-
-
-
playSound3D (" http://youtubeinmp3.com/fetch/?video="..url.."", x, y, z, true) stopped working a few months ago
Any other API for youtube that is direct
-
On 21/7/2016 at 05:56, aka Blue said:
Aquí os dejo el script que uso actualmente para la carga de mapas en mi servidor. Gracias a los que me ayudaron aquí en el foro, pude acabarlo. No es lo más automático posible pero en cuanto a optimización está bastante bien, a mi de momento no me ha dado problemas con la carga ni con lag. Espero que os sirva, aquí os dejo un pequeño tutorial de cómo usarlo:
removeWorldObject
Los removeWorldObject los tendremos que meter en el archivo remove.map (está en proceso de cambio), es un mapa que básicamente lo que haría es, pues eso, remover los objetos que hayamos borrado anteriormente en nuestro mapa. Para verlos, tenemos que entrar simplemente a nuestro .map que queramos meter y sacar todos los removeWorldObject, metiéndolos en éste archivo (remove.map).
Mapas
Los mapas se añaden como archivos en la carpeta 'mapas' que trae el script. Los mapas se leen como archivos en el cliente, por lo cual, los debemos añadir en el meta.xml, tal que así:
"mapas/nombre_del_mapa.map" />
Luego en el script tendremos una pequeña tabla y debemos añadir los mapas así también:
-- Añade los mapas así: "nombredelmapa.map" local mapas = { "nombre_del_mapa.map" }
Link de descarga: http://adf.ly/1cU0yZ
Repito, no es el mejor script del mundo ni mucho menos, pero al menos a mi de momento no me ha dado problema ninguno, así que bueno, lo comparto por si alguien desea utilizarlo.
Gracias
Link caido podrias subirlo de nuevo quiero probarlo
- 1
-
Bueno como dice el titulo del tema no sabes alguna otra api para youtube que no sea
"http://www.youtubeinmp3.com/fetch/?video="..url.."
Ya que esta dejo de funcionar alguna otra forma para poner links directos de youtube
es para el playSound
-
Bueno el parlante para escuchar musica con links directos de youtube ya no funciona, parece que la pagina ya no funciona.
Nose si habra otra forma para reproducir links directos de youtube sin tener que convertirlos en mp3
Cliente:
------------------------------ -- Variables -- ------------------------------ local subTrackOnSoundDown = 0.1 -- The volume that goes down, when the player clicks "Volume -" local subTrackOnSoundUp = 0.1 -- The volume that goes up, when the player clicks "Volume +" function print ( message, r, g, b ) outputChatBox ( message, r, g, b ) end ------------------------------ -- The GUI -- ------------------------------ local rx, ry = guiGetScreenSize ( ) button = { } window = guiCreateWindow( ( rx - 295 ), ( ry / 2 - 253 / 2 ), 293, 253, "Panel Sound 3D", false) guiWindowSetSizable(window, false) guiSetVisible ( window, false ) CurrentSpeaker = guiCreateLabel(8, 33, 254, 17, "Parlante creado: No", false, window) volume = guiCreateLabel(10, 50, 252, 17, "Volumen: 100%", false, window) pos = guiCreateLabel(10, 66, 252, 15, "Buscar Link De :www.youtube.com", false, window) guiCreateLabel(11, 81, 251, 15, "URL:", false, window) --url = guiCreateEdit(11, 96, 272, 23, "", false, window) url = guiCreateEdit(11, 96, 272, 23, "", false, window) button["place"] = guiCreateButton(9, 129, 274, 20, "Crear Parlante", false, window) button["remove"] = guiCreateButton(9, 159, 274, 20, "Destruir Parlante", false, window) button["v-"] = guiCreateButton(9, 189, 128, 20, "Volumen -", false, window) button["v+"] = guiCreateButton(155, 189, 128, 20, "Volumen +", false, window) button["close"] = guiCreateButton(9, 219, 274, 20, "Salir", false, window) -------------------------- -- My sweet codes -- -------------------------- local isSound = false addEvent ( "onPlayerViewSpeakerManagment", true ) addEventHandler ( "onPlayerViewSpeakerManagment", root, function ( current ) local toState = not guiGetVisible ( window ) guiSetVisible ( window, toState ) showCursor ( toState ) if ( toState == true ) then guiSetInputMode ( "no_binds_when_editing" ) local x, y, z = getElementPosition ( localPlayer ) if ( current ) then guiSetText ( CurrentSpeaker, "Parlante creado: Si" ) isSound = true else guiSetText ( CurrentSpeaker, "Parlante creado: No" ) end end end ) addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == button["close"] ) then guiSetVisible ( window, false ) showCursor ( false ) elseif ( source == button["place"] ) then if ( isURL ( ) ) then triggerServerEvent ( "onPlayerPlaceSpeakerBox", localPlayer, guiGetText ( url ), isPedInVehicle ( localPlayer ) ) guiSetText ( CurrentSpeaker, "Parlante creado: Si" ) isSound = true guiSetText ( volume, "Volumen: 100%" ) else print ( "Ingresa una URL", 255, 0, 0 ) end elseif ( source == button["remove"] ) then triggerServerEvent ( "onPlayerDestroySpeakerBox", localPlayer ) guiSetText ( CurrentSpeaker, "Parlante creado: No" ) isSound = false guiSetText ( volume, "Volumen: 100%" ) elseif ( source == button["v-"] ) then if ( isSound ) then local toVol = math.round ( getSoundVolume ( speakerSound [ localPlayer ] ) - subTrackOnSoundDown, 2 ) if ( toVol > 0.0 ) then print ( "Volumen Seteado a "..math.floor ( toVol * 100 ).."%!", 0, 255, 0 ) triggerServerEvent ( "onPlayerChangeSpeakerBoxVolume", localPlayer, toVol ) guiSetText ( volume, "Volumen: "..math.floor ( toVol * 100 ).."%" ) else print ( "Este es el volumen minimo", 255, 0, 0 ) end end elseif ( source == button["v+"] ) then if ( isSound ) then local toVol = math.round ( getSoundVolume ( speakerSound [ localPlayer ] ) + subTrackOnSoundUp, 2 ) if ( toVol < 1.1 ) then print ( "Volumen Seteado a "..math.floor ( toVol * 100 ).."%!", 0, 255, 0 ) triggerServerEvent ( "onPlayerChangeSpeakerBoxVolume", localPlayer, toVol ) guiSetText ( volume, "Volumen: "..math.floor ( toVol * 100 ).."%" ) else print ( "Este es el volumen maximo", 255, 0, 0 ) end end end end ) speakerSound = { } addEvent ( "onPlayerStartSpeakerBoxSound", true ) addEventHandler ( "onPlayerStartSpeakerBoxSound", root, function ( who, url, isCar ) if ( isElement ( speakerSound [ who ] ) ) then destroyElement ( speakerSound [ who ] ) end local x, y, z = getElementPosition ( who ) speakerSound [ who ] = playSound3D ( "http://www.youtubeinmp3.com/fetch/?video="..url, x, y, z, true ) setSoundVolume ( speakerSound [ who ], 1 ) setSoundMinDistance ( speakerSound [ who ], 15 ) setSoundMaxDistance ( speakerSound [ who ], 20 ) if ( isCar ) then local car = getPedOccupiedVehicle ( who ) attachElements ( speakerSound [ who ], car, 0, 5, 1 ) end end ) addEvent ( "onPlayerDestroySpeakerBox", true ) addEventHandler ( "onPlayerDestroySpeakerBox", root, function ( who ) if ( isElement ( speakerSound [ who ] ) ) then destroyElement ( speakerSound [ who ] ) end end ) -------------------------- -- Volume -- -------------------------- addEvent ( "onPlayerChangeSpeakerBoxVolumeC", true ) addEventHandler ( "onPlayerChangeSpeakerBoxVolumeC", root, function ( who, vol ) if ( isElement ( speakerSound [ who ] ) ) then setSoundVolume ( speakerSound [ who ], tonumber ( vol ) ) end end ) function isURL ( ) if ( guiGetText ( url ) ~= "" ) then return true else return false end end function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end
Servidor:
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.", 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.", 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
Bueno espero que podramos solucionarlo
Como lograr ésto?
in Scripting
Posted
Soy nuevo en esto pero creo que esto puede ayudarte
https://wiki.multitheftauto.com/wiki/FadeCamera