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

Lua !commands talkaction error

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, i have a tfs 0.3 and i get an error trying to use the !commands command lol
here is the full script and the error
also i haven't seen how the script works yet, but i would like for it to show only those with access 1 in talkactions.xml

plz help me :(

Code:
function onSay(cid, words, param)
local total_string = "The command is:\n"
local file = io.open("data/talkactions/talkactions.xml","r")
str = file:read(-1)
file:close()
stra = string.explode(str," ")
for i=1, #stra do
if stringcontains(stra[i],'access') then
    stre = string.explode(stra[i],'"')
    for i=1, #stre do
        if stre[i] == "words=" then
        total_string = total_string ..stre[i+1].." \n" 
        end
    end
end
end
  doShowTextDialog(cid,2597, total_string)
end


0Od5sd.png
 
You should then probably read some small tutorial if you want to deal with lua files.

Lua:
function onSay(cid, words, param)
local total_string = "The command is:\n"
local file = io.open("data/talkactions/talkactions.xml","r")
str = file:read(-1)
file:close()
stra = string.explode(str," ")
for i=1, #stra do
if string.find(stra[i],'access') then
    stre = string.explode(stra[i],'"')
    for i=1, #stre do
        if stre[i] == "words=" then
        total_string = total_string ..stre[i+1].." \n"
        end
    end
end
end
  doShowTextDialog(cid,2597, total_string)
end
 
You should then probably read some small tutorial if you want to deal with lua files.

Lua:
function onSay(cid, words, param)
local total_string = "The command is:\n"
local file = io.open("data/talkactions/talkactions.xml","r")
str = file:read(-1)
file:close()
stra = string.explode(str," ")
for i=1, #stra do
if string.find(stra[i],'access') then
    stre = string.explode(stra[i],'"')
    for i=1, #stre do
        if stre[i] == "words=" then
        total_string = total_string ..stre[i+1].." \n"
        end
    end
end
end
  doShowTextDialog(cid,2597, total_string)
end


nothing is showing in the box :(

0TBf_Ri.png
 
Add this function to your global.lua or functions.lua

Credits to Mock

Lua:
function stringcontains(txt, str) -- by mock
      return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
 
Add this function to your global.lua or functions.lua

Credits to Mock

Lua:
function stringcontains(txt, str) -- by mock
      return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
i'm sorry could you tell me where can i find global.lua or functions.lua? i can't see them anywhere >.<
 
Back
Top