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

comands for access.

marcryzius

New Member
Joined
Mar 22, 2009
Messages
61
Reaction score
0
I'm posting this script because a person in my msn he asked me so I'm posting them to everyone.

this is the script that checks all commands talkactions according to access the player.

Lua:
--[[> marcryzius <]]--
function onSay(cid, words, param)
local file = assert(io.open('data/talkactions/talkactions.xml','r'))
local tab = {'Your commands is:\n"Access"    <>    "Words"\n'}
local lerfile,gpa = file:read(-1),getPlayerAccess(cid)
file:close()
	for ler in lerfile:gmatch('<talkaction (.-)/>') do
		if((tonumber(ler:match('access="(%d+)"')) == nil) and 0 or tonumber(ler:match('access="(%d+)"')) <= gpa)then
			table.insert(tab,'"access" = '..(tonumber(ler:match('access="(%d+)"')) or 0)..' "words" = "'..ler:match('words="(.-)"')..'"')
		end
	end
	return TRUE,doShowTextDialog(cid,2421,table.concat(tab,'\n'))
end

this script is unique to OtLand not authorize anyone to post elsewhere.:peace:
 
Last edited:
data/talkactions/scripts/commands.lua

Lua:
local config = {
    guildTalksEnabled = getBooleanFromString(getConfigValue('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
 
data/talkactions/scripts/commands.lua

Lua:
local config = {
    guildTalksEnabled = getBooleanFromString(getConfigValue('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

you script used in tfs 8.52+ because getTalkActionList()

my script need lua 5.1 or more for all version tfs

that my script is an old version since I had tfs 8.40
 
i know ^_^ its just some comparison
and that script is from the tfs ^_^
 
the script of tfs using very loop in strings making very large stack of LUA.
causing a great need for use of CPU and RAM memory.
 
Back
Top