-- -- Mass Control Module Source -- Version: 1.2 -- Author: Willy_Sunny -- Website: http://www.ts3chinese.com -- E-Mail: willy_sunny@ts3chinese.com -- require("ts3defs") require("ts3errors") -- -- Call these function from the TeamSpeak 3 client console via: /lua run -- Note the serverConnectionHandlerID of the current server is always passed. -- -- -- Run with "/lua run getMyChanID" -- -- Show the curren channel ID that you are in -- function getChannelID(serverConnectionHandlerID) -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end -- Get which channel we are in local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) if error ~= ts3errors.ERROR_ok then print("Error getting own channel: " .. error) return end ts3.printMessageToCurrentTab("Channel ID = [b][u]" .. myChannelID .. "[/u][/b]") end -- -- Run with "/lua run mm" -- -- Mass Mover Script (within currently subscribed channel) -- function mm(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end -- Get which channel we are in local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) if error ~= ts3errors.ERROR_ok then print("Error getting own channel: " .. error) return end local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end local password = "" if type(arg[1]) ~= "nil" then password = arg[1] ts3.printMessageToCurrentTab("[b][i]== Mass moving " .. #clients - 1 .. " visible clients (Using Password: " .. password .. " ) ==[/i][/b]") else ts3.printMessageToCurrentTab("[b][i]== Mass moving " .. #clients - 1 .. " ==[/i][/b]") end local counter = 0 for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestClientMove(serverConnectionHandlerID, clients[i], myChannelID, password) if error == ts3errors.ERROR_ok then counter = counter + 1 else clientName = "Error getting client name" end end end ts3.printMessageToCurrentTab("[b][i]== Successfully moved " .. counter .. " / " .. #clients - 1 .. " clients. ==[/i][/b]") end -- -- Run with "/lua run mp " -- -- Mass Poke Script (within currently subscribed channel) -- function mp(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end -- Get which channel we are in local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) if error ~= ts3errors.ERROR_ok then print("Error getting own channel: " .. error) return end local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end -- Process Argument message local argMsg = "" for i,v in ipairs(arg) do argMsg = argMsg .. tostring(v) .. " " end local counter = 0 ts3.printMessageToCurrentTab("[b][i]== Mass poking " .. #clients - 1 .. " visible clients ==[/i][/b]") for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestClientPoke(serverConnectionHandlerID, clients[i], argMsg) if error == ts3errors.ERROR_ok then counter = counter + 1 else print("Error poking client ID: " .. clients[i] .. "\n") end end end ts3.printMessageToCurrentTab("[b][i]== Successfully poked " .. counter .. "/" .. #clients - 1 .. " clients ==[/i][/b]") end -- -- Run with "/lua run mmsg " -- -- Mass Messaging Script (within currently subscribed channel) -- function mmsg(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end -- Get which channel we are in local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) if error ~= ts3errors.ERROR_ok then print("Error getting own channel: " .. error) return end local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end -- Process Argument message local argMsg = "" for i,v in ipairs(arg) do argMsg = argMsg .. tostring(v) .. " " end local counter = 0 ts3.printMessageToCurrentTab("[b][i]== Mass messaging " .. #clients - 1 .. " visible clients ==[/i][/b]") for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestSendPrivateTextMsg(serverConnectionHandlerID, argMsg, clients[i]) if error == ts3errors.ERROR_ok then counter = counter + 1 else print("Error messaging client ID: " .. clients[i] .. "\n") end end end ts3.printMessageToCurrentTab("[b][i]== Successfully messaged " .. counter .. "/" .. #clients - 1 .. " clients ==[/i][/b]") end -- -- Run with "/lua run mmp " -- -- Mass Message & Poke Script (within currently subscribed channel) -- function mmp(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end -- Get which channel we are in local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) if error ~= ts3errors.ERROR_ok then print("Error getting own channel: " .. error) return end ts3.printMessageToCurrentTab("Channel ID = " .. myChannelID .. ".") local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end -- Process Argument message local argMsg = "" for i,v in ipairs(arg) do argMsg = argMsg .. tostring(v) .. " " end local msgcounter = 0 local pokecounter = 0 ts3.printMessageToCurrentTab("[b][i]== Mass poking & messaging " .. #clients - 1 .. " visible clients ==[/i][/b]") for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestClientPoke(serverConnectionHandlerID, clients[i], argMsg) if error == ts3errors.ERROR_ok then pokecounter = pokecounter + 1 else print("Error poking client ID: " .. clients[i] .. "\n") end local error = ts3.requestSendPrivateTextMsg(serverConnectionHandlerID, argMsg, clients[i]) if error == ts3errors.ERROR_ok then msgcounter = msgcounter + 1 else print("Error messaging client ID: " .. clients[i] .. "\n") end end end ts3.printMessageToCurrentTab("[b][i]== Successfully poked " .. pokecounter .. "/" .. #clients - 1 .. " clients, and messaged " .. msgcounter .. "/" .. #clients - 1 .. " clients ==[/i][/b]") end -- -- Run with "/lua run gmm" -- -- Global Mass Mover Script (subscribe all possible channels before moving) -- function gmm(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end -- Get which channel we are in local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) if error ~= ts3errors.ERROR_ok then print("Error getting own channel: " .. error) return end ts3.printMessageToCurrentTab("Channel ID = " .. myChannelID .. ".") local error = ts3.requestChannelSubscribeAll(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error subscribing channel: " .. error) return end local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end local password = "" if type(arg[1]) ~= "nil" then password = arg[1] ts3.printMessageToCurrentTab("[b][i]== Mass moving " .. #clients - 1 .. " visible clients (Using Password: " .. password .. " ) ==[/i][/b]") else ts3.printMessageToCurrentTab("[b][i]== Mass moving " .. #clients - 1 .. " ==[/i][/b]") end local counter = 0 for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestClientMove(serverConnectionHandlerID, clients[i], myChannelID, password) if error == ts3errors.ERROR_ok then counter = counter + 1 else clientName = "Error getting client name" end end end ts3.printMessageToCurrentTab("[b][i]== Successfully moved " .. counter .. " / " .. #clients - 1 .. " clients. ==[/i][/b]") end -- -- Run with "/lua run gmp " -- -- Global Mass Poke Script (subscribe all possible channels before moving) -- function gmp(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end local error = ts3.requestChannelSubscribeAll(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error subscribing channel: " .. error) return end local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end -- Process Argument message local argMsg = "" for i,v in ipairs(arg) do argMsg = argMsg .. tostring(v) .. " " end local counter = 0 ts3.printMessageToCurrentTab("[b][i]== Mass poking " .. #clients - 1 .. " visible clients ==[/i][/b]") for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestClientPoke(serverConnectionHandlerID, clients[i], argMsg) if error == ts3errors.ERROR_ok then counter = counter + 1 else print("Error poking client ID: " .. clients[i] .. "\n") end end end ts3.printMessageToCurrentTab("[b][i]== Successfully poked " .. counter .. "/" .. #clients - 1 .. " clients ==[/i][/b]") end -- -- Run with "/lua run gmmsg " -- -- Global Mass Message Script (subscribe all possible channels before moving) -- function gmmsg(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end local error = ts3.requestChannelSubscribeAll(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error subscribing channel: " .. error) return end -- Get which channel we are in local myChannelID, error = ts3.getChannelOfClient(serverConnectionHandlerID, myClientID) if error ~= ts3errors.ERROR_ok then print("Error getting own channel: " .. error) return end local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end -- Process Argument message local argMsg = "" for i,v in ipairs(arg) do argMsg = argMsg .. tostring(v) .. " " end local counter = 0 ts3.printMessageToCurrentTab("[b][i]== Mass messaging " .. #clients - 1 .. " visible clients ==[/i][/b]") for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestSendPrivateTextMsg(serverConnectionHandlerID, argMsg, clients[i]) if error == ts3errors.ERROR_ok then counter = counter + 1 else print("Error messaging client ID: " .. clients[i] .. "\n") end end end ts3.printMessageToCurrentTab("[b][i]== Successfully messaged " .. counter .. "/" .. #clients - 1 .. " clients ==[/i][/b]") end -- -- Run with "/lua run gmmp " -- -- Global Mass Message & Poke Script (subscribe all possible channels before moving) -- function gmmp(serverConnectionHandlerID, ...) ts3.printMessageToCurrentTab("= [b][u]Mass Control Module Version 1.2 by [url=http://forum.teamspeak.com/showthread.php?t=57386]Willy_Sunny[/url][/u][/b] =") -- Get Self ID local myClientID, error = ts3.getClientID(serverConnectionHandlerID) if error ~= ts3errors.ERROR_ok then print("Error getting own client ID: " .. error) return end if myClientID == 0 then ts3.printMessageToCurrentTab("Not connected") return end local error = ts3.requestChannelSubscribeAll(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error subscribing channel: " .. error) return end local clients, error = ts3.getClientList(serverConnectionHandlerID) if error == ts3errors.ERROR_not_connected then ts3.printMessageToCurrentTab("Not connected") return elseif error ~= ts3errors.ERROR_ok then print("Error getting client list: " .. error) return end -- Process Argument message local argMsg = "" for i,v in ipairs(arg) do argMsg = argMsg .. tostring(v) .. " " end local msgcounter = 0 local pokecounter = 0 ts3.printMessageToCurrentTab("[b][i]== Mass poking & messaging " .. #clients - 1 .. " visible clients ==[/i][/b]") for i=1, #clients do if clients[i] ~= myClientID then local error = ts3.requestClientPoke(serverConnectionHandlerID, clients[i], argMsg) if error == ts3errors.ERROR_ok then pokecounter = pokecounter + 1 else print("Error poking client ID: " .. clients[i] .. "\n") end local error = ts3.requestSendPrivateTextMsg(serverConnectionHandlerID, argMsg, clients[i]) if error == ts3errors.ERROR_ok then msgcounter = msgcounter + 1 else print("Error messaging client ID: " .. clients[i] .. "\n") end end end ts3.printMessageToCurrentTab("[b][i]== Successfully poked " .. pokecounter .. "/" .. #clients - 1 .. " clients, and messaged " .. msgcounter .. "/" .. #clients - 1 .. " clients ==[/i][/b]") end