READ THE RULES
0 Members and 2 Guests are viewing this topic.
botName = "CoD4Bot" -- The bots namedirectory = Core.GetPtokaXPath().."/scripts/Cod/" -- The location of the script Assosiated datafunction OpConnected(user) -- Opperator connects, do the same as any User UserConnected(user)endfunction RegConnected(user) -- Registered connects, do the same as any User UserConnected(user)endfunction UserConnected(user) AddUSC(user, "1 2", "CoD4 Servers", "<%[mynick]> !cod") -- Add the right click command endfunction AddUSC(user, mode, menu, cstr) -- Shortcut funtion for adding right click commands Core.SendToUser(user, "$UserCommand "..mode.." "..menu.."$"..cstr.."|")endfunction ChatArrival(user, data) if (string.sub(data, 1, 1) == "<" ) then data=string.sub(data, 1, string.len(data) -1) t = {} for k in string.gmatch(data, "%s+([^%s]+)") do table.insert(t, k) end -- The above takes the main chat message and converts it into the array 't' local validComment = false if t[1]=="!cod" then validComment = true cod(user,1) end if t[1]=="!cod4" then validComment = true cod(user,2) end if validComment then -- If a command was said then dont echo in main chat return true end end endfunction cod(user,adv) a,tempIPs = pcall(UpdateIps) if a then Ips = tempIPs else Ips = {} end checkIps() if adv==1 then text = "\n\n Current CoD4 Servers: "..#Servers.."\n\n" if #Servers < 1 then text = text.."None currently operational\n" else for key,value in pairs(Servers) do text = text.."["..key.."] "..Servers[key]["ip"].." - "..Servers[key]["serverName"] text = text.." - Players: "..Servers[key]["cPlayers"].."/"..Servers[key]["maxPlayers"].."\n" end end Core.SendPmToNick(user.sNick, botName, text) end if adv==2 then text = "\n\n Current CoD4 Servers: "..#Servers.."\n\n" if #Servers < 1 then text = text.."None currently operational\n" else for key,value in pairs(Servers) do text = text.."-["..key.."]-\n" text = text.."IP : "..Servers[key]["ip"].." \n" text = text.."Name : "..Servers[key]["serverName"].." \n" text = text.."Players : "..Servers[key]["cPlayers"].."/"..Servers[key]["maxPlayers"].."\n" text = text.."Map : "..Servers[key]["map"].." \n" text = text.."Gametype : "..Servers[key]["gameType"].." \n" text = text.."Hardcore : "..Servers[key]["hardCore"].." \n" text = text.."F-Fire : "..Servers[key]["friendlyFire"].." \n" text = text.."\n" end end Core.SendPmToNick(user.sNick, botName, text) endendfunction checkIps() Servers = {} for key,ip in pairs(Ips) do b,m = pcall(checkIP,ip) if b then if m == "ohi" then else table.insert(Servers, m) end end end endfunction checkIP(ip) io.input(directory..ip..".txt") local t = {} for line in io.lines() do table.insert(t, line) end io.input():close() if #t < 2 then return "ohi" end local m = {} local f = 1 for i = 1, string.len(t[2]) do if string.sub(t[2], i, i) == "\\" then f = f+1 else if m[f] then m[f] = m[f]..string.sub(t[2], i, i) else m[f] = ""..string.sub(t[2], i, i) end end end local gameType = "" local serverName = "" local map = "" local maxPlayers = 0 local cPlayers = 0 local hardCore = "No" local friendlyFire = "Disabled" for key,value in pairs(m) do if value == "ff" then friendlyFire = getFriendlyFire(m[key+1].."") end if value == "hostname" then serverName = m[key+1] end if value == "sv_maxclients" then maxPlayers = m[key+1] end if value == "mapname" then map = getMap(m[key+1]) end if value == "clients" then cPlayers = m[key+1] end if value == "hc" then hardCore = "Yes" end if value == "gametype" then gameType = getGameType(m[key+1]) end end entry = { ["serverName"] = serverName, ["ip"] = ip, ["gameType"] = gameType, ["map"] = map, ["maxPlayers"] = maxPlayers, ["cPlayers"] = cPlayers, ["hardCore"] = hardCore, ["friendlyFire"]=friendlyFire, } return entryendfunction getFriendlyFire(ff) if ff == "1" then return "Enabled" end if ff == "2" then return "Reflect" end if ff == "3" then return "Shared" end return ffendfunction getMap(map) if map == "mp_backlot" then return "Backlot" end if map == "mp_bloc" then return "Bloc" end if map == "mp_bog" then return "Bog" end if map == "mp_cargoship" then return "Wet Work" end if map == "mp_citystreets" then return "District" end if map == "mp_convoy" then return "Ambush" end if map == "mp_countdown" then return "Countdown" end if map == "mp_crash" then return "Crash" end if map == "mp_crossfire" then return "Crossfire" end if map == "mp_farm" then return "Downpour" end if map == "mp_overgrown" then return "Overgrown" end if map == "mp_pipeline" then return "Pipeline" end if map == "mp_shipment" then return "Shipment" end if map == "mp_showdown" then return "Showdown" end if map == "mp_strike" then return "Strike" end if map == "mp_vacant" then return "Vacant" end if map == "mp_crash_snow" then return "Winter Crash" end if map == "mp_broadcast" then return "Broadcast" end if map == "mp_creek" then return "Creek" end if map == "mp_killhouse" then return "Kill House" end if map == "mp_carentan" then return "Chinatown" end return mapendfunction getGameType(gameType) if gameType == "war" then gameType = "Team Deathmatch" end if gameType == "dm" then gameType = "Deathmatch" end if gameType == "dom" then gameType = "Domination" end if gameType == "koth" then gameType = "Headquarters" end if gameType == "sab" then gameType = "Sabotage" end if gameType == "sd" then gameType = "Search & Destroy" end return gameTypeendfunction UpdateIps() io.input(directory.."IPS.txt") tempIPs = {} for line in io.lines() do table.insert(tempIPs, line) end io.input():close() return tempIPsend
echo ˙˙˙˙getinfo | nc -u -w 1 %1 28960 >%1.txt
10.8.27.5210.8.26.22410.8.48.11110.8.33.10
import javax.swing.*;import java.io.IOException;public class main{ public static final String HEADER_TEXT = "CoD4 Updater"; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { GUI a = new GUI(); } }); } }
import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.ArrayList;import java.util.List;public class ReadFile { public static String[] readLines(String filename) throws IOException { FileReader fileReader = new FileReader(filename); BufferedReader bufferedReader = new BufferedReader(fileReader); List<String> lines = new ArrayList<String>(); String line = null; while ((line = bufferedReader.readLine()) != null) { lines.add(line); } bufferedReader.close(); return lines.toArray(new String[lines.size()]); }}
import javax.swing.*;import javax.swing.text.*;import java.awt.*;import java.awt.event.*;import java.io.*;import java.util.Scanner;public class GUI{ public JFrame frame; public GridBagConstraints a; private static String[] IP; public GUI() { frame = new JFrame(main.HEADER_TEXT); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLayout(new GridBagLayout()); a = new GridBagConstraints(); frame.add(new JPanel()); LoadIps(); Update(); start(); } private void start() { JLabel text = new JLabel("Working"); frame.add(text,a); frame.setVisible(true); int delay = 60000; //milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { Update(); } }; new Timer(delay, taskPerformer).start(); } private void Update() { for (int i = 0; i < IP.length; i++) { execute(IP[i]); } } private void LoadIps() { try { IP = ReadFile.readLines("IPS.txt"); } catch(IOException e){} } public static void execute(String ip) { try { Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("cod.bat "+ip); } catch (Throwable t) { t.printStackTrace(); } }}
˙˙˙˙infoResponse\protocol\6\hostname\TheKinkyMudkip.com\mapname\mp_farm\clients\11\sv_maxclients\24\gametype\war\pure\1\kc\1\hc\1\hw\2\mod\0\voice\1\pb\0
Thanks for the post. Some remarks:1) You can just redefine the OpConnected and RegConnected functions. Instead of [code]function OpConnected(user) -- Opperator connects, do the same as any User UserConnected(user)endfunction RegConnected(user) -- Registered connects, do the same as any User UserConnected(user)end
OpConnected = UserConnectedRegConnected = UserConnected
function ChatArrival(user, data) if (string.sub(data, 1, 1) == "<" ) then