• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction /mc for servers with many MCs (warots/trainers)

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,980
Solutions
100
Reaction score
3,425
Location
Poland
GitHub
gesior
It's modified tfs 0.3.5pl1 function.
You can say /mc (show all MCs) or /mc Nick of Player (show Nick of Player MCs) or /mc 1.2.3.4 (show IP 1.2.3.4 MCs).
Target = 0 or nick of attacked creature.
Normal list:
/mc
11:11 Currently online players with same IP address(es):
11:11 Iza (94.40.88.34)
11:11 Chemia (94.40.88.34)
11:11 Magic For You (83.21.30.18)
11:11 Lord Michas (83.21.30.18)
11:11 Piatek (80.50.235.70)
11:11 Mot (88.220.68.136)
11:11 Prycydlo (89.78.14.152)
11:11 Bambusbrd (82.160.58.90)
11:11 Lola (88.220.68.136)
11:11 Nieogar Pro (85.89.191.29)
11:11 Lolo Dziewica (91.146.224.9)
11:11 Demetron (91.146.224.9)
11:11 Papirus Xd (91.146.224.9)
...
My version:
/mc
11:39 3 players with IP address (1189818960 / 80.50.235.70):
11:39 Dawcio (level: 90 | target: 0)
11:39 Magisterek (level: 100 | target: 0)
11:39 Piatek (level: 95 | target: 0)

11:39 2 players with IP address (1109792083 / 83.21.38.66):
11:39 Lord Michas (level: 82 | target: Aretsa For Real)
11:39 Magic For You (level: 70 | target: Aretsa For Real)

11:39 2 players with IP address (147624539 / 91.146.204.8):
11:39 Toshiro (level: 128 | target: Tomek Is Back Bitches)
11:39 Ycasta (level: 148 | target: 0)

11:39 4 players with IP address (165712475 / 91.146.224.9):
11:39 Brana (level: 100 | target: 0)
11:39 Papirus Xd (level: 79 | target: 0)
11:39 Lolo Dziewica (level: 81 | target: 0)
11:39 Demetron (level: 78 | target: 0)

11:39 2 players with IP address (69401933 / 77.253.34.4):
11:39 Hejo (level: 70 | target: 0)
11:39 Kniniininn (level: 70 | target: 0)

...
in your data/talkactions/scripts/multicheck.lua remove all and paste:
PHP:
function onSay(cid, words, param, channel)
	local _ip = nil
	if(param ~= nil) then
		_ip = tonumber(param)
		if(not _ip or _ip == 0) then
			local revertIp = doRevertIp(param)
			if(not revertIp) then
				local tid = getPlayerByNameWildcard(param)
				if(not tid) then
					_ip = nil
				else
					_ip = getPlayerIp(tid)
				end
			else
				_ip = doConvertIpToInteger(revertIp)
			end
		end
	end

	local ips = {}
	local players = getPlayersOnline()
	for i, pid in ipairs(players) do
		local ip = getPlayerIp(pid)
		if(not _ip or _ip == ip) then
			if(ips[ip] == nil) then
				ips[ip] = {pid}
			else
				table.insert(ips[ip], pid)
			end
		end
	end

	for ip, players in pairs(ips) do
		if(#players > 1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #players .. " players with IP address ( " .. ip .. " / " .. doConvertIntegerToIp(ip) .. " ):")
			for i, pid in pairs(players) do
				local target = getCreatureTarget(pid)
				if(target ~= 0) then
					target = getCreatureName(target)
				end
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " (level: " .. getPlayerLevel(pid) .. " | target: " .. target .. ")")
			end
		end
	end
	return TRUE
end
If you use TFS 0.3.4pl2 or older version and in console is error with 'doRevertIp' or 'attempt to index local str':
Paste it above 'function onSay(cid...)':
PHP:
function doRevertIp(str)
	local i, ip = 4, {}
	for b in string.gmatch(str, "(%d+).?") do
		ip[i] = b
		i = i - 1
	end

	if(not ip[1] or not ip[2] or not ip[3] or not ip[4]) then
		return nil
	end

	return ip[1] .. "." .. ip[2] .. "." .. ip[3] .. "." .. ip[4]
end
 
Last edited:
if MCs > 0
.
.
.
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"No have.")



*Would not be better?
 
if MCs > 0
.
.
.
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"No have.")



*Would not be better?

Lua:
function onSay(cid, words, param, channel)
    local _ip = nil
    if(param ~= nil) then
        _ip = tonumber(param)
        if(not _ip or _ip == 0) then
            local revertIp = doRevertIp(param)
            if(not revertIp) then
                local tid = getPlayerByNameWildcard(param)
                if(not tid) then
                    _ip = nil
                else
                    _ip = getPlayerIp(tid)
                end
            else
                _ip = doConvertIpToInteger(revertIp)
            end
        end
    end

    local ips = {}
    local players = getPlayersOnline()
    for i, pid in ipairs(players) do
        local ip = getPlayerIp(pid)
        if(not _ip or _ip == ip) then
            if(ips[ip] == nil) then
                ips[ip] = {pid}
            else
                table.insert(ips[ip], pid)
            end
        end
    end

    for ip, players in pairs(ips) do
        if(#players > 1) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #players .. " players with IP address ( " .. ip .. " / " .. doConvertIntegerToIp(ip) .. " ):")
            for i, pid in pairs(players) do
                local target = getCreatureTarget(pid)
                if(target ~= 0) then
                    target = getCreatureName(target)
		end
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " (level: " .. getPlayerLevel(pid) .. " | target: " .. target .. ")")
end
                      else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Currently there aren't any players with same IP address(es).")
        end
    end
    return TRUE
end
 
Lua:
function onSay(cid, words, param, channel)
    local _ip = nil
    if(param ~= nil) then
        _ip = tonumber(param)
        if(not _ip or _ip == 0) then
            local revertIp = doRevertIp(param)
            if(not revertIp) then
                local tid = getPlayerByNameWildcard(param)
                if(not tid) then
                    _ip = nil
                else
                    _ip = getPlayerIp(tid)
                end
            else
                _ip = doConvertIpToInteger(revertIp)
            end
        end
    end

    local ips = {}
    local players = getPlayersOnline()
    for i, pid in ipairs(players) do
        local ip = getPlayerIp(pid)
        if(not _ip or _ip == ip) then
            if(ips[ip] == nil) then
                ips[ip] = {pid}
            else
                table.insert(ips[ip], pid)
            end
        end
    end

    for ip, players in pairs(ips) do
        if(#players > 1) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, #players .. " players with IP address ( " .. ip .. " / " .. doConvertIntegerToIp(ip) .. " ):")
            for i, pid in pairs(players) do
                local target = getCreatureTarget(pid)
                if(target ~= 0) then
                    target = getCreatureName(target)
		end
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " (level: " .. getPlayerLevel(pid) .. " | target: " .. target .. ")")
end
                      else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Currently there aren't any players with same IP address(es).")
        end
    end
    return TRUE
end

You can't put else on for-loop :)
 
Back
Top