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

Problems with talkactions !frags and !bless

wickedd

Member
Joined
Oct 14, 2011
Messages
251
Solutions
1
Reaction score
23
Location
US
srry not bless

this is my frags lua
LUA:
local config = {
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')),
	advancedFragList = getBooleanFromString(getConfigValue('advancedFragList'))
}

function onSay(cid, words, param, channel)
	if(not config.useFragHandler) then
		return false
	end

	local time = os.time()
	local times = {today = (time - 86400), week = (time - (7 * 86400))}

	local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
	if(result:getID() ~= -1) then
		repeat
			local content = {
				name = result:getDataString("name"),
				level = result:getDataInt("level"),
				date = result:getDataInt("date")
			}
			if(content.date > times.today) then
				table.insert(contents.day, content)
			elseif(content.date > times.week) then
				table.insert(contents.week, content)
			else
				table.insert(contents.month, content)
			end
		until not result:next()
		result:free()
	end

	local size = {
		day = table.maxn(contents.day),
		week = table.maxn(contents.week),
		month = table.maxn(contents.month)
	}
	if(config.advancedFragList) then
		local result = "Frags  today(6 kills is red, 10 is black): " .. size.day .. "."
		if(size.day > 0) then
			for _, content in ipairs(contents.day) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags this week(30 red, 50 black): " .. (size.day + size.week) .. "."
		if(size.week > 0) then
			for _, content in ipairs(contents.week) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		result = result .. "\nFrags this month(100 red, 200 black): " .. (size.day + size.week + size.month) .. "."
		if(size.month > 0) then
			for _, content in ipairs(contents.month) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end

			result = result .. "\n"
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
		end

		doPlayerPopupFYI(cid, result)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today (6 kills to red), " .. (size.day + size.week) .. " this week (30 kills to red) and " .. (size.day + size.week + size.month) .. " this month (100 kills.")
		if(size.day > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
		end

		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd))
		end
	end

	return true
end
but it wont work, ive tried many different things but cant get it
my serv says
LUA:
Lua Script Error : [Test Interface]
data/talkactions/scripts/frags.lua
data/talkactions/scripts/frags.lua:2: attempt to call global 'getConfigValue' (a nil value)
stack traceback:
       [C]: in function 'getConfigValue'
       data/talkactions/scripts/frags.lua:2: in main chunk
Warning: [Event::checkScript] Can not load script. /scripts/frags.lua
Halllpp plxx
 
lool weird cuz i just did that lol but now instead of that it says "attempt to call global 'getBooleanFromString'
 
It should work without getBooleanFromString

LUA:
local config = {
	useFragHandler = getConfigInfo('useFragHandler'),
	advancedFragList = getConfigInfo('advancedFragList')
}
 
function onSay(cid, words, param, channel)
	if(not config.useFragHandler) then
		return false
	end
 
	local time = os.time()
	local times = {today = (time - 86400), week = (time - (7 * 86400))}
 
	local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
	if(result:getID() ~= -1) then
		repeat
			local content = {
				name = result:getDataString("name"),
				level = result:getDataInt("level"),
				date = result:getDataInt("date")
			}
			if(content.date > times.today) then
				table.insert(contents.day, content)
			elseif(content.date > times.week) then
				table.insert(contents.week, content)
			else
				table.insert(contents.month, content)
			end
		until not result:next()
		result:free()
	end
 
	local size = {
		day = table.maxn(contents.day),
		week = table.maxn(contents.week),
		month = table.maxn(contents.month)
	}
	if(config.advancedFragList) then
		local result = "Frags  today(6 kills is red, 10 is black): " .. size.day .. "."
		if(size.day > 0) then
			for _, content in ipairs(contents.day) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end
 
			result = result .. "\n"
		end
 
		result = result .. "\nFrags this week(30 red, 50 black): " .. (size.day + size.week) .. "."
		if(size.week > 0) then
			for _, content in ipairs(contents.week) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end
 
			result = result .. "\n"
		end
 
		result = result .. "\nFrags this month(100 red, 200 black): " .. (size.day + size.week + size.month) .. "."
		if(size.month > 0) then
			for _, content in ipairs(contents.month) do
				result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
			end
 
			result = result .. "\n"
		end
 
		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
		end
 
		doPlayerPopupFYI(cid, result)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today (6 kills to red), " .. (size.day + size.week) .. " this week (30 kills to red) and " .. (size.day + size.week + size.month) .. " this month (100 kills.")
		if(size.day > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
		end
 
		local skullEnd = getPlayerSkullEnd(cid)
		if(skullEnd > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd))
		end
	end
 
	return true
end
 
I took it for a quick test on my server, it works. What server are you running on? I'm guessing you're missing a couple of functions, if not, the code above should work.

And you have this in talkactions.xml right?

Code:
	<talkaction words="!frags" event="script" value="frags.lua"/>
 
well i dont know like revision it is or whataver but the client version 9.54
and yeah ihave that in talkactions
 
If you dont have getConfigValue & getBooleanFromString you're missing functions from TFS, that's about how much I know. Cant help much further as I'm quite new myself to the whole OpenTibia-world.

Try checking config.lua for useFragHandler, if that doesn't work download the TFS functions.
 
getConfigValue works and i put useFragHandler = true into my config.lua. now theres a buncha problems with the database getting the players death and its killer, im trying to fix it atm but im not good at scripting. i took this script from a 8.6 server thats why so many problems.
but do you know where i can download TFS functions?
 
i already have a 8.6 server. where would i find thee umm..like getBooleanFromString?
andd the only thing wrong with it now is the functions? i think they are like ^ and it says it cant do 'getPlayerSkullEnd'
btwww thankss for all the help i really appreciate it lol usually i see forums where people keep having trouble n after a bit they just get ignored lol
 
Last edited:
I figured out half of it. I need you to tell me how i can move the TFS functions from a 8.6 server to mine.. like where i can find them......and if i can get that working right then i probably will have fixed everything
the only problem now is this
LUA:
data/talkactions/scripts/frags.lua:66: attempt to call global value 'getPlayerSkullEnd' (a nil value)
 
Not so sure how to export functions, most of them are declared in data/lib though, replacing them with yours should work.
getPlayerSkullEnd = getCreateSkull
Test using getCreatureSkull instead of getPlayerSkullEnd
 
This one doesnt even have data/lib lol... not sure if you meant 'getCreateSkull' or 'getCreatureSkull' but i tried them both and neither worked
 
oh yeah, sorry, I meant getCreatureSkull, yet again works for me :p

make a lib folder then and paste in everything there.

Question, do you have lua5.1.dll? idk if that's it ( I have no idea what it does myself, but could be ) >.<
 
umm i guess i have lua51.dll but no dot between 5 and 1
oh and do i have to do anything to make the lib folder work?
or it does that by itself
 
it does it by itself, just restart server after. I couldn't run my server without lua5.1.dll so it's strange you dont have it. ( currently I use both, lua51.dll and lua5.1.dll ), I just renamed lua51.dll to lua5.1.dll
 
yeah i restarted it after i added the lib. nothing changed though :/ and are lua51.dll and lua5.1.dll the same thing?

alsooo i have 2 more problems if youd be nice enough to help with those
the first is a map problem. i imported my 8.6 map to those one and when it runs it says
LUA:
ERROR: Attempt to set tile on invalid coordinate (00442 / 65535 / 009 )!
it does a buncha those from 442 to 541, i was thinking it would be like.. a movement? or idk something not with the map
and the other my /commands talkactions doesnt work
LUA:
local config = {
	guildTalksEnabled = getConfigInfo('ingameGuildManagement')
}

function onSay(cid, words, param, channel)
	local playerAccess, t = getPlayerAccess(cid), {}
	for i, talk in ipairs(getTalkActionList()) do
		if(not talk.hide and playerAccess >= talk.access) then
			local tmp = talk.words:sub(1, 1):trim()
			if((guildTalksEnabled or (talk.words ~= "!joinguild" and talk.words ~= "!createguild")) and (tmp == "!" or tmp == "/")) then
				table.insert(t, talk)
			end
		end
	end

	table.sort(t, function(a, b) return a.access > b.access end)
	local lastAccess, str = -1, ""
	for i, talk in ipairs(t) do
		local line = ""
		if(lastAccess ~= talk.access) then
			if(i ~= 1) then
				line = "\n"
			end
			lastAccess = talk.access
		end
		str = str .. line .. talk.words .. "\n"
	end

	doShowTextDialog(cid, 2160, str)
	return true
end
it wont do thee "getTalkActionList" i was thinking maybe you would know a different function thing or whatever
 
parts of the map is corrupted. Did you download RME 8.6 > open the map > map > properties > map version version x.x

and getTalkActionList is TFS function

You'll have to search thru the functions and add them to your server. data/lib and .dll files I guess
 
Back
Top