Don Shotta
Well-Known Member
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++
TFS 0.2.1
thanks and rep++
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
Simple: Just add the command name in "local commands" as the examples:
How it looks: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
![]()
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
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
Nah, Colandus is or at least used to be.