PtokaX forum

Development Section => Your Developing Problems => Topic started by: Quattro on 20 February, 2005, 00:36:38

Title: Need a little help with adjusting shoutcast script of madman :D
Post by: Quattro on 20 February, 2005, 00:36:38
what's wrong with this

Sorry not madman's script
sorry RabidWombat


#Code#


-- Shoutcast interface through PtokaX script

-- Author: RabidWombat

-- Requirements: the winamp source of the shoutcast server

-- is running on the hub server where this script is AND

-- you have installed Clever (a GREAT utility)

-- This is the version I downloaded for testing purposes

-- http://www.jukkis.net/clever/clever_2_98.zip

-- This is site for all offered versions:

-- http://www.jukkis.net/

--//Modded By Madman

--//Added !sc.song

--//Guide Added

--//More Stuff Added

--//Even More On Ubikk's Request ;p





--   Guide So You Can Add The Commands You Wish

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe prev"); --//Play Previous Song

--   execute(sCleverDir.."clever.exe alwaysontop"); --//Toggle Always On Top

--   execute(sCleverDir.."clever.exe pause"); --//Pauses

--   execute(sCleverDir.."clever.exe stop"); --//Stops

--   execute(sCleverDir.."clever.exe next"); --//Play Next Song

--   execute(sCleverDir.."clever.exe volup"); --//Increase The Volume

--   execute(sCleverDir.."clever.exe voldn"); --//Decrease The Volume

--   execute(sCleverDir.."clever.exe swshuffle"); --//Sets Shuffle On Off

--   execute(sCleverDir.."clever.exe swrepeat"); --//Sets Repet On Off

--   execute(sCleverDir.."clever.exe getshuffle > output.tmp"); --//Get Status on Shuffle

--   execute(sCleverDir.."clever.exe getrepeat > output.tmp"); --//Get Staus on Repeat

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe getinfo > output.tmp"); --//shows Info about the song

--   Example...

--   44kHz      128kbps      Channels:2

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe GETINFO > output.tmp"); --//shows Info about the song

-- Example...

--   044,128,2

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe prettyinfo > output.tmp"); --//Shows Pretty Info About The Song

--   Example..

--   Songname:   Ramp - The Logical Song (Original Mix)

--   Time:       04:22 of 06:57 (02:35 left)

--   Status:     Playing

--   Shuffle:    On

--   Repeat:     On

--   Playlist position 2 of 7 songs.

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe staus > output.tmp"); --//Shows Staus Of Winamp Ex. Play

--   execute(sCleverDir.."clever.exe songlength > output.tmp"); --//Total Length Of Song

--   execute(sCleverDir.."clever.exe timeleft > output.tmp"); --//Shows Timeleft

--   execute(sCleverDir.."clever.exe songtitle > output.tmp"); --//Shows The Song Title

--   execute(sCleverDir.."clever.exe visual"); --//Visualtion On Off

--   execute(sCleverDir.."clever.exe clear"); --//Clears The Playlist

--   execute(sCleverDir.."clever.exe playlist > output.tmp"); --//Show Playlist

--   execute(sCleverDir.."clever.exe play");    --//Start Play



--   if (strcmp(command, "play")==0) singleOpt(C_PLAY);

--   play        Play the song in playlist position

--   if (strcmp(command, "volume"    )==0) singleParam(C_SET_VOLUME);

--   volume      Set volume (0-255)





sCleverDir = "D:\\Program\\clever\\";

--// If other then C:\CLEVER you have to create C:\CLEVER mannuly...

--It's for the settings file

--Also rember to run the clever.exe fil first... you need to configure it =)

sBotName = "[Q.NL][Sec]Hub-Music";


BotEmail = "www.winamp.com"
 
BotSpeed = "Warpspeed"
 
BotTag = "<++ V:0.01,Music,Songs:3735>"
 
MyInfoString = "$MyINFO $ALL "..sBotName.." "..BotTag.."$ $"..BotSpeed..strchar( 1 ).."$"..BotEmail.."$"
 
 
 
function Main()
 
   frmHub:RegBot(sBotName)
 
   SendToAll(MyInfoString)
   
end

low = strlower;



sHelpOutput = "Commands\r\n";

sOpHelpOutput = "Op Commands\r\n";



--For ShoutCastSong

Msg = "The HubServer Is Playing" --Will show  "Msg songname"



function Main()

   tCommands = {

   --// 1 = Ops only...

   --// 0 = All

      [low("!SC.next")]    = { ShoutCastNext,   1,   "Play next song in playlist" },

      [low("!SC.prev")]    = { ShoutCastPrev,   1,   "Play prev song in playlist" },

      [low("!SC.playlist")]   = { ShoutCastPlayList,   0,   "Display Playlist" },

      [low("!SC.play")]   = { ShoutCastPlay,   1,   "Play" },

      [low("!SC.pause")]   = { ShoutCastPause,   1,   "Pause" },

      [low("!SC.stop")]   = { ShoutCastStop,   1,   "Stop" },

      [low("!SC.status")]   = { ShoutCastStatus,   0,   "Display Status" },

      [low("!SC.help")]   = { ShoutCastHelp,   0,   "Help Message" },

      [low("!SC.song")]   = { ShoutCastSong,   0,     "SongTitle"},

      [low("!SC.volup")]   = { ShoutCastVolUp,   1,   "Volume Up"},

      [low("!SC.voldn")]   = { ShoutCastVolDn,   1,   "Volume Down"},

      [low("!SC.playnr")]   = { ShoutCastPlayNr,1,   "Play nr X track"},

      [low("!SC.tracknr")]= { ShoutCastGetTrack,1,"Get current song's track number"},

      [low("!SC.vol")]   = { ShoutCastVol,   1,   "Set Volume 0-255"},

      [low("!SC.volhelp")]   = { ShoutCastVolHelp,   1,   "Volume Help"},

      [low("!SC.pretty")]   = { ShoutCastPretty,    1,   "Display Pretty info"},

--      [low("!SC.test")]   = { ShoutCastTest,   1,     "Test"},

--      [low("!SC.test2")]   = { ShoutCastTest2,   1,     "Test With Output.tmp"},

   };



   for sCmd, tCmd in tCommands do

      if(tCmd[2] == 1) then

         sOpHelpOutput = sOpHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";

      else

         sHelpOutput = sHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";

      end

   end



   frmHub:RegBot(sBotName);

end



function DataArrival(curUser, sData)

   local s, e, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");



   if(cmd == nil) then return 0; end

   cmd = strlower(cmd);



   --if(tCommands[cmd] and (tCommands[cmd][2] == 0 or (curUser.iProfile == 0))) then --//Masters Only

   if(tCommands[cmd] and (tCommands[cmd][2] == 0 or curUser.bOperator)) then --//Ops And Above

      curUser:SendData(sData);

      tCommands[cmd][1](curUser, args);

      return 1;

   end

end



function ShoutCastPretty(curUser)

   execute(sCleverDir.."clever.exe prettyinfo > output.tmp"); --//Shows Pretty Info About The Song

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      --curUser:SendData(sBotName, "\r\n"..line);

      SendToAll(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastVolUp(curUser)

   execute(sCleverDir.."clever.exe volup"); --//Increase The Volume

   curUser:SendData(sBotName, "Volume Increased")

end



function ShoutCastVol(curUser, args)

   if(args and tonumber(args)) then

      execute(sCleverDir.."clever.exe volume "..tonumber(args));

      curUser:SendData(sBotName, "Volume Set To " ..args)

   end

end



function ShoutCastVolDn(curUser)

   execute(sCleverDir.."clever.exe voldn"); --//Decrease The Volume

   curUser:SendData(sBotName, "Volume Decreased")

end



function ShoutCastVolHelp(curUser) --//Volume Help

   if(curUser.iProfile == 0) then

      curUser:SendPM(sBotName,"\r\nVolume Help\r\n"..

      "Write !sc.vol X\tX = Some Nr\n"..

      "The Text Bellow Show What A Nr Is In Volume %\r\n"..

      "10 = 3 %\r\n"..

      "20 = 7 %\r\n"..

      "30 = 11 %\r\n"..

      "40 = 15 %\r\n"..

      "50 = 19 %\r\n"..

      "60 = 23 %\r\n"..

      "70 = 27 %\r\n"..

      "80 = 31 %\r\n"..

      "90 = 35 %\r\n"..

      "100 = 39 %\r\n"..

      "110 = 43 %\r\n"..

      "120 = 47 %\r\n"..

      "130 = 50 %\r\n"..

      "140 = 54 %\r\n"..

      "150 = 58 %\r\n"..

      "160 = 62 %\r\n"..

      "170 = 66 %\r\n"..

      "180 = 70 %\r\n"..

      "190 = 74 %\r\n"..

      "200 = 78 %\r\n"..

      "210 = 82 %\r\n"..

      "220 = 86 %\r\n"..

      "230 = 90 %\r\n"..

      "240 = 94 %\r\n"..

      "250 = 98 %\r\n"..

      "255 = 100 %\r\n");

   end

end



function ShoutCastTest(curUser, args) --//For Testing

   if(args and tonumber(args)) then

      execute(sCleverDir.."clever.exe play "..tonumber(args));

   end

end



function ShoutCastTest2(curUser) --//For Testing

   execute(sCleverDir.."clever.exe -h > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastNext(curUser) --//Play Next Song

   execute(sCleverDir.."clever.exe next");

end



function ShoutCastPrev()

   execute(sCleverDir.."clever.exe prev"); --//Play Prev Song

end



function ShoutCastPlayNr(curUser, args)

   if(args and tonumber(args)) then

      execute(sCleverDir.."clever.exe play")

      execute(sCleverDir.."clever.exe play "..tonumber(args));

      execute(sCleverDir.."clever.exe songtitle > output.tmp");

      readfrom("output.tmp");

      local line = read("*a");

         if(line) then

            line = gsub(line, "\n", "");

         SendToOps(sBotName, curUser.sName.." has selected track "..tonumber(args).." [ "..line.." ]");

         end

   end

   readfrom();

end



function ShoutCastPlayList(curUser) --//Show Playlist

   execute(sCleverDir.."clever.exe playlist > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendPM(sBotName, "\r\n"..line);

   end

   readfrom();

end





function ShoutCastGetTrack(curUser) --//Get Track nr

   execute(sCleverDir.."clever.exe getplpos > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "");

      curUser:SendData(sBotName, "Current song's track number is: [ "..line.." ]");

   end

   readfrom();

end



function ShoutCastPlay()

   execute(sCleverDir.."clever.exe play"); --//Play

end



function ShoutCastPause()

   execute(sCleverDir.."clever.exe pause"); --//Pause

end



function ShoutCastStop()

   execute(sCleverDir.."clever.exe stop"); --//Stop

end



function ShoutCastStatus(curUser)

   execute(sCleverDir.."clever.exe status > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastSong(curUser) --//Playing Song
   execute(sCleverDir.."clever.exe songtitle > output.tmp")
   readfrom("output.tmp");
   local line = read("*a");
   if(line) then
      SendToAll(sBotName, Msg.." "..line);
   end
   readfrom();
end



function ShoutCastSongLength(curUser)

   execute(sCleverDir.."clever.exe songlength > output.tmp"); --//Total Length Of Song

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastTimeLeft(curUser)

   execute(sCleverDir.."clever.exe timeleft > output.tmp"); --//Shows Timeleft

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end





function ShoutCastHelp(curUser) --//Help

   curUser:SendData(sBotName, sHelpOutput);

   if(curUser.bOperator) then

   --if(curUser.iProfile == 0) then

      curUser:SendData(sBotName, sOpHelpOutput);

   end

end
Title:
Post by: bastya_elvtars on 20 February, 2005, 00:39:17
There is a script by Mutor that is MUCH better than this shoutcast script as it has no limitations. :)

http://www.plop.nl/ptokaxbots/Mutor/ShoutStats_1.0c.lua
Title:
Post by: Quattro on 20 February, 2005, 00:42:19
My problem is that it's not working as i want it to...
i have working version, but i wanted to add some myinfo to it, so i borrowed some code from another script and rewrote it to fit in...
i wanted to add a tag and stuff...
Title:
Post by: Quattro on 20 February, 2005, 00:44:09
QuoteOriginally posted by bastya_elvtars
There is a script by Mutor that is MUCH better than this shoutcast script as it has no limitations. :)

http://www.plop.nl/ptokaxbots/Mutor/ShoutStats_1.0c.lua

Seen it, but does it work for normal winamp too?
i run just winamp on my pc and i want to be able to post info on what i'm playing at my server...
Title:
Post by: Quattro on 20 February, 2005, 00:50:21
ultimatly i want to change this to a dch++ script
or maybe a plugin (sed? )  :D
Title:
Post by: Madman on 20 February, 2005, 01:31:10
sCleverDir = "D:\\Program\\clever\\";
--// If other then C:\CLEVER you have to create C:\CLEVER mannuly...
--It's for the settings file
--Also rember to run the clever.exe fil first... you need to configure it =)

sBotName = "-=Destruction=-";

BotEmail = "Email" --//Bots Email
BotSpeed = "Connection" --//The Connection Of The Bot
BotDescr = "Description" --//You Bots Description
BotTag = "" --// Example <++ V:0.668,M:A,H:0/0/1,S:0>
BotShare = 1024 * 1024
MyInfoString = "$MyINFO $ALL "..sBotName.." "..BotDescr.." "..BotTag.."$ $"..BotSpeed..strchar( 1 ).."$"..BotEmail.."$" ..BotShare.."$"

low = strlower;

sHelpOutput = "Commands\r\n";
sOpHelpOutput = "Op Commands\r\n";

--For ShoutCastSong
Msg = "The HubServer Is Playing" --Will show  "Msg songname"

function Main()
tCommands = {
--// 1 = Ops only...
--// 0 = All
[low("!SC.next")] = { ShoutCastNext, 1, "Play next song in playlist" },
[low("!SC.prev")] = { ShoutCastPrev, 1, "Play prev song in playlist" },
[low("!SC.playlist")] = { ShoutCastPlayList, 0, "Display Playlist" },
[low("!SC.play")] = { ShoutCastPlay, 1, "Play" },
[low("!SC.pause")] = { ShoutCastPause, 1, "Pause" },
[low("!SC.stop")] = { ShoutCastStop, 1, "Stop" },
[low("!SC.status")] = { ShoutCastStatus, 0, "Display Status" },
[low("!SC.help")] = { ShoutCastHelp, 0, "Help Message" },
[low("!SC.song")] = { ShoutCastSong, 0, "SongTitle"},
[low("!SC.volup")] = { ShoutCastVolUp, 1, "Volume Up"},
[low("!SC.voldn")] = { ShoutCastVolDn, 1, "Volume Down"},
[low("!SC.playnr")] = { ShoutCastPlayNr,1, "Play nr X track"},
[low("!SC.tracknr")]= { ShoutCastGetTrack,1,"Get current song's track number"},
[low("!SC.vol")] = { ShoutCastVol, 1, "Set Volume 0-255"},
[low("!SC.volhelp")] = { ShoutCastVolHelp, 1, "Volume Help"},
[low("!SC.pretty")] = { ShoutCastPretty, 1, "Display Pretty info"},
-- [low("!SC.test")] = { ShoutCastTest, 1, "Test"},
-- [low("!SC.test2")] = { ShoutCastTest2, 1, "Test With Output.tmp"},
};

for sCmd, tCmd in tCommands do
if(tCmd[2] == 1) then
sOpHelpOutput = sOpHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";
else
sHelpOutput = sHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";
end
end

frmHub:RegBot(sBotName);
SendToAll(MyInfoString)
end

Here You Go, The Problem With yours was that it had 2
function Main()

I had the same prob... ;p didn't see that the command are loaded in the main function...

 
--==BotShare==--
-- 1                   == 1 B
-- 1024                == 1 KB
-- 1024 * 1024             == 1 MB
-- 1024 * 1024 * 1024       == 1 GB
Title:
Post by: Quattro on 20 February, 2005, 01:55:10
Lot's of thanks :D Both Madman and  Pothead :D
Title:
Post by: Quattro on 21 February, 2005, 11:22:57
I'll post the working script in here :D

#Code#


-- Shoutcast interface through PtokaX script

-- Author: RabidWombat

-- Requirements: the winamp source of the shoutcast server

-- is running on the hub server where this script is AND

-- you have installed Clever (a GREAT utility)

-- This is the version I downloaded for testing purposes

-- http://www.jukkis.net/clever/clever_2_98.zip

-- This is site for all offered versions:

-- http://www.jukkis.net/

--//Modded By Madman

--//Added !sc.song

--//Guide Added

--//More Stuff Added

--//Even More On Ubikk's Request ;p

--//Further modded by Madman Quattro and Pothead

--//Added Myinfostring and some modifications... (thanks to Madman and Pothead)





--   Guide So You Can Add The Commands You Wish

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe prev"); --//Play Previous Song

--   execute(sCleverDir.."clever.exe alwaysontop"); --//Toggle Always On Top

--   execute(sCleverDir.."clever.exe pause"); --//Pauses

--   execute(sCleverDir.."clever.exe stop"); --//Stops

--   execute(sCleverDir.."clever.exe next"); --//Play Next Song

--   execute(sCleverDir.."clever.exe volup"); --//Increase The Volume

--   execute(sCleverDir.."clever.exe voldn"); --//Decrease The Volume

--   execute(sCleverDir.."clever.exe swshuffle"); --//Sets Shuffle On Off

--   execute(sCleverDir.."clever.exe swrepeat"); --//Sets Repet On Off

--   execute(sCleverDir.."clever.exe getshuffle > output.tmp"); --//Get Status on Shuffle

--   execute(sCleverDir.."clever.exe getrepeat > output.tmp"); --//Get Staus on Repeat

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe getinfo > output.tmp"); --//shows Info about the song

--   Example...

--   44kHz      128kbps      Channels:2

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe GETINFO > output.tmp"); --//shows Info about the song

-- Example...

--   044,128,2

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe prettyinfo > output.tmp"); --//Shows Pretty Info About The Song

--   Example..

--   Songname:   Ramp - The Logical Song (Original Mix)

--   Time:       04:22 of 06:57 (02:35 left)

--   Status:     Playing

--   Shuffle:    On

--   Repeat:     On

--   Playlist position 2 of 7 songs.

--------------------------------------------------------------------------------------

--   execute(sCleverDir.."clever.exe staus > output.tmp"); --//Shows Staus Of Winamp Ex. Play

--   execute(sCleverDir.."clever.exe songlength > output.tmp"); --//Total Length Of Song

--   execute(sCleverDir.."clever.exe timeleft > output.tmp"); --//Shows Timeleft

--   execute(sCleverDir.."clever.exe songtitle > output.tmp"); --//Shows The Song Title

--   execute(sCleverDir.."clever.exe visual"); --//Visualtion On Off

--   execute(sCleverDir.."clever.exe clear"); --//Clears The Playlist

--   execute(sCleverDir.."clever.exe playlist > output.tmp"); --//Show Playlist

--   execute(sCleverDir.."clever.exe play");    --//Start Play



--   if (strcmp(command, "play")==0) singleOpt(C_PLAY);

--   play        Play the song in playlist position

--   if (strcmp(command, "volume"    )==0) singleParam(C_SET_VOLUME);

--   volume      Set volume (0-255)





sCleverDir = "C:\\clever\\";

--// If other then C:\CLEVER you have to create C:\CLEVER mannuly...

--It's for the settings file

--Also rember to run the clever.exe fil first... you need to configure it =)



sBotName = "[Q.NL][Sec]Hub-Music";



BotEmail = "www.winamp.com" --//Bots Email

BotSpeed = "Warpspeed" --//The Connection Of The Bot

BotDescr = "Mod by Madman, Pothead, Quattro" --//Your Bots Description

BotTag = "<++ V:0.01,Music,Songs:3735>" --// Example <++ V:0.668,M:A,H:0/0/1,S:0>

BotShare = 18380421494

MyInfoString = "$MyINFO $ALL "..sBotName.." "..BotDescr.." "..BotTag.."$ $"..BotSpeed..strchar( 1 ).."$"..BotEmail.."$" ..BotShare.."$"



low = strlower;



sHelpOutput = "Commands\r\n";

sOpHelpOutput = "Op Commands\r\n";



--For ShoutCastSong

Msg = "The HubServer Is Playing" --Will show  "Msg songname"



function Main()

   tCommands = {

   --// 1 = Ops only...

   --// 0 = All

      [low("!SC.next")]    = { ShoutCastNext,   1,   "Play next song in playlist" },

      [low("!SC.prev")]    = { ShoutCastPrev,   1,   "Play prev song in playlist" },

      [low("!SC.playlist")]   = { ShoutCastPlayList,   1,   "Display Playlist" },

      [low("!SC.play")]   = { ShoutCastPlay,   1,   "Play" },

      [low("!SC.pause")]   = { ShoutCastPause,   1,   "Pause" },

      [low("!SC.stop")]   = { ShoutCastStop,   1,   "Stop" },

      [low("!SC.status")]   = { ShoutCastStatus,   0,   "Display Status" },

      [low("!SC.help")]   = { ShoutCastHelp,   1,   "Help Message" },

      [low("!SC.song")]   = { ShoutCastSong,   0,     "SongTitle"},

      [low("!SC.volup")]   = { ShoutCastVolUp,   1,   "Volume Up"},

      [low("!SC.voldn")]   = { ShoutCastVolDn,   1,   "Volume Down"},

      [low("!SC.playnr")]   = { ShoutCastPlayNr,1,   "Play nr X track"},

      [low("!SC.tracknr")]= { ShoutCastGetTrack,1,"Get current song's track number"},

      [low("!SC.vol")]   = { ShoutCastVol,   1,   "Set Volume 0-255"},

      [low("!SC.volhelp")]   = { ShoutCastVolHelp,   1,   "Volume Help"},

      [low("!SC.pretty")]   = { ShoutCastPretty,    1,   "Display Pretty info"},

--      [low("!SC.test")]   = { ShoutCastTest,   1,     "Test"},

--      [low("!SC.test2")]   = { ShoutCastTest2,   1,     "Test With Output.tmp"},

   };



   for sCmd, tCmd in tCommands do

      if(tCmd[2] == 1) then

         sOpHelpOutput = sOpHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";

      else

         sHelpOutput = sHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";

      end

   end



   frmHub:RegBot(sBotName);

   SendToAll(MyInfoString)

end



function DataArrival(curUser, sData)

   local s, e, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");



   if(cmd == nil) then return 0; end

   cmd = strlower(cmd);



   --if(tCommands[cmd] and (tCommands[cmd][2] == 0 or (curUser.iProfile == 0))) then --//Masters Only

   if(tCommands[cmd] and (tCommands[cmd][2] == 0 or curUser.bOperator)) then --//Ops And Above

      curUser:SendData(sData);

      tCommands[cmd][1](curUser, args);

      return 1;

   end

end



function ShoutCastPretty(curUser)

   execute(sCleverDir.."clever.exe prettyinfo > output.tmp"); --//Shows Pretty Info About The Song

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      --curUser:SendData(sBotName, "\r\n"..line);

      SendToAll(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastVolUp(curUser)

   execute(sCleverDir.."clever.exe volup"); --//Increase The Volume

   curUser:SendData(sBotName, "Volume Increased")

end



function ShoutCastVol(curUser, args)

   if(args and tonumber(args)) then

      execute(sCleverDir.."clever.exe volume "..tonumber(args));

      curUser:SendData(sBotName, "Volume Set To " ..args)

   end

end



function ShoutCastVolDn(curUser)

   execute(sCleverDir.."clever.exe voldn"); --//Decrease The Volume

   curUser:SendData(sBotName, "Volume Decreased")

end



function ShoutCastVolHelp(curUser) --//Volume Help

   if(curUser.iProfile == 0) then

      curUser:SendPM(sBotName,"\r\nVolume Help\r\n"..

      "Write !sc.vol X\tX = Some Nr\n"..

      "The Text Bellow Show What A Nr Is In Volume %\r\n"..

      "10 = 3 %\r\n"..

      "20 = 7 %\r\n"..

      "30 = 11 %\r\n"..

      "40 = 15 %\r\n"..

      "50 = 19 %\r\n"..

      "60 = 23 %\r\n"..

      "70 = 27 %\r\n"..

      "80 = 31 %\r\n"..

      "90 = 35 %\r\n"..

      "100 = 39 %\r\n"..

      "110 = 43 %\r\n"..

      "120 = 47 %\r\n"..

      "130 = 50 %\r\n"..

      "140 = 54 %\r\n"..

      "150 = 58 %\r\n"..

      "160 = 62 %\r\n"..

      "170 = 66 %\r\n"..

      "180 = 70 %\r\n"..

      "190 = 74 %\r\n"..

      "200 = 78 %\r\n"..

      "210 = 82 %\r\n"..

      "220 = 86 %\r\n"..

      "230 = 90 %\r\n"..

      "240 = 94 %\r\n"..

      "250 = 98 %\r\n"..

      "255 = 100 %\r\n");

   end

end



function ShoutCastTest(curUser, args) --//For Testing

   if(args and tonumber(args)) then

      execute(sCleverDir.."clever.exe play "..tonumber(args));

   end

end



function ShoutCastTest2(curUser) --//For Testing

   execute(sCleverDir.."clever.exe -h > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastNext(curUser) --//Play Next Song

   execute(sCleverDir.."clever.exe next");

end



function ShoutCastPrev()

   execute(sCleverDir.."clever.exe prev"); --//Play Prev Song

end



function ShoutCastPlayNr(curUser, args)

   if(args and tonumber(args)) then

      execute(sCleverDir.."clever.exe play")

      execute(sCleverDir.."clever.exe play "..tonumber(args));

      execute(sCleverDir.."clever.exe songtitle > output.tmp");

      readfrom("output.tmp");

      local line = read("*a");

         if(line) then

            line = gsub(line, "\n", "");

         SendToOps(sBotName, curUser.sName.." has selected track "..tonumber(args).." [ "..line.." ]");

         end

   end

   readfrom();

end



function ShoutCastPlayList(curUser) --//Show Playlist

   execute(sCleverDir.."clever.exe playlist > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendPM(sBotName, "\r\n"..line);

   end

   readfrom();

end





function ShoutCastGetTrack(curUser) --//Get Track nr

   execute(sCleverDir.."clever.exe getplpos > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "");

      curUser:SendData(sBotName, "Current song's track number is: [ "..line.." ]");

   end

   readfrom();

end



function ShoutCastPlay()

   execute(sCleverDir.."clever.exe play"); --//Play

end



function ShoutCastPause()

   execute(sCleverDir.."clever.exe pause"); --//Pause

end



function ShoutCastStop()

   execute(sCleverDir.."clever.exe stop"); --//Stop

end



function ShoutCastStatus(curUser)

   execute(sCleverDir.."clever.exe status > output.tmp");

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastSong(curUser) --//Playing Song
   execute(sCleverDir.."clever.exe songtitle > output.tmp")
   readfrom("output.tmp");
   local line = read("*a");
   if(line) then
      SendToAll(sBotName, Msg.." "..line);
   end
   readfrom();
end



function ShoutCastSongLength(curUser)

   execute(sCleverDir.."clever.exe songlength > output.tmp"); --//Total Length Of Song

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end



function ShoutCastTimeLeft(curUser)

   execute(sCleverDir.."clever.exe timeleft > output.tmp"); --//Shows Timeleft

   readfrom("output.tmp");

   local line = read("*a");

   if(line) then

      line = gsub(line, "\n", "\r\n");

      curUser:SendData(sBotName, "\r\n"..line);

   end

   readfrom();

end





function ShoutCastHelp(curUser) --//Help

   curUser:SendData(sBotName, sHelpOutput);

   if(curUser.bOperator) then

   --if(curUser.iProfile == 0) then

      curUser:SendData(sBotName, sOpHelpOutput);

   end

end



Have fun with it
Title:
Post by: Quattro on 21 February, 2005, 14:48:16
Btw i would like to further modify it by introducing robocop profiles in it..
I've seen a script that was changed to support  RC profiles but that was some time ago, dunno which it was  ?(  ?(
Title: clues... not a finsihed script... =)
Post by: Madman on 21 February, 2005, 17:04:29
Since you are trying to learn i wont post my working version of the script...
I'll give u this tho...

The Table witch defines witch profiles witch are aloowed to do the op commands
AllowedProfiles = {
--//Set To 1 To Allow Profiles To Use The Op Commands
[0] = 1,   -- Masters
[1] = 0,   -- Operators
[2] = 0,   -- Vips
[3] = 0,   -- Regs
[4] = 0,   -- Moderator
[5] = 1,   -- NetFounder
[-1] = 0,  -- Users(unregged)
}

and what to do... it is really simple... =)
just replace
curUser.bOperator
with
AllowedProfiles[curUser.iProfile] == 1

*Edit*

Pm me in United Ops and i'll help you with the MyInfo Spam you talked about....
Title:
Post by: Madman on 21 February, 2005, 22:41:20
Here is the changes you wanted =)

The commands for each profile is untested
So i dont know if the Ops still can do what the Netfounder can do...
But atlest the help works as it should... =)
Let me know if you find any bugs....

Quote--//Added A Switch For The Tag
--//Added AllowedProfiles
--//Removed AllowedProfiles
--//Request By Quattro
--//Added RoboCop Profiles Support, The Higer Profile, More Commands

http://destruction.myftp.org/filer/Lua/Lua4/shoutcast.lua