Jump to content

Search the Community

Showing results for tags 'radiosystem'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 3 results

  1. How can I make the system work so that when I press the CAPSLOCK key, for example, I only talk on the radio without being heard by those around me, and when I talk to someone next to me, they don't hear me on the radio system? Did you have any fun or?
  2. I have this music script but it does not destroy the music when the vehicle is destroyed and how can I solve it? client function centerWindow (center_window) local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 guiSetPosition(center_window, x, y, false) end GUIEditor = { tab = {}, label = {}, tabpanel = {}, edit = {}, button = {}, window = {}, scrollbar = {}, radiobutton = {} } GUIEditor.window[1] = guiCreateWindow(500, 187, 378, 280, "Radio Vehicular", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 22, 358, 227, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Radio", GUIEditor.tabpanel[1]) GUIEditor.label[1] = guiCreateLabel(10, 10, 178, 16, "Ingresa una url:", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.edit[1] = guiCreateEdit(10, 31, 199, 26, "", false, GUIEditor.tab[1]) GUIEditor.radiobutton[1] = guiCreateRadioButton(20, 67, 18, 15, "", false, GUIEditor.tab[1]) GUIEditor.radiobutton[2] = guiCreateRadioButton(112, 69, 18, 15, "", false, GUIEditor.tab[1]) GUIEditor.label[2] = guiCreateLabel(44, 67, 60, 17, "Radio/Web", false, GUIEditor.tab[1]) GUIEditor.label[3] = guiCreateLabel(133, 67, 200, 17, "Youtube", false, GUIEditor.tab[1]) GUIEditor.button[1] = guiCreateButton(13, 97, 91, 28, "Reproducir", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.scrollbar[1] = guiCreateScrollBar(20, 161, 239, 22, true, false, GUIEditor.tab[1]) guiScrollBarSetScrollPosition(GUIEditor.scrollbar[1], 100.0) GUIEditor.label[4] = guiCreateLabel(10, 135, 178, 16, "Volumen:", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[4], "default-bold-small") porcientomusica = guiCreateLabel(67, 135, 86, 17, "0%", false, GUIEditor.tab[1]) GUIEditor.button[2] = guiCreateButton(114, 97, 91, 28, "Detener", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.tab[2] = guiCreateTab("Mis links", GUIEditor.tabpanel[1]) GUIEditor.label[5] = guiCreateLabel(10, 10, 138, 15, "Ingresa el url a guardar:", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.label[5], "default-bold-small") GUIEditor.edit[2] = guiCreateEdit(10, 31, 199, 26, "", false, GUIEditor.tab[2]) GUIEditor.button[3] = guiCreateButton(145, 67, 74, 28, "Guardar", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.button[3], "default-bold-small") guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(10, 67, 125, 28, "Ver links guardados", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.button[4], "default-bold-small") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA") closebutton = guiCreateButton(307, 249, 60, 24, "Cerrar", false, GUIEditor.window[1]) guiSetFont(closebutton, "default-bold-small") guiSetProperty(closebutton, "NormalTextColour", "FFAAAAAA") guiSetVisible( GUIEditor.window[1], false ) centerWindow ( GUIEditor.window[1] ) myLinksGUI = guiCreateWindow(378, 133, 503, 292, "Mis links", false) guiWindowSetSizable(myLinksGUI, false) mylinksGridlist = guiCreateGridList(9, 26, 485, 218, false, myLinksGUI) a = guiGridListAddColumn(mylinksGridlist, "Url", 0.5) b = guiGridListAddColumn(mylinksGridlist, "Fecha", 0.5) copyurlbutton = guiCreateButton(19, 254, 86, 29, "Copiar url", false, myLinksGUI) guiSetFont(copyurlbutton, "default-bold-small") guiSetProperty(copyurlbutton, "NormalTextColour", "FFAAAAAA") deleteurlbutton = guiCreateButton(115, 254, 86, 29, "Eliminar url", false, myLinksGUI) guiSetFont(deleteurlbutton, "default-bold-small") guiSetProperty(deleteurlbutton, "NormalTextColour", "FFAAAAAA") closeMyLinksGUI = guiCreateButton(211, 254, 86, 29, "Cerrar", false, myLinksGUI) guiSetFont(closeMyLinksGUI, "default-bold-small") guiSetProperty(closeMyLinksGUI, "NormalTextColour", "FFAAAAAA") guiSetVisible( myLinksGUI, false ) centerWindow ( myLinksGUI ) --guiSetEnabled( GUIEditor.radiobutton[2], false ) local radios = { } function openPanel( ) local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if isPedInVehicle( getLocalPlayer( ) ) and getVehicleController( veh ) == getLocalPlayer( ) then openMain( ) end end bindKey( "F5", "down", openPanel ) addCommandHandler( "radio", openPanel ) function openMain( ) if guiGetVisible( GUIEditor.window[1] ) == false then guiSetVisible( GUIEditor.window[1], true ) showCursor( true ) guiSetText( porcientomusica, tostring( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) ).."%") else guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) end end function clicksBotones( ) if source == GUIEditor.button[1] then if guiRadioButtonGetSelected( GUIEditor.radiobutton[1] ) == true or guiRadioButtonGetSelected( GUIEditor.radiobutton[2] ) == true then local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if getVehicleController( veh ) == getLocalPlayer( ) then local editT = guiGetText( GUIEditor.edit[1] ) if string.len( editT ) > 5 then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) triggerServerEvent ( "reproducirLink", getLocalPlayer( ), editT, veh, ( ( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) * 1.0 ) / 100 ), tipoRepro( ) ) else outputChatBox( "Link no valido!", 255, 255, 255, true ) end else outputChatBox( "Solo el conductor puede reproducir la radio!", 255, 255, 255, true ) end else outputChatBox( "Selecciona un tipo de url!", 255, 255, 255, true ) end elseif source == GUIEditor.button[2] then local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if getVehicleController( veh ) == getLocalPlayer( ) then triggerServerEvent ( "detenerRepro", getLocalPlayer( ), veh ) else outputChatBox( "Solo el conductor puede reproducir la radio!", 255, 255, 255, true ) end elseif source == closebutton then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) elseif source == GUIEditor.button[3] then local editT = guiGetText( GUIEditor.edit[2] ) if string.len( editT ) > 5 then triggerServerEvent ( "saveALink", getLocalPlayer( ), editT ) guiSetText( GUIEditor.edit[2], "" ) else outputChatBox( "Link no valido!", 255, 255, 255, true ) end elseif source == GUIEditor.button[4] then guiSetVisible( GUIEditor.window[1], false ) guiSetVisible( myLinksGUI, true ) guiGridListClear( mylinksGridlist ) triggerServerEvent ( "obtenerMisLnks", getLocalPlayer( ) ) elseif source == closeMyLinksGUI then guiSetVisible( GUIEditor.window[1], true ) guiSetVisible( myLinksGUI, false ) elseif source == copyurlbutton then local row, col = guiGridListGetSelectedItem( mylinksGridlist ) if row == -1 or col == -1 then outputChatBox( "Selecciona un Url!", 255, 255, 255, true ) return end local link = guiGridListGetItemText( mylinksGridlist, row, a ) setClipboard( link ) outputChatBox( "Url copiado al portapapeles!", 255, 255, 255, true ) elseif source == deleteurlbutton then local row, col = guiGridListGetSelectedItem( mylinksGridlist ) if row == -1 or col == -1 then outputChatBox( "Selecciona un Url!", 255, 255, 255, true ) return end local link = guiGridListGetItemText( mylinksGridlist, row, a ) triggerServerEvent ( "deleteALink", getLocalPlayer( ), link ) setTimer( function( ) guiGridListClear ( mylinksGridlist ) triggerServerEvent ( "obtenerMisLnks", getLocalPlayer( ) ) end , 250, 1 ) end end addEventHandler( "onClientGUIClick", getRootElement( ), clicksBotones ) function tipoRepro( ) local tipo if guiRadioButtonGetSelected( GUIEditor.radiobutton[1] ) == true then tipo = "radio" elseif guiRadioButtonGetSelected( GUIEditor.radiobutton[2] ) == true then tipo = "youtube" else tipo = "radio" end return tipo end function onVehicleExit( thePlayer ) if thePlayer == getLocalPlayer( ) then if guiGetVisible( GUIEditor.window[1] ) == true then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) end if guiGetVisible( myLinksGUI ) == true then guiSetVisible( myLinksGUI, false ) showCursor( false ) end end end addEventHandler( "onClientVehicleExit", getRootElement( ), onVehicleExit ) function playASound( tipo, link, vehicle ) if tipo == "radio" then elseif tipo == "youtube" then end end function stopASound( vehicle ) if radios[vehicle] then stopSound( radios[vehicle] ) radios[vehicle] = nil end end addEvent( "stopActualVehicleSound", true ) addEventHandler( "stopActualVehicleSound", getLocalPlayer( ), stopASound ) local timerTitle function playAsound( url, vehicle, volumne, nameArtist ) if radios[vehicle] then stopSound( radios[vehicle] ) radios[vehicle] = nil end local tipo = tipoRepro( ) local x, y, z = getElementPosition( vehicle ) local link = url radios[vehicle] = playSound3D( link, x, y, z, false ) if isTimer( timerTitle ) then killTimer ( timerTitle ) end timerTitle = setTimer( function( ) if radios[vehicle] then local meta = getSoundMetaTags(radios[vehicle]) if tipo == 'radio' then if meta.stream_title and meta.stream_name then if isTimer( timerTitle ) then killTimer ( timerTitle ) end outputChatBox( tostring( meta.stream_name ), 255, 255, 255 ) outputChatBox( tostring( meta.stream_title ), 0, 255, 0 ) end elseif tipo == "youtube" then if meta.title then if isTimer( timerTitle ) then killTimer ( timerTitle ) end outputChatBox( "Youtube MP3", 255, 255, 255 ) outputChatBox( tostring( nameArtist ), 0, 255, 0, true ) end end end end, 3000, 0 ) setSoundMaxDistance( radios[vehicle], 30 ) setSoundVolume( radios[vehicle], volumne ) attachElements( radios[vehicle], vehicle ) end addEvent( "playVehicleSound", true ) addEventHandler( "playVehicleSound", getLocalPlayer( ), playAsound ) function setSoundCar( veh, vol ) if radios[veh] then setSoundVolume( radios[veh], tonumber( vol ) ) end end addEvent( "setActualVehicleVolume", true ) addEventHandler( "setActualVehicleVolume", getLocalPlayer( ), setSoundCar ) function soundCarVolume( ) local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if getVehicleController( veh ) == getLocalPlayer( ) then if radios[veh] then local porciento = ( ( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) * 1.0 ) / 100 ) triggerServerEvent( "setVolumeCar", getLocalPlayer( ), veh, porciento ) end end guiSetText( porcientomusica, tostring( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) ).."%") end addEventHandler( "onClientGUIScroll", GUIEditor.scrollbar[1], soundCarVolume ) function saads( url, fecha ) local row = guiGridListAddRow( mylinksGridlist ) guiGridListSetItemText( mylinksGridlist, row, a, url, false, false ) guiGridListSetItemText( mylinksGridlist, row, b, fecha, false, false ) end addEvent( "addGridLinks", true ) addEventHandler( "addGridLinks", getLocalPlayer( ), saads ) if fileExists("client.lua") then fileDelete("client.lua") end server local db = dbConnect( "sqlite", "dbData_byRex.db" ) local vehiculos = { } function reproll( url, vehicle, volumne, tipe ) if not vehiculos[vehicle] then vehiculos[vehicle] = true else triggerClientEvent( getRootElement( ), "stopActualVehicleSound", getRootElement( ), vehicle ) end if tipe == "youtube" then url = "http://youtubeinmp3.com/fetch/?format=text&video="..url local f = fetchRemote ( url, myCallback, "", false, source, vehicle, volumne ) else triggerClientEvent( getRootElement( ), "playVehicleSound", getRootElement( ), url, vehicle, volumne ) end end addEvent( "reproducirLink", true ) addEventHandler( "reproducirLink", getRootElement( ), reproll ) function myCallback( responseData, errno, playerToReceive, vehicle, volumne ) if errno == 0 then local t = split ( responseData, " ") local buffer = "" for i=2, #t do if t ~= "<br/>Length:" then buffer = buffer..t.." " else break end end triggerClientEvent( getRootElement( ), "playVehicleSound", getRootElement( ), t[#t], vehicle, volumne, buffer ) end end function pararRadio( vehicle ) if vehiculos[vehicle] then vehiculos[vehicle] = false triggerClientEvent( getRootElement( ), "stopActualVehicleSound", getRootElement( ), vehicle ) outputChatBox( "Radio detenida!", source, 255, 255, 255, true ) else outputChatBox( "No se esta reproduciendo nada!", source, 255, 255, 255, true ) end end addEvent( "detenerRepro", true ) addEventHandler( "detenerRepro", getRootElement( ), pararRadio ) function volumeCarro( vehicle, vol ) if vehiculos[vehicle] then triggerClientEvent( getRootElement( ), "setActualVehicleVolume", getRootElement( ), vehicle, vol ) end end addEvent( "setVolumeCar", true ) addEventHandler( "setVolumeCar", getRootElement( ), volumeCarro ) function createRadioLinkssa( ) local qh = dbQuery( db,"CREATE TABLE IF NOT EXISTS radio_links ( serial STRING, theLink STRING, fecha STRING )") dbFree( qh ) outputDebugString( "Tabla de url's creada") end addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), createRadioLinkssa ) function saveALink( Url ) if not datoExistente( getPlayerSerial( source ), Url ) then local time = getRealTime( ) local date = tostring( time.monthday.."/"..( time.month +1 ).."/20"..( time.year - 100 ).." "..time.hour..":"..time.minute ) db:exec( "INSERT INTO radio_links ( serial, theLink, fecha ) VALUES(?,?,?)", getPlayerSerial( source ), tostring( Url ), date ) outputChatBox( "Link guardado!", source, 255, 255, 255, true ) else outputChatBox( "Ese link ya esta guardado!", source, 255, 255, 255, true ) end end addEvent( "saveALink", true ) addEventHandler( "saveALink", getRootElement( ), saveALink ) function datoExistente( serial, url ) local qh = db:query( "SELECT * FROM radio_links WHERE serial=?", tostring( serial ) ) for i, v in ipairs( dbPoll( qh, -1 ) ) do if v["theLink"] == url then return true end end return false end function obtenerMisLinks( ) local qh = db:query( "SELECT * FROM radio_links WHERE serial=?", tostring( getPlayerSerial( source ) ) ) for i, v in ipairs( dbPoll( qh, -1 ) ) do local url, Fecha = v["theLink"], v["fecha"] triggerClientEvent( source, "addGridLinks", source, url, Fecha ) end end addEvent( "obtenerMisLnks", true ) addEventHandler( "obtenerMisLnks", getRootElement( ), obtenerMisLinks ) function borrarUnLink( url ) if datoExistente ( getPlayerSerial( source ), url ) then db:exec( "DELETE FROM radio_links WHERE serial=? AND theLink=?", getPlayerSerial( source ), url ) outputChatBox( "Url Eliminado!", source, 255, 255, 255, true ) else outputChatBox( "Link no valido!", source, 255, 255, 255, true ) end end addEvent( "deleteALink", true ) addEventHandler( "deleteALink", getRootElement( ), borrarUnLink )
  3. I have this music script but it does not destroy the music when the vehicle is destroyed and how can I solve it? client function centerWindow (center_window) local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 guiSetPosition(center_window, x, y, false) end GUIEditor = { tab = {}, label = {}, tabpanel = {}, edit = {}, button = {}, window = {}, scrollbar = {}, radiobutton = {} } GUIEditor.window[1] = guiCreateWindow(500, 187, 378, 280, "Radio Vehicular", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 22, 358, 227, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Radio", GUIEditor.tabpanel[1]) GUIEditor.label[1] = guiCreateLabel(10, 10, 178, 16, "Ingresa una url:", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.edit[1] = guiCreateEdit(10, 31, 199, 26, "", false, GUIEditor.tab[1]) GUIEditor.radiobutton[1] = guiCreateRadioButton(20, 67, 18, 15, "", false, GUIEditor.tab[1]) GUIEditor.radiobutton[2] = guiCreateRadioButton(112, 69, 18, 15, "", false, GUIEditor.tab[1]) GUIEditor.label[2] = guiCreateLabel(44, 67, 60, 17, "Radio/Web", false, GUIEditor.tab[1]) GUIEditor.label[3] = guiCreateLabel(133, 67, 200, 17, "Youtube", false, GUIEditor.tab[1]) GUIEditor.button[1] = guiCreateButton(13, 97, 91, 28, "Reproducir", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.scrollbar[1] = guiCreateScrollBar(20, 161, 239, 22, true, false, GUIEditor.tab[1]) guiScrollBarSetScrollPosition(GUIEditor.scrollbar[1], 100.0) GUIEditor.label[4] = guiCreateLabel(10, 135, 178, 16, "Volumen:", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[4], "default-bold-small") porcientomusica = guiCreateLabel(67, 135, 86, 17, "0%", false, GUIEditor.tab[1]) GUIEditor.button[2] = guiCreateButton(114, 97, 91, 28, "Detener", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.tab[2] = guiCreateTab("Mis links", GUIEditor.tabpanel[1]) GUIEditor.label[5] = guiCreateLabel(10, 10, 138, 15, "Ingresa el url a guardar:", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.label[5], "default-bold-small") GUIEditor.edit[2] = guiCreateEdit(10, 31, 199, 26, "", false, GUIEditor.tab[2]) GUIEditor.button[3] = guiCreateButton(145, 67, 74, 28, "Guardar", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.button[3], "default-bold-small") guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(10, 67, 125, 28, "Ver links guardados", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.button[4], "default-bold-small") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA") closebutton = guiCreateButton(307, 249, 60, 24, "Cerrar", false, GUIEditor.window[1]) guiSetFont(closebutton, "default-bold-small") guiSetProperty(closebutton, "NormalTextColour", "FFAAAAAA") guiSetVisible( GUIEditor.window[1], false ) centerWindow ( GUIEditor.window[1] ) myLinksGUI = guiCreateWindow(378, 133, 503, 292, "Mis links", false) guiWindowSetSizable(myLinksGUI, false) mylinksGridlist = guiCreateGridList(9, 26, 485, 218, false, myLinksGUI) a = guiGridListAddColumn(mylinksGridlist, "Url", 0.5) b = guiGridListAddColumn(mylinksGridlist, "Fecha", 0.5) copyurlbutton = guiCreateButton(19, 254, 86, 29, "Copiar url", false, myLinksGUI) guiSetFont(copyurlbutton, "default-bold-small") guiSetProperty(copyurlbutton, "NormalTextColour", "FFAAAAAA") deleteurlbutton = guiCreateButton(115, 254, 86, 29, "Eliminar url", false, myLinksGUI) guiSetFont(deleteurlbutton, "default-bold-small") guiSetProperty(deleteurlbutton, "NormalTextColour", "FFAAAAAA") closeMyLinksGUI = guiCreateButton(211, 254, 86, 29, "Cerrar", false, myLinksGUI) guiSetFont(closeMyLinksGUI, "default-bold-small") guiSetProperty(closeMyLinksGUI, "NormalTextColour", "FFAAAAAA") guiSetVisible( myLinksGUI, false ) centerWindow ( myLinksGUI ) --guiSetEnabled( GUIEditor.radiobutton[2], false ) local radios = { } function openPanel( ) local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if isPedInVehicle( getLocalPlayer( ) ) and getVehicleController( veh ) == getLocalPlayer( ) then openMain( ) end end bindKey( "F5", "down", openPanel ) addCommandHandler( "radio", openPanel ) function openMain( ) if guiGetVisible( GUIEditor.window[1] ) == false then guiSetVisible( GUIEditor.window[1], true ) showCursor( true ) guiSetText( porcientomusica, tostring( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) ).."%") else guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) end end function clicksBotones( ) if source == GUIEditor.button[1] then if guiRadioButtonGetSelected( GUIEditor.radiobutton[1] ) == true or guiRadioButtonGetSelected( GUIEditor.radiobutton[2] ) == true then local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if getVehicleController( veh ) == getLocalPlayer( ) then local editT = guiGetText( GUIEditor.edit[1] ) if string.len( editT ) > 5 then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) triggerServerEvent ( "reproducirLink", getLocalPlayer( ), editT, veh, ( ( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) * 1.0 ) / 100 ), tipoRepro( ) ) else outputChatBox( "Link no valido!", 255, 255, 255, true ) end else outputChatBox( "Solo el conductor puede reproducir la radio!", 255, 255, 255, true ) end else outputChatBox( "Selecciona un tipo de url!", 255, 255, 255, true ) end elseif source == GUIEditor.button[2] then local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if getVehicleController( veh ) == getLocalPlayer( ) then triggerServerEvent ( "detenerRepro", getLocalPlayer( ), veh ) else outputChatBox( "Solo el conductor puede reproducir la radio!", 255, 255, 255, true ) end elseif source == closebutton then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) elseif source == GUIEditor.button[3] then local editT = guiGetText( GUIEditor.edit[2] ) if string.len( editT ) > 5 then triggerServerEvent ( "saveALink", getLocalPlayer( ), editT ) guiSetText( GUIEditor.edit[2], "" ) else outputChatBox( "Link no valido!", 255, 255, 255, true ) end elseif source == GUIEditor.button[4] then guiSetVisible( GUIEditor.window[1], false ) guiSetVisible( myLinksGUI, true ) guiGridListClear( mylinksGridlist ) triggerServerEvent ( "obtenerMisLnks", getLocalPlayer( ) ) elseif source == closeMyLinksGUI then guiSetVisible( GUIEditor.window[1], true ) guiSetVisible( myLinksGUI, false ) elseif source == copyurlbutton then local row, col = guiGridListGetSelectedItem( mylinksGridlist ) if row == -1 or col == -1 then outputChatBox( "Selecciona un Url!", 255, 255, 255, true ) return end local link = guiGridListGetItemText( mylinksGridlist, row, a ) setClipboard( link ) outputChatBox( "Url copiado al portapapeles!", 255, 255, 255, true ) elseif source == deleteurlbutton then local row, col = guiGridListGetSelectedItem( mylinksGridlist ) if row == -1 or col == -1 then outputChatBox( "Selecciona un Url!", 255, 255, 255, true ) return end local link = guiGridListGetItemText( mylinksGridlist, row, a ) triggerServerEvent ( "deleteALink", getLocalPlayer( ), link ) setTimer( function( ) guiGridListClear ( mylinksGridlist ) triggerServerEvent ( "obtenerMisLnks", getLocalPlayer( ) ) end , 250, 1 ) end end addEventHandler( "onClientGUIClick", getRootElement( ), clicksBotones ) function tipoRepro( ) local tipo if guiRadioButtonGetSelected( GUIEditor.radiobutton[1] ) == true then tipo = "radio" elseif guiRadioButtonGetSelected( GUIEditor.radiobutton[2] ) == true then tipo = "youtube" else tipo = "radio" end return tipo end function onVehicleExit( thePlayer ) if thePlayer == getLocalPlayer( ) then if guiGetVisible( GUIEditor.window[1] ) == true then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) end if guiGetVisible( myLinksGUI ) == true then guiSetVisible( myLinksGUI, false ) showCursor( false ) end end end addEventHandler( "onClientVehicleExit", getRootElement( ), onVehicleExit ) function playASound( tipo, link, vehicle ) if tipo == "radio" then elseif tipo == "youtube" then end end function stopASound( vehicle ) if radios[vehicle] then stopSound( radios[vehicle] ) radios[vehicle] = nil end end addEvent( "stopActualVehicleSound", true ) addEventHandler( "stopActualVehicleSound", getLocalPlayer( ), stopASound ) local timerTitle function playAsound( url, vehicle, volumne, nameArtist ) if radios[vehicle] then stopSound( radios[vehicle] ) radios[vehicle] = nil end local tipo = tipoRepro( ) local x, y, z = getElementPosition( vehicle ) local link = url radios[vehicle] = playSound3D( link, x, y, z, false ) if isTimer( timerTitle ) then killTimer ( timerTitle ) end timerTitle = setTimer( function( ) if radios[vehicle] then local meta = getSoundMetaTags(radios[vehicle]) if tipo == 'radio' then if meta.stream_title and meta.stream_name then if isTimer( timerTitle ) then killTimer ( timerTitle ) end outputChatBox( tostring( meta.stream_name ), 255, 255, 255 ) outputChatBox( tostring( meta.stream_title ), 0, 255, 0 ) end elseif tipo == "youtube" then if meta.title then if isTimer( timerTitle ) then killTimer ( timerTitle ) end outputChatBox( "Youtube MP3", 255, 255, 255 ) outputChatBox( tostring( nameArtist ), 0, 255, 0, true ) end end end end, 3000, 0 ) setSoundMaxDistance( radios[vehicle], 30 ) setSoundVolume( radios[vehicle], volumne ) attachElements( radios[vehicle], vehicle ) end addEvent( "playVehicleSound", true ) addEventHandler( "playVehicleSound", getLocalPlayer( ), playAsound ) function setSoundCar( veh, vol ) if radios[veh] then setSoundVolume( radios[veh], tonumber( vol ) ) end end addEvent( "setActualVehicleVolume", true ) addEventHandler( "setActualVehicleVolume", getLocalPlayer( ), setSoundCar ) function soundCarVolume( ) local veh = getPedOccupiedVehicle( getLocalPlayer( ) ) if getVehicleController( veh ) == getLocalPlayer( ) then if radios[veh] then local porciento = ( ( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) * 1.0 ) / 100 ) triggerServerEvent( "setVolumeCar", getLocalPlayer( ), veh, porciento ) end end guiSetText( porcientomusica, tostring( guiScrollBarGetScrollPosition ( GUIEditor.scrollbar[1] ) ).."%") end addEventHandler( "onClientGUIScroll", GUIEditor.scrollbar[1], soundCarVolume ) function saads( url, fecha ) local row = guiGridListAddRow( mylinksGridlist ) guiGridListSetItemText( mylinksGridlist, row, a, url, false, false ) guiGridListSetItemText( mylinksGridlist, row, b, fecha, false, false ) end addEvent( "addGridLinks", true ) addEventHandler( "addGridLinks", getLocalPlayer( ), saads ) if fileExists("client.lua") then fileDelete("client.lua") end server local db = dbConnect( "sqlite", "dbData_byRex.db" ) local vehiculos = { } function reproll( url, vehicle, volumne, tipe ) if not vehiculos[vehicle] then vehiculos[vehicle] = true else triggerClientEvent( getRootElement( ), "stopActualVehicleSound", getRootElement( ), vehicle ) end if tipe == "youtube" then url = "http://youtubeinmp3.com/fetch/?format=text&video="..url local f = fetchRemote ( url, myCallback, "", false, source, vehicle, volumne ) else triggerClientEvent( getRootElement( ), "playVehicleSound", getRootElement( ), url, vehicle, volumne ) end end addEvent( "reproducirLink", true ) addEventHandler( "reproducirLink", getRootElement( ), reproll ) function myCallback( responseData, errno, playerToReceive, vehicle, volumne ) if errno == 0 then local t = split ( responseData, " ") local buffer = "" for i=2, #t do if t ~= "<br/>Length:" then buffer = buffer..t.." " else break end end triggerClientEvent( getRootElement( ), "playVehicleSound", getRootElement( ), t[#t], vehicle, volumne, buffer ) end end function pararRadio( vehicle ) if vehiculos[vehicle] then vehiculos[vehicle] = false triggerClientEvent( getRootElement( ), "stopActualVehicleSound", getRootElement( ), vehicle ) outputChatBox( "Radio detenida!", source, 255, 255, 255, true ) else outputChatBox( "No se esta reproduciendo nada!", source, 255, 255, 255, true ) end end addEvent( "detenerRepro", true ) addEventHandler( "detenerRepro", getRootElement( ), pararRadio ) function volumeCarro( vehicle, vol ) if vehiculos[vehicle] then triggerClientEvent( getRootElement( ), "setActualVehicleVolume", getRootElement( ), vehicle, vol ) end end addEvent( "setVolumeCar", true ) addEventHandler( "setVolumeCar", getRootElement( ), volumeCarro ) function createRadioLinkssa( ) local qh = dbQuery( db,"CREATE TABLE IF NOT EXISTS radio_links ( serial STRING, theLink STRING, fecha STRING )") dbFree( qh ) outputDebugString( "Tabla de url's creada") end addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), createRadioLinkssa ) function saveALink( Url ) if not datoExistente( getPlayerSerial( source ), Url ) then local time = getRealTime( ) local date = tostring( time.monthday.."/"..( time.month +1 ).."/20"..( time.year - 100 ).." "..time.hour..":"..time.minute ) db:exec( "INSERT INTO radio_links ( serial, theLink, fecha ) VALUES(?,?,?)", getPlayerSerial( source ), tostring( Url ), date ) outputChatBox( "Link guardado!", source, 255, 255, 255, true ) else outputChatBox( "Ese link ya esta guardado!", source, 255, 255, 255, true ) end end addEvent( "saveALink", true ) addEventHandler( "saveALink", getRootElement( ), saveALink ) function datoExistente( serial, url ) local qh = db:query( "SELECT * FROM radio_links WHERE serial=?", tostring( serial ) ) for i, v in ipairs( dbPoll( qh, -1 ) ) do if v["theLink"] == url then return true end end return false end function obtenerMisLinks( ) local qh = db:query( "SELECT * FROM radio_links WHERE serial=?", tostring( getPlayerSerial( source ) ) ) for i, v in ipairs( dbPoll( qh, -1 ) ) do local url, Fecha = v["theLink"], v["fecha"] triggerClientEvent( source, "addGridLinks", source, url, Fecha ) end end addEvent( "obtenerMisLnks", true ) addEventHandler( "obtenerMisLnks", getRootElement( ), obtenerMisLinks ) function borrarUnLink( url ) if datoExistente ( getPlayerSerial( source ), url ) then db:exec( "DELETE FROM radio_links WHERE serial=? AND theLink=?", getPlayerSerial( source ), url ) outputChatBox( "Url Eliminado!", source, 255, 255, 255, true ) else outputChatBox( "Link no valido!", source, 255, 255, 255, true ) end end addEvent( "deleteALink", true ) addEventHandler( "deleteALink", getRootElement( ), borrarUnLink )
×
×
  • Create New...