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

Exhust on talkactions?

SnowFox

New Member
Joined
May 18, 2008
Messages
264
Reaction score
0
Hi my bless script has abolsutly no exhaust and i think thats whats crashing OT because people spam it.

is there a way to add exhaust to this script?

Code:
function onSay(cid, words, param)

if getPlayerBlessing(cid,5) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
else
if doPlayerRemoveMoney(cid, 10000) == TRUE then
for i = 1,5 do
doPlayerAddBlessing(cid,i)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 10,000 gp in backpack for blessings.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
end
end
return TRUE
end



Code:
	<talkaction words="!bless" event="script" value="bless.lua"/>
 
Try this script:
Lua:
function onSay(cid, words, param)
local fail = 0

	if getPlayerLevel(cid) < 31 then
		cost = 2000
	else
		cost = ((getPlayerLevel(cid) - 30) * 200) + 2000
	end
	
	if cost > 20000 then
		cost = 20000
	end

	for i = 1, 5 do
		if getPlayerBlessing(cid, i) then
			fail = fail + 1
		else
			if doPlayerRemoveMoney(cid, cost) == TRUE then
				doPlayerAddBlessing(cid, i)
				if i == 5 and not(fail == 5) then
					doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
				end
			else
				doPlayerSendCancel(cid, "You do not have enough money to buy all the blessings!")
				break
			end
		end
	end
	if fail == 5 then
		doPlayerSendCancel(cid, "You already have all the blessings!")
	end
return TRUE
end
 
You've just gave him another blessing system, but it isn't what he request for..

try this one:
Lua:
function onSay(cid, words, param)
local wtime = 30 // in seconds
local storage = 5580

	if exhaustion.get(cid, storage) == FALSE then
		if getPlayerBlessing(cid,5) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already been blessed")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MORTAREA)
		else
			if doPlayerRemoveMoney(cid, 10000) == TRUE then
				for i = 1,5 do
					doPlayerAddBlessing(cid,i)
				end
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received blessings!")
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ENERGYAREA)
			
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 10,000 gp in backpack for blessings.")
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_ICEAREA)
			end
		end
		exhaustion.set(cid, storage, wtime)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. exhaustion.get(cid, storage) .. " seconds.")
	return TRUE
	end
end
 

Similar threads

Back
Top