• 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 Command !go for guild leader - Error in console

Status
Not open for further replies.

Galaxy

New Member
Joined
Feb 24, 2011
Messages
108
Reaction score
1
Location
Ireland/Carlow
Hello,
I have this script for changing outfit to leader's one.

Code:
local config = {
	exhaustionInSeconds = 30,
	storage = 234
}
 
function onSay(cid, words, param)
	if(exhaustion.check(cid, config.storage) == TRUE) then
		doPlayerSendCancel(cid, 26, "You can change outfit only 1 time per " .. config.exhaustionInSeconds .. " seconds.")
		return TRUE
	end
 
	local playerGuild = getPlayerGuildId(cid)
	if(playerGuild == FALSE) then
		doPlayerSendCancel(cid, "Sorry, you're not in a guild.")
		return TRUE
	end
 
	local playerGuildLevel = getPlayerGuildLevel(cid)
	if(playerGuildLevel < GUILDLEVEL_LEADER) then
		doPlayerSendCancel(cid, "You have to be Leader of your guild to change outfits!")
		return TRUE
	end
 
	local players = getPlayersOnline()
	local outfit = getCreatureOutfit(cid)
	local message = "*Guild* Your outfit has been changed by leader. (" .. getCreatureName(cid) .. ")"
	local members = 0
	local tmp = {}
	for i, tid in ipairs(players) do
		if(getPlayerGuildId(tid) == playerGuild and cid ~= tid) then
			tmp = outfit
			if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
				local tidOutfit = getCreatureOutfit(tid)
				tmp.lookType = tidOutfit.lookType
				tmp.lookAddons = tidOutfit.lookAddons
			end
 
			doSendMagicEffect(getCreaturePosition(tid), 66)
			doCreatureChangeOutfit(tid, tmp)
			doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, message)
			members = members + 1
		end
	end
 
	exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
	doPlayerSendCancel(cid, "Guild members outfit has been changed. (Total: " .. members .. ")")
	return TRUE
end

but, when I try to use it by the leader of my guild I get the following error in my console:

errorgo.png


:S I guess Im missing something in exhaustion.lua file in lib folder but I have no idea what is it ;/

Can any1 help me? :(

thanks for support :)
 

Attachments

Try this.

Code:
local config = {
    exhaustionInSeconds = 30,
    storage = 34534
}
 
function onSay(cid, words, param)
    if(exhaustion.check(cid, config.storage) == TRUE) then
        doPlayerSendCancel(cid, "You can change outfit only 1 time per " .. config.exhaustionInSeconds .. " seconds.")
        return TRUE
    end
 
    local playerGuild = getPlayerGuildId(cid)
    if(playerGuild == FALSE) then
        doPlayerSendCancel(cid, "Sorry, you're not in a guild.")
        return TRUE
    end
 
    local playerGuildLevel = getPlayerGuildLevel(cid)
    if(playerGuildLevel < GUILDLEVEL_LEADER) then
        doPlayerSendCancel(cid, "You have to be Leader of your guild to change outfits!")
        return TRUE
    end
 
    local players = getPlayersOnline()
    local outfit = getCreatureOutfit(cid)
    local message = "*Guild* Your outfit has been changed by leader. (" .. getCreatureName(cid) .. ")"
    local members = 0
    local tmp = {}
    for i, tid in ipairs(players) do
        if(getPlayerGuildId(tid) == playerGuild and cid ~= tid) then
            tmp = outfit
            if(canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons) ~= TRUE) then
                local tidOutfit = getCreatureOutfit(tid)
                tmp.lookType = tidOutfit.lookType
                tmp.lookAddons = tidOutfit.lookAddons
            end
 
            doSendMagicEffect(getCreaturePosition(tid), 66)
            doCreatureChangeOutfit(tid, tmp)
            doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, message)
            members = members + 1
        end
    end
 
    exhaustion.set(cid, config.storage, config.exhaustionInSeconds)
    doPlayerSendCancel(cid, "Guild members outfit has been changed. (Total: " .. members .. ")")
    return TRUE
end
 
Works fine with me so the problem is your 034-exhaustion.lua. Post it? :p
 
here you go :) catch xD

Code:
exhaustion =
{
	check = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
			return false
		end

		return getPlayerStorageValue(cid, storage) >= os.time(t)
	end,

	get = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
			return false
		end

		local exhaust = getPlayerStorageValue(cid, storage)
		if(exhaust > 0) then
			local left = exhaust - os.time(t)
			if(left >= 0) then
				return left
			end
		end

		return false
	end,

	set = function (cid, storage, time)
		setPlayerStorageValue(cid, storage, os.time(t) + time)
	end,

	make = function (cid, storage, time)
		local exhaust = exhaustion.get(cid, storage)
		if(not exhaust) then
			exhaustion.set(cid, storage, time)
			return true
		end

		return false
	end
}
 
Status
Not open for further replies.
Back
Top