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

TalkAction !bless for 0.2.4 cost varys on level

xd other question!

is possible the talkaction have exahustation?????

and how?
 
take it from
Code:
local t = {
-- from, to, itemid[, count]
	{1, 36},
	{37, 46, 2148, 80},
	{47, 55, 2148, 50},
	{56, 64, 2671, 5},
	{65, 73, 2789, 5},
	{74, 81, 7620},
	{82, 87, 7618},
	{88, 92, 9811},
	{93, 96, 9808},
	{97, 100, 2213}
}

function doCreatureSayWithRadius(cid, text, type, radiusx, radiusy, position)
	for i, tid in ipairs(getSpectators(position or getThingPos(cid), radiusx, radiusy, false)) do
		if(isPlayer(tid) == TRUE) then
			doCreatureSay(cid, text, type, false, tid, position or getThingPos(cid))
		end
	end
	return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
[B][COLOR="#FF0000"]	if os.time() - getPlayerStorageValue(cid, 65000) >= 3600 then
		setPlayerStorageValue(cid, 65000, os.time())[/COLOR][/B]
		local rand = math.random(100)
		for i = 1, #t do
			local k = t[i]
			if rand >= k[1] and rand <= k[2] then
				if k[3] then
					local itemid, count, article = k[3], k[4] or 1, getItemInfo(itemid).article
					doPlayerAddItem(cid, itemid, count)
					doCreatureSayWithRadius(cid, count > 1 and 'You found ' .. count .. ' ' .. getItemInfo(itemid).plural .. '.' or 'You found ' .. (article ~= '' and article .. ' ' or '') .. getItemInfo(itemid).name .. '.', TALKTYPE_ORANGE_1, 1, 1)
				else
					doCreatureSayWithRadius(cid, 'You found nothing useful.', TALKTYPE_ORANGE_1, 1, 1)
				end
				break
			end
		end
[B][COLOR="#FF0000"]	else
		doCreatureSayWithRadius(cid, 'You found nothing useful.', TALKTYPE_ORANGE_1, 1, 1)
	end[/COLOR][/B]
	return true
end
3600 is secs, 1 hour
 
so?

Code:
function onSay(cid, words, param)
	if getPlayerStorageValue(cid, 1111) == -1 then
		doPlayerSendCancel(cid, 'You can\'t use this command.')
		return TRUE
	end
 
	if os.time() - getPlayerStorageValue(cid, 65000) >= 3600 then
		setPlayerStorageValue(cid, 65000, os.time())
		return TRUE
	end
	local t = {}
	for i = 1, 5 do
		if not getPlayerBlessing(cid, i) then
			table.insert(t, i)
		end
	end
 
	if #t == 0 then
		doPlayerSendCancel(cid, 'You already have all the blessings!')
		return TRUE
	end
 
	local lvl, cost = getPlayerLevel(cid)
	if lvl < 31 then
		cost = 2000
	elseif lvl > 119 then
		cost = 20000
	else
		cost = (lvl - 30) * 200 + 2000
	end
 
	if getPlayerStorageValue(cid, 1112) ~= -1 then
		cost = cost * 0.74
	end
 
	if doPlayerRemoveMoney(cid, cost) == TRUE then
		for i = 1, #t do
			doPlayerAddBlessing(cid, t[i])
		end
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
	else
		doPlayerSendCancel(cid, 'You need ' .. cost .. ' gold!')
	end
 
	return TRUE
end
 
Back
Top