• 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!

[talkaction] for god. Show all players target..

raelpsf

Member
Joined
Jul 3, 2010
Messages
166
Reaction score
5
Hi, i need one script for show what the players are attacking.

If you say... !target, for eg., it show all players online, and what they are attacking..

For ex.

Player X [ip 0000000000] - Attacking demon
Player Noob [ ip 143295794574] Attacking rat
etc
etc

Tkx for you help..
 
too easy to be done ....

You can either right !showt ( to show all players and their target /p) or !show playername (will show this player's target and ip only)
LUA:
function onSay(cid, words, param, channel)
	local str = "-----------------------------\n          Online   \t\t\t\t\t\t   target\n      -----------------------------"
	if param =="" then
		for _,cid in ipairs(getPlayersOnline()) do 
			local ip =convertIntToIP(getPlayerIp(cid))
			local target = getCreatureTarget(cid) < 1 and "nothing" or getCreatureName(getCreatureTarget(cid))
			str = str.."\n        "..getCreatureName(cid) .. "["..ip.."] : attacking "..target
		end
		doPlayerSendTextMessage(cid,27,str)
	else 
		local player = param
		local playerr =  getPlayerByNameWildcard(player)
		if tonumber(player) then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"You need to enter a player name.") and true
		end
		if not playerr then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"Player ["..player.."] doesnt exist or is offline.") and true
		end
		local player_ip =convertIntToIP(getPlayerIp(playerr))
		local plyer_target = getCreatureTarget(playerr) < 1 and "nothing" or getCreatureName(getCreatureTarget(playerr))
		doPlayerSendTextMessage(cid,27,getCreatureName(playerr).."["..player_ip.."] : is attacking "..plyer_target)
	end
	return true
end

talkaction.xml
XML:
	<talkaction  words="!show" event="script" value="XXXX.lua"/>

in talkaction you put it
 
Last edited:
try that and tell me
LUA:
function onSay(cid, words, param, channel)
	local str = "--------------------------\n          Online   \t\t\t\t\t\t   target\n--------------------------\n"
	if param =="" then
		for _,cid in ipairs(getPlayersOnline()) do 
			local ip =convertIntToIP(getPlayerIp(cid))
			local target = getCreatureTarget(cid) < 1 and "nothing" or getCreatureName(getCreatureTarget(cid))
			str = str.."\n "..getCreatureName(cid) .. "["..ip.."] : attacking "..target
		end
		doShowTextDialog(cid, 6533, str)
	else 
		local player = param
		local playerr =  getPlayerByNameWildcard(player)
		if tonumber(player) then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"You need to enter a player name.") and true
		end
		if not playerr then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"Player ["..player.."] doesnt exist or is offline.") and true
		end
		local player_ip =convertIntToIP(getPlayerIp(playerr))
		local plyer_target = getCreatureTarget(playerr) < 1 and "nothing" or getCreatureName(getCreatureTarget(playerr))
		doPlayerSendTextMessage(cid,27,getCreatureName(playerr).."["..player_ip.."] : is attacking "..plyer_target)
	end
	return true
end
 
Hi

idk.. maibe if use a list command.. maybe it works in your script..

And tkx a lot man.. for your help...
 
Last edited:
try that and tell me
LUA:
function onSay(cid, words, param, channel)
	local str = "--------------------------\n          Online   \t\t\t\t\t\t   target\n--------------------------\n"
	if param =="" then
		for _,cid in ipairs(getPlayersOnline()) do 
			local ip =convertIntToIP(getPlayerIp(cid))
			local target = getCreatureTarget(cid) < 1 and "nothing" or getCreatureName(getCreatureTarget(cid))
			str = str.."\n "..getCreatureName(cid) .. "["..ip.."] : attacking "..target
		end
		doShowTextDialog(cid, 6533, str)
	else 
		local player = param
		local playerr =  getPlayerByNameWildcard(player)
		if tonumber(player) then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"You need to enter a player name.") and true
		end
		if not playerr then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"Player ["..player.."] doesnt exist or is offline.") and true
		end
		local player_ip =convertIntToIP(getPlayerIp(playerr))
		local plyer_target = getCreatureTarget(playerr) < 1 and "nothing" or getCreatureName(getCreatureTarget(playerr))
		doPlayerSendTextMessage(cid,27,getCreatureName(playerr).."["..player_ip.."] : is attacking "..plyer_target)
	end
	return true
end

This worked, but it is extremely difficult to read .. if you can do directly on the channel gets better.
 
LUA:
function onSay(cid, words, param, channel)
	local str = "##Online[Ip]: target\n"
	local i = #getPlayersOnline()
	local n = 1
	if param =="" then
		for _,cid in ipairs(getPlayersOnline()) do 
			local ip =convertIntToIP(getPlayerIp(cid))
			local target = getCreatureTarget(cid) < 1 and "nothing" or getCreatureName(getCreatureTarget(cid))
			str = str..""..getCreatureName(cid) .. "["..ip.."] : attacking "..target.."".. (n < i and ", " or ".")
			n = n + 1
		end
		doPlayerSendTextMessage(cid,27,str)
	else 
		local player = param
		local playerr =  getPlayerByNameWildcard(player)
		if tonumber(player) then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"You need to enter a player name.") and true
		end
		if not playerr then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"Player ["..player.."] doesnt exist or is offline.") and true
		end
		local player_ip =convertIntToIP(getPlayerIp(playerr))
		local plyer_target = getCreatureTarget(playerr) < 1 and "nothing" or getCreatureName(getCreatureTarget(playerr))
		doPlayerSendTextMessage(cid,27,getCreatureName(playerr).."["..player_ip.."] : is attacking "..plyer_target)
	end
	return true
end
 
Now, it show 10 players and 1 part of 11. ^^

I think do not show everything in the channel.. is a lot of information.. but np, i will use the book.. You alread help so much, i dont will bother more ^^... Tkx friend, has already helped me a lot.. :D Really.
 
Doggynub, post it, some msgs before.. ^^

try that and tell me
LUA:
function onSay(cid, words, param, channel)
	local str = "--------------------------\n          Online   \t\t\t\t\t\t   target\n--------------------------\n"
	if param =="" then
		for _,cid in ipairs(getPlayersOnline()) do 
			local ip =convertIntToIP(getPlayerIp(cid))
			local target = getCreatureTarget(cid) < 1 and "nothing" or getCreatureName(getCreatureTarget(cid))
			str = str.."\n "..getCreatureName(cid) .. "["..ip.."] : attacking "..target
		end
		doShowTextDialog(cid, 6533, str)
	else 
		local player = param
		local playerr =  getPlayerByNameWildcard(player)
		if tonumber(player) then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"You need to enter a player name.") and true
		end
		if not playerr then
			return doSendMagicEffect(getThingPos(cid),2) and doPlayerSendTextMessage(cid,18,"Player ["..player.."] doesnt exist or is offline.") and true
		end
		local player_ip =convertIntToIP(getPlayerIp(playerr))
		local plyer_target = getCreatureTarget(playerr) < 1 and "nothing" or getCreatureName(getCreatureTarget(playerr))
		doPlayerSendTextMessage(cid,27,getCreatureName(playerr).."["..player_ip.."] : is attacking "..plyer_target)
	end
	return true
end
 
Back
Top