• 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 Tibia 7.60 - Exhausted on use fluids

Kubakos

Well-Known Member
Joined
Mar 3, 2010
Messages
964
Solutions
2
Reaction score
56
Hello i have a low fight server, tibia 7.6 and i need to add an exhausted on use fluids in this script:
Code:
-- fluids by atolon --
-- fluids fixed by Shampo --


 function onUse(cid, item, frompos, item2, topos)
   	-- itemid means that is a creature
if frompos.x == 65535 then
	if item2.itemid == 1 then
   		if item.type == 0 then
   			doPlayerSendCancel(cid,"To jest puste.")
   		else
   			if item2.uid == cid then
   				if item.type == 2 then
   					doPlayerSay(cid,".:Krew:.",16)
   				elseif item.type == 4 then
   					doPlayerSay(cid,".:Trucizna:.",16)
                                           doSendMagicEffect(topos,8)
   				elseif item.type == 3 then
   					doPlayerSay(cid,".:Piwo:.",16)
   				elseif item.type == 5 then
   					doPlayerSay(cid,".:Lemoniada:.",16)
   				elseif item.type == 11 then
   					doPlayerSay(cid,".:Olej:",16)
   				elseif item.type == 15 then
   					doPlayerSay(cid,".:Wino:.",16)
   				elseif item.type == 6 then
					doPlayerAddMana(cid,150)
					doPlayerAddHealth(cid,150)
					doSendAnimatedText(topos,".:Mleko:.",199)
					doSendMagicEffect(topos,19)
   				elseif item.type == 10 then
   					doPlayerAddHealth(cid,100)
                                           			doSendMagicEffect(topos, 19)
					doSendAnimatedText(topos,".:Zycie:.",180)
   				elseif item.type == 13 then
   					doPlayerSay(cid,".:Mocz:.",16)
   				elseif item.type == 7 then
   					doPlayerAddMana(cid,100)
					doSendAnimatedText(topos,".:Mana:.",71)
                                          			 doSendMagicEffect(topos,23)
   				elseif item.type == 19 then
   					doPlayerSay(cid,".:Bloto:.",16)
   				elseif item.type == 26 then
   					doPlayerSay(cid,".:Lawa:.",16)
                                           doSendMagicEffect(topos,6)
   				elseif item.type == 28 then
   					doPlayerSay(cid,".:Trujaca woda:.",16)
                                           doSendMagicEffect(topos,8)
   				else
   					doPlayerSay(cid,".:Prost:..",16)
   				end
   			else
doSendMagicEffect(topos,2)
   			end
   		end
   --water--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 10000) or
   		(item2.itemid >= 1000 and item2.itemid <= 10000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --mud--
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --lava--
   	elseif (item2.itemid >= 10000 and item2.itemid < 10000) or item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --mud--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 10000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --swamp--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 1000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --cask--
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --end cask--

   -- Blood/swamp in decayto corpse --NO FINISH--

   	elseif item2.itemid > 10000 and item2.itemid < 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   -- End Blood/swamp in decayto corpse --NO FINISH--

   	else
   		if item.type == 0 then
   			doPlayerSendCancel(cid,"To jest puste.")
   		else

			doPlayerSendCancel(cid,"Nie szkoda ci tego.")

   		end
   	end
else
doPlayerSendCancel(cid, "Daj to do plecaka.")
return 1
end

   	return 1
end

I will give reput~~
 
Svn?

Lua:
function onUse(cid, item, item2, topos, frompos)
 
local config = {
 
	maglevel = 3, 			-- Magic level to use
	add_mana = 100, 		-- How much mana it should add
	remove_rune = FALSE,		-- TRUE = Remove rune, FALSE = Don't remove rune
	exhaustTime = 2, 		-- Exhausted time
	storeValue = 1337 		-- Don't touch this shit
}
 
	if getPlayerMagLevel(cid) >= config.maglevel then
		if (exhaust(cid, storeValue, 1) > 0) then
			if config.remove_rune == TRUE then			
				doPlayerAddMana(cid, config.add_mana)
				doPlayerSay(cid, "Aaaah...", 16)
				doRemoveItem(item.uid)
				doSendMagicEffect(frompos, 14)
			elseif config.remove_rune == FALSE then
				doPlayerAddMana(cid, config.add_mana)
				doPlayerSay(cid, "Aaaah...", 16)
				doSendMagicEffect(frompos, 14)
			else
				doPlayerSendCancel(cid, "Remove_rune must be set to TRUE or FALSE.")
			end
		else
			doPlayerSendCancel(cid, "You are exhausted.")
		end
	else
		doPlayerSendCancel(cid, "Sorry, you need magic level 3 to use this rune.")
	end
 
 
	return TRUE
end
 
-- Function below is written by unknown
function exhaust(cid, storeValue, exhaustTime)
 
    newExhaust = os.time()
    oldExhaust = getPlayerStorageValue(cid, storeValue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhaustTime == nil or exhaustTime < 0) then
        exhaustTime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhaustTime) then
        setPlayerStorageValue(cid, storeValue, newExhaust) 
        return 1
    else
        return 0
    end
end
 
	--[[ 
 
<action itemid="2280" script="mana_rune.lua"/> 
 
]]
 
Last edited by a moderator:
Well here you go,
Code:
-- fluids by atolon --
-- fluids fixed by Shampo --
[COLOR="#FF0000"]local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) --- exhaust time 1000 = 1sec[/COLOR]

 function onUse(cid, item, frompos, item2, topos)
[COLOR="#FF0000"]         if(hasCondition(cid, CONDITION_EXHAUSTED) == TRUE) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end[/COLOR]
   	-- itemid means that is a creature
if frompos.x == 65535 then
	if item2.itemid == 1 then
   		if item.type == 0 then
   			doPlayerSendCancel(cid,"To jest puste.")
   		else
   			if item2.uid == cid then
   				if item.type == 2 then
   					doPlayerSay(cid,".:Krew:.",16)
   				elseif item.type == 4 then
   					doPlayerSay(cid,".:Trucizna:.",16)
                                           doSendMagicEffect(topos,8)
   				elseif item.type == 3 then
   					doPlayerSay(cid,".:Piwo:.",16)
   				elseif item.type == 5 then
   					doPlayerSay(cid,".:Lemoniada:.",16)
   				elseif item.type == 11 then
   					doPlayerSay(cid,".:Olej:",16)
   				elseif item.type == 15 then
   					doPlayerSay(cid,".:Wino:.",16)
   				elseif item.type == 6 then
					doPlayerAddMana(cid,150)
					doPlayerAddHealth(cid,150)
					doSendAnimatedText(topos,".:Mleko:.",199)
					doSendMagicEffect(topos,19)
   				elseif item.type == 10 then
   					doPlayerAddHealth(cid,100)
                                           			doSendMagicEffect(topos, 19)
					doSendAnimatedText(topos,".:Zycie:.",180)
   				elseif item.type == 13 then
   					doPlayerSay(cid,".:Mocz:.",16)
   				elseif item.type == 7 then
   					doPlayerAddMana(cid,100)
					doSendAnimatedText(topos,".:Mana:.",71)
                                          			 doSendMagicEffect(topos,23)
   				elseif item.type == 19 then
   					doPlayerSay(cid,".:Bloto:.",16)
   				elseif item.type == 26 then
   					doPlayerSay(cid,".:Lawa:.",16)
                                           doSendMagicEffect(topos,6)
   				elseif item.type == 28 then
   					doPlayerSay(cid,".:Trujaca woda:.",16)
                                           doSendMagicEffect(topos,8)
   				else
   					doPlayerSay(cid,".:Prost:..",16)
   				end
   			else
doSendMagicEffect(topos,2)
   			end
   		end
   --water--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 10000) or
   		(item2.itemid >= 1000 and item2.itemid <= 10000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --mud--
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --lava--
   	elseif (item2.itemid >= 10000 and item2.itemid < 10000) or item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --mud--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 10000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --swamp--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 1000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --cask--
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --end cask--

   -- Blood/swamp in decayto corpse --NO FINISH--

   	elseif item2.itemid > 10000 and item2.itemid < 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   -- End Blood/swamp in decayto corpse --NO FINISH--

   	else
   		if item.type == 0 then
   			doPlayerSendCancel(cid,"To jest puste.")
   		else

			doPlayerSendCancel(cid,"Nie szkoda ci tego.")

   		end
   	end
else
doPlayerSendCancel(cid, "Daj to do plecaka.")
return 1
end

   	return 1
end

i added the thing in red.
 
Your script doesn't work..
When i try to use the potion there are "You can not use this object"
 
He is most likely using an old CVS server

Try this then:

Lua:
function exhaust(cid, storeValue, exhaustTime)
 
    newExhaust = os.time()
    oldExhaust = getPlayerStorageValue(cid, storeValue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhaustTime == nil or exhaustTime < 0) then
        exhaustTime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhaustTime) then
        setPlayerStorageValue(cid, storeValue, newExhaust) 
        return 1
    else
        return 0
    end
end

-- fluids by atolon --
-- fluids fixed by Shampo --

storeValue = 1337 
exhaust = 2

 function onUse(cid, item, frompos, item2, topos)
   	-- itemid means that is a creature
if frompos.x == 65535 then
	if item2.itemid == 1 then
		if (exhaust(cid, storeValue, 1) > 0) then
			if item.type == 0 then
				doPlayerSendCancel(cid,"To jest puste.")
			else
   			if item2.uid == cid then
   				if item.type == 2 then
   					doPlayerSay(cid,".:Krew:.",16)
   				elseif item.type == 4 then
   					doPlayerSay(cid,".:Trucizna:.",16)
                                           doSendMagicEffect(topos,8)
   				elseif item.type == 3 then
   					doPlayerSay(cid,".:Piwo:.",16)
   				elseif item.type == 5 then
   					doPlayerSay(cid,".:Lemoniada:.",16)
   				elseif item.type == 11 then
   					doPlayerSay(cid,".:Olej:",16)
   				elseif item.type == 15 then
   					doPlayerSay(cid,".:Wino:.",16)
   				elseif item.type == 6 then
					doPlayerAddMana(cid,150)
					doPlayerAddHealth(cid,150)
					doSendAnimatedText(topos,".:Mleko:.",199)
					doSendMagicEffect(topos,19)
   				elseif item.type == 10 then
   					doPlayerAddHealth(cid,100)
                                           			doSendMagicEffect(topos, 19)
					doSendAnimatedText(topos,".:Zycie:.",180)
   				elseif item.type == 13 then
   					doPlayerSay(cid,".:Mocz:.",16)
   				elseif item.type == 7 then
   					doPlayerAddMana(cid,100)
					doSendAnimatedText(topos,".:Mana:.",71)
                                          			 doSendMagicEffect(topos,23)
   				elseif item.type == 19 then
   					doPlayerSay(cid,".:Bloto:.",16)
   				elseif item.type == 26 then
   					doPlayerSay(cid,".:Lawa:.",16)
                                           doSendMagicEffect(topos,6)
   				elseif item.type == 28 then
   					doPlayerSay(cid,".:Trujaca woda:.",16)
                                           doSendMagicEffect(topos,8)
   				else
   					doPlayerSay(cid,".:Prost:..",16)
   				end
   			else
doSendMagicEffect(topos,2)
   			end
   		end
	end
   --water--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 10000) or
   		(item2.itemid >= 1000 and item2.itemid <= 10000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --mud--
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --lava--
   	elseif (item2.itemid >= 10000 and item2.itemid < 10000) or item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --mud--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 10000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --swamp--
   	elseif (item2.itemid >= 10000 and item2.itemid <= 1000) then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   --cask--
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")
   	elseif item2.itemid == 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   --end cask--

   -- Blood/swamp in decayto corpse --NO FINISH--

   	elseif item2.itemid > 10000 and item2.itemid < 10000 then
   		doPlayerSendCancel(cid,"Butelka jest po to, aby z niej pic.")

   -- End Blood/swamp in decayto corpse --NO FINISH--

   	else
   		if item.type == 0 then
   			doPlayerSendCancel(cid,"To jest puste.")
   		else

			doPlayerSendCancel(cid,"Nie szkoda ci tego.")

   		end
   	end
else
doPlayerSendCancel(cid, "Daj to do plecaka.")
return 1
end

   	return 1
end
 
Last edited:
Do you have the fluids id's in actions ? or where else is this script?


@ond man kan inte skicka privat medelande till dig för du har för mycket mail i din inkorg eller vad det står xD
 
Back
Top