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

Script like a potion but in actions

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
743
Solutions
5
Reaction score
200
Location
Pr0land
GitHub
Erexo
Hello,
i have that script:

LUA:
function onUse(cid, item, frompos, item2, topos)



	local level = getPlayerLevel(cid)

	local mlevel = getPlayerMagLevel(cid)

	

	local exhausted_seconds = 1

	local exhausted_storagevalue = 74

		

		if(item.type >= 1) then

			if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then

				if(isPlayer(cid) == 1) then

doSendMagicEffect(topos,40)

	doCreatureAddMana(cid, math.floor(getCreatureMaxMana(cid)*0.20))

	doCreatureAddHealth(cid, math.floor(getCreatureMaxHealth(cid)*0.20))

					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)

					doChangeTypeItem(item.uid, item.type - 1)

				else

					doSendMagicEffect(frompos, CONST_ME_POFF)

					doPlayerSendCancel(cid, "You are exchausted.")

				end

			else

				doSendMagicEffect(frompos, CONST_ME_POFF)

				doPlayerSendCancel(cid, "You are exhausted.")

			end

		else

			if(os.time() < getPlayerStorageValue(cid, exhausted_storagevalue)) then

				doSendMagicEffect(frompos, CONST_ME_POFF)

				doPlayerSendCancel(cid, "You are exhausted.")

			else

				if(isPlayer(cid) == 1) then

doSendMagicEffect(topos,40)

	doCreatureAddMana(cid, math.floor(getCreatureMaxMana(cid)*0.20))

	doCreatureAddHealth(cid, math.floor(getCreatureMaxHealth(cid)*0.20))

					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)

					doRemoveItem(item.uid, 1)

				else

					doSendMagicEffect(frompos, CONST_ME_POFF)

					doPlayerSendCancel(cid, "You are exchausted.")

				end

			end

		end

						

	return 1

end

And when i wanna use them, error "You are exchausted".
Someone know where is a bug?

Tfs 0.3.6 [8.54]

Thanks for any help,
Erexo.
 
Code:
function onUse(cid, item, frompos, item2, topos)
	local exhausted_seconds = 1
	local exhausted_storagevalue = 74
 
                if isPlayer(cid) then
                 if(os.time() <= getPlayerStorageValue(cid, exhausted_storagevalue)) then
                 return doPlayerSendCancel(cid, "You are exchausted.")
                 end
		 if(item.type >= 1) then
doSendMagicEffect(topos,40)
	doCreatureAddMana(cid, math.floor(getCreatureMaxMana(cid)*0.20))
	doCreatureAddHealth(cid, math.floor(getCreatureMaxHealth(cid)*0.20))
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doChangeTypeItem(item.uid, item.type - 1)
			else
doSendMagicEffect(topos,40)
	doCreatureAddMana(cid, math.floor(getCreatureMaxMana(cid)*0.20))
	doCreatureAddHealth(cid, math.floor(getCreatureMaxHealth(cid)*0.20))
					setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
					doRemoveItem(item.uid, 1)
				end
		end
	return true
end
 
Back
Top