• 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 [TFS 0.2]Show list of players with same IP (offline and online)

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,968
Solutions
99
Reaction score
3,384
Location
Poland
GitHub
gesior
TESTED on TFS 0.2pl23 with mysql database
it's modified deathlist.lua script

Add new talkaction and in script paste:
PHP:
dofile("./config.lua")

function onSay(cid, words, param)
	if sqlType == "mysql" then
		env = assert(luasql.mysql())
		con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
	else -- sqlite
		env = assert(luasql.sqlite3())
		con = assert(env:connect(sqliteDatabase))
	end
	local players = 0
	for id, name, lastip in rows(con, "SELECT `id`,`name`,`lastip` FROM `players` WHERE `lastip`=(SELECT `lastip` FROM `players` WHERE `name`='" .. escapeString(param) .. "') AND `lastip` > 0;") do
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, id .. " - " .. name)
		players = players + 1
	end
	if players == 0 then
		doPlayerSendCancel(cid, "A player with that name does not exist or never logged in.")
	end
	con:close()
	env:close()
end
It show list like (player id - name):
18:52 2 - GM Jony
18:52 28 - Speedy
18:52 29 - Maniek
18:52 3184 - Tinki Winki
18:52 3775 - Lala
18:52 4792 - Sir Black
 
Last edited:
Change:

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, id .. " - " .. name)

to:

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, lastip .. " - " .. name)

I guess that will make it view the ip address instead of the player id.
 
Back
Top