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

Help Command

Don Shotta

Well-Known Member
Joined
Jun 29, 2008
Messages
2,936
Reaction score
87
Location
England
Hi can someone post a command where if you type !help a box comes up and shows your the commands of server.

TFS 0.2.1

thanks and rep++
 
Here you go

Code:
local info = [[                                     Commands:

 1. !buypremium
 2. !changender]]
 
 function onSay(cid, words, param)
doShowTextDialog(cid, 9932, info)
end
 
Last edited:
Simple: Just add the command name in "local commands" as the examples:

Lua:
local commands = {"!buypremium", "!changesex"}
local i = 0
function onSay(cid, words, param)
	str = "<-- Commands for Name of Server -->\n\n"
	for k, com in ipairs(commands) do
		i = i + 1
		str = str..i..". "..com.."\n"
	end
	doShowTextDialog(cid, 9932, str)
end

How it looks:

ven59c.gif
 
Simple: Just add the command name in "local commands" as the examples:

Lua:
  local commands = {"!buypremium", "!changesex"}
local i = 0
function onSay(cid, words, param)
        str = "<-- Commands for Name of Server -->\n\n"
        for k, com in ipairs(commands) do
                i = i + 1
                str = str..i..". "..com.."\n"
        end
        doShowTextDialog(cid, 9932, str)
end
How it looks:

ven59c.gif


Muajaujauja it sucks =P

Lua:
local myFile = "data/talkactions/talkactions.xml"

function onSay(cid, words, param, channel)
    local commands = {}
    local text = "<--Commands-->"
    if (io.open(myFile, "r") ~= nil) then
        for line in io.lines(myFile) do
            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
        text = text .. "\n" .. "Found " .. #commands .. " Commands"
        for _, i in ipairs(commands) do
            text = text .. "\n" .. "-".. i ..""
        end
        doShowTextDialog(cid, 9932, text)
    else
        error("File: \"" .. myFile .. "\" not found, please check directory or file.")
    end
    return TRUE
end
 
Last edited:
Muajaujauja it sucks =P

Lua:
local myFile = "data/talkactions/talkactions.xml"

function onSay(cid, words, param, channel)
    local commands = {}
    local text = "<--Commands-->"
    if (io.open(myFile, "r") ~= nil) then
        for line in io.lines(myFile) do
            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
        text = text .. "\n" .. "Found " .. #commands .. " Commands"
        for _, i in ipairs(commands) do
            text = text .. "\n" .. "-".. i ..""
        end
        doShowTextDialog(cid, 9932, text)
    else
        error("File: \"" .. myFile .. "\" not found, please check directory or file.")
    end
    return TRUE
end

nahruto.. you are lua-master.. we only are lua-users xD
 
Back
Top