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

Help a newbie out

Satho

τnє đєv
Joined
Aug 19, 2007
Messages
175
Reaction score
1
Well i just tryed to make a script and here is the script:
Code:

Code:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 1156 then	
doCreatureAddHealth(cid,113)
doPlayerSendTextMessage(cid,22,"You drank the water of healing")
doSendMagicEffect(frompos, 12)
storevalue = 1245 -- value where exhausted is saved
exhausttime = 50 -- 2 seconds exhaustion
if (exhaust(cid, storevalue, exhausttime) == 1) then
    --not exhausted
else
    --exhausted
end
end
end

Everything is working except the exhaustion....

Please help me so i can get it working :(

I am using The Forgotten Server
 
Well i just tryed to make a script and here is the script:
Code:

Code:
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 1156 then	
doCreatureAddHealth(cid,113)
doPlayerSendTextMessage(cid,22,"You drank the water of healing")
doSendMagicEffect(frompos, 12)
storevalue = 1245 -- value where exhausted is saved
exhausttime = 50 -- 2 seconds exhaustion
if (exhaust(cid, storevalue, exhausttime) == 1) then
    --not exhausted
else
    --exhausted
end
end
end

Everything is working except the exhaustion....

Please help me so i can get it working :(

I am using The Forgotten Server

I'm not sure but shouldent "exhausttime" be "if itemEx.itemid == 1 then" i'll looka t it when i'm home.

P.s why dit u make a apart script for it? you should add it in fluids.lua


Fluids.lua:
Code:
local fluidType = {3, 4, 5, 7, 10, 11, 13, 15, 19}
local fluidMessage = {"Aah...", "Urgh!", "Mmmh.", "Aaaah...", "Aaaah...", "Urgh!", "Urgh!", "Aah...", "Urgh!"}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if itemEx.itemid == 1 then
		if item.type == 0 then
			doPlayerSendCancel(cid,"It is empty.")
		else
			if itemEx.uid == cid then
				doChangeTypeItem(item.uid, 0)
				if item.type == 4 then
					doSendMagicEffect(fromPosition, CONST_ME_GREEN_RINGS)
				elseif item.type == 10 then
					doCreatureAddHealth(cid, 60)
					doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
				elseif item.type == 7 then
					doPlayerAddMana(cid, math.random(50, 150))
					doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
				end

				for i = 0, table.maxn(fluidType) do
					if item.type == fluidType[i] then
						doCreatureSay(cid, fluidMessage[i], TALKTYPE_ORANGE_1)
						return TRUE
					end
				end
				doCreatureSay(cid, "Gulp.", TALKTYPE_ORANGE_1)
			else
				local splash = doCreateItem(2025, item.type, toPosition)
				doChangeTypeItem(item.uid, 0)
				doDecayItem(splash)
			end
		end
	elseif (itemEx.itemid >= 490 and itemEx.itemid <= 493) or (itemEx.itemid >= 4608 and itemEx.itemid <= 4625) or (itemEx.itemid >= 618 and itemEx.itemid <= 629) then
		doChangeTypeItem(item.uid, 9)
	elseif itemEx.itemid == 103 then
		doChangeTypeItem(item.uid, 19)
	elseif (itemEx.itemid >= 598 and itemEx.itemid < 712) or itemEx.itemid == 1509 then
		doChangeTypeItem(item.uid, 26)
	elseif (itemEx.itemid >= 351 and itemEx.itemid <= 355) then
		doChangeTypeItem(item.uid, 19)
	elseif (itemEx.itemid >= 602 and itemEx.itemid <= 605) then
		doChangeTypeItem(item.uid, 28)
	elseif itemEx.itemid == 1771 then
		doChangeTypeItem(item.uid, 9)
	elseif itemEx.itemid == 1772 then
		doChangeTypeItem(item.uid, 3)
	elseif itemEx.itemid == 1773 then
		doChangeTypeItem(item.uid, 15)
	elseif itemEx.itemid > 3922 and itemEx.itemid < 4327 then
		doChangeTypeItem(item.uid, 2)
	else
		if item.type == 0 then
			doPlayerSendCancel(cid, "It is empty.")
		else
			if toPosition.x == CONTAINER_POSITION then
				toPosition = getCreaturePosition(cid)
			end
			splash = doCreateItem(2025, item.type, toPosition)
			doChangeTypeItem(item.uid, 0)
			doDecayItem(splash)
		end
	end
	return TRUE
end
 
Back
Top