Resource icon

Untagged Release Search and stream YouTube links

Status
Not open for further replies.

wavelengthzero

Active member
Joined
Feb 18, 2014
Messages
45
Reaction score
0
This is just a simple mod that lets you enter a command then YouTube link or song name to convert and begin streaming quickly.

For example you type "/fvrad martin garrix - animals" and it will search YouTube for that song, choose the closest match, convert and begin a stream.

If you don't find the song you typed you can type "/frad <YouTube Link>" and it will do the same, but getting the song you want will be definite.

Usage:
Code:
(These will convert to .ogg and stream from YouTube links)
/rad <URL> (Types /radio)
/vrad <URL> (Types /vradio)
/vrm <URL> (Types /vrmusic)
/vwa <URL> (Types /vwaudio)

(These will search the words you typed on YouTube, get the nearest match, convert to .ogg and stream)
/frad <song name> (Types /radio)
/fvrad <song name> (Types /vradio)
/fvrm <song name> (Types /vrmusic)
/fvwa <song name> (Types /vwaudio)

Here's the source so you can change the "say" commands to what you like for audio streams (Requires SAMPFUNCS to use and compile):
Code:
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP
0B34: samp register_client_command "rad" to_label @cmd1 
0B34: samp register_client_command "vrad" to_label @cmd2 
0B34: samp register_client_command "vrm" to_label @cmd3 
0B34: samp register_client_command "vwa" to_label @cmd4
0B34: samp register_client_command "frad" to_label @cmd5
0B34: samp register_client_command "fvrad" to_label @cmd6
0B34: samp register_client_command "fvwa" to_label @cmd7
0B34: samp register_client_command "fvrm" to_label @cmd8 
30@ = 0 

:Label
wait 0 
if or 
30@ == 1
30@ == 2
30@ == 3
30@ == 4
30@ == 5
30@ == 6
30@ == 7
30@ == 8  
else_jump @Label
SAMP.IsCommandTyped(1@) 
   
   if
   0AD4: 2@ = scan_string 1@ format "%s" 3@v  
   then
       if 30@ == 1
       then  
       say "/radio https:%c%c6t.pe%c?%s" 47 47 47 1@ 
       30@ = 0            
       end
       
       if 30@ == 2
       then
       say "/vradio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 3
       then
       say "/vrmusic https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 4
       then
       say "/vwaudio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 5
       then
       say "/radio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 6
       then
       say "/vradio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 7
       then
       say "/vwaudio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end    
       
       if 30@ == 8
       then
       say "/vrmusic https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end        
   else
   chatmsg "USAGE: /rad <URL>, /vrad <URL>, /vrm <URL>, /vwa <URL>" 6356832
   chatmsg "SEARCH YOUTUBE AND CONVERT: /frad (song name), /fvrad (song name), /fvrm (song name), /fvwa (song name)" 16736352
   30@ = 0
   end 
jump @Label  

:cmd1
30@ = 1 
SAMP.CmdRet

:cmd2
30@ = 2
SAMP.CmdRet

:cmd3
30@ = 3
SAMP.CmdRet

:cmd4
30@ = 4
SAMP.CmdRet

:cmd5
30@ = 5
SAMP.CmdRet

:cmd6
30@ = 6
SAMP.CmdRet

:cmd7
30@ = 7
SAMP.CmdRet

:cmd8
30@ = 8
SAMP.CmdRet


I apologize if it's not very good, it's my first release as I'm pretty new to cleo. Thanks to "monday" for help.

Known bugs:
- For songs longer than 10 minutes you may need to send the command again as the timeout in the SA:MP client for redirection is too low.
- /fvrad might not always select the correct song, but will usually 99% of the time
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Hi, since this is a release section you should add a compiled CLEO script as attachment too.
 

Kross

Active member
Joined
Dec 15, 2021
Messages
149
Reaction score
42
make it as .cs file and put it in attachments.
PHP:
{$CLEO .cs}
{$USE SAMPFUNCS}

//-------------MAIN---------------
0000: NOP
0B34: samp register_client_command "rad" to_label @cmd1
0B34: samp register_client_command "vrad" to_label @cmd2
0B34: samp register_client_command "vrm" to_label @cmd3
0B34: samp register_client_command "vwa" to_label @cmd4
0B34: samp register_client_command "frad" to_label @cmd5
0B34: samp register_client_command "fvrad" to_label @cmd6
0B34: samp register_client_command "fvwa" to_label @cmd7
0B34: samp register_client_command "fvrm" to_label @cmd8
30@ = 0

:Label
wait 0
if or
30@ == 1
30@ == 2
30@ == 3
30@ == 4
30@ == 5
30@ == 6
30@ == 7
30@ == 8 
else_jump @Label
SAMP.IsCommandTyped(1@)
  
   if
   0AD4: 2@ = scan_string 1@ format "%s" 3@v 
   then
       if 30@ == 1
       then 
       say "/radio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0           
       end
      
       if 30@ == 2
       then
       say "/vradio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
      
       if 30@ == 3
       then
       say "/vrmusic https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
      
       if 30@ == 4
       then
       say "/vwaudio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
      
       if 30@ == 5
       then
       say "/radio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end
      
       if 30@ == 6
       then
       say "/vradio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end
      
       if 30@ == 7
       then
       say "/vwaudio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end   
      
       if 30@ == 8
       then
       say "/vrmusic https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end       
   else
   chatmsg "USAGE: /rad <URL>, /vrad <URL>, /vrm <URL>, /vwa <URL>" 6356832
   chatmsg "SEARCH YOUTUBE AND CONVERT: /frad (song name), /fvrad (song name), /fvrm (song name), /fvwa (song name)" 16736352
   30@ = 0
   end
jump @Label 

:cmd1
30@ = 1
SAMP.CmdRet

:cmd2
30@ = 2
SAMP.CmdRet

:cmd3
30@ = 3
SAMP.CmdRet

:cmd4
30@ = 4
SAMP.CmdRet

:cmd5
30@ = 5
SAMP.CmdRet

:cmd6
30@ = 6
SAMP.CmdRet

:cmd7
30@ = 7
SAMP.CmdRet

:cmd8
30@ = 8
SAMP.CmdRet
 

Attachments

  • SaCYoutubeLinks.cs
    20.4 KB · Views: 30
Status
Not open for further replies.
Top