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

ollie

New Member
Joined
Feb 15, 2008
Messages
34
Reaction score
0
I am after a command that will give a list of everything i want it to say
example:

player says "!help"

Message popup
!spells for spells list
!staff for staff list
!serverinfo for information on server


so on so on


or

player says "!help"

then in defualt window
all that comes up... i would much preffer it come up in a book-type popup window but i will settle with anything


thank you and good luck

i am using Xml 8.1 Aries 0.4.0 server
 
what the full file?

i have nothing in my talk actions to do with this atm

i am trying to find someone that will make it for me :S
 
Code:
local function getTalkactionList()
	local list = ""
	local file = "data/talkactions/talkactions.xml"
	for k in io.lines(file) do
		if not k:find("<!---)" then
			for s in k:gmatch('words="%s*(.-)"') do
				list = list .. "" .. (list == "" and "" or ", ") .. "" .. s .. "\n"
			end
		end
	end
	return list
end
function onSay(cid, words, param, channel)
	return doPlayerPopupFYI(cid, getTalkactionList())
end
configure it
 
Code:
local function getTalkactionList()
    local list = ""
    local file = "data/talkactions/talkactions.xml"
    for k in io.lines(file) do
        if not k:find("<!---)" then
            for s in k:gmatch('words="%s*(.-)"') do
                list = list .. "" .. (list == "" and "" or ", ") .. "" .. s .. "\n"
            end
        end
    end
    return list
end
function onSay(cid, words, param, channel)
    return doPlayerPopupFYI(cid, getTalkactionList())
end
configure it

why?

Code:
int32_t LuaScriptInterface::luaGetTalkActionList(lua_State* L)
{
    //getTalkactionList()
    TalkActionsMap::const_iterator it =  g_talkActions->getFirstTalk();
    lua_newtable(L);
    for(uint32_t i = 1; it != g_talkActions->getLastTalk(); ++it,  ++i)
    {
        createTable(L, i);
        setField(L, "words", it->first);
        setField(L, "access", it->second->getAccess());

        setFieldBool(L, "log", it->second->isLogged());
        setFieldBool(L, "hide", it->second->isHidden());

        setField(L, "channel", it->second->getChannel());
        pushTable(L);
    }

    return 1;
}
 
why?

Code:
int32_t LuaScriptInterface::luaGetTalkActionList(lua_State* L)
{
    //getTalkactionList()
    TalkActionsMap::const_iterator it =  g_talkActions->getFirstTalk();
    lua_newtable(L);
    for(uint32_t i = 1; it != g_talkActions->getLastTalk(); ++it,  ++i)
    {
        createTable(L, i);
        setField(L, "words", it->first);
        setField(L, "access", it->second->getAccess());

        setFieldBool(L, "log", it->second->isLogged());
        setFieldBool(L, "hide", it->second->isHidden());

        setField(L, "channel", it->second->getChannel());
        pushTable(L);
    }

    return 1;
}
look what server is he using...
 
btw, look what i found A_A

http://otland.net/f132/help-command-37957/


and i was sure i ve posted this but didnt find the thread, old stuff

Lua:
local myFile = "data/talkactions/talkactions.xml" 
 
local useAccess = true --true / false 
 
function onSay(cid, words, param, channel) 
    local commands, acc, myAcc, x = {}, {}, getPlayerAccess(cid), 0 
    local text = "<--Commands-->" 
    if (io.open(myFile, "r") ~= nil) then 
        for line in io.lines(myFile) do 
            if (line:match('<talkaction ')) then 
                if useAccess then 
                    local access = 0 
                    if (line:find('access=".*".*')) then 
                        a = string.match(line, 'access=".*".*') 
                        access = string.sub(a, string.find(a, '="') + 2, string.find(a, '" ') - 1) 
                    end 
                    table.insert(acc, tonumber(access)) 
                end 
                if (line:find('words=".*".*')) then 
                    line = string.match(line, 'words=".*".*') 
                    word = string.sub(line, string.find(line, '="') + 2, string.find(line, '" ') - 1) 
                    table.insert(commands, word) 
                end 
            end 
        end 
        for _i, i in ipairs(commands) do 
            if useAccess then     
                if myAcc >= acc[_i] then 
                    text = text .. "\n" .. "" .. x + 1 .. ".- ".. i .."" 
                    x = x + 1 
                end 
            else 
                text = text .. "\n" .. "" .. x + 1 .. ".- ".. i .."" 
                x = x + 1 
            end 
        end 
        if useAccess then text = text .. "\n\nYour Access = " .. myAcc .. "" end 
        text = text .. "\n\n" .. "Total " .. x .. " Commands." 
        doShowTextDialog(cid, 9932, text) 
    else 
        error("File: \"" .. myFile .. "\" not found, please check directory or file.") 
    end 
    return TRUE 
end
 
Hey thanks heaps for the responses.. but im not completely sure what i need to change to make it work :S
 
Back
Top