• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Exhaust on switch

DestinationSer

@echo off
Joined
Mar 7, 2009
Messages
2,806
Solutions
1
Reaction score
676
Hello. I need to know how you set a exhaust on switches..
Anybody knows?
Thanks
 
nah try with this:

Code:
local storageValue = 9982
local exhaustTime = 1

	if(isExhausted(cid, storageValue, exhaustTime)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)

		return TRUE

	end

	setExhaust(cid, storageValue)
It's what i use to add exhaustion to something (: REP++
 
Ive tried so many times to add it. Do you mind adding it the right way for me? heres the script
LUA:
local config = {
	cost = {9970, 0},
	newItem = {2173, 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not doPlayerRemoveItem(cid, config.cost[1], config.cost[2]) then
		doCreatureSay(cid, "You need "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. " to buy "..config.newItem[2].."x "..getItemNameById(config.newItem[1])..".", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)
		return true
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	doPlayerAddItem(cid, config.newItem[1], config.newItem[2])
	doCreatureSay(cid, "You bought "..config.newItem[2].."x "..getItemNameById(config.newItem[1]).." for "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. ".", TALKTYPE_ORANGE_1)
	return true
end
 
Ive tried so many times to add it. Do you mind adding it the right way for me? heres the script
LUA:
local config = {
	cost = {9970, 0},
	newItem = {2173, 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not doPlayerRemoveItem(cid, config.cost[1], config.cost[2]) then
		doCreatureSay(cid, "You need "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. " to buy "..config.newItem[2].."x "..getItemNameById(config.newItem[1])..".", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)
		return true
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	doPlayerAddItem(cid, config.newItem[1], config.newItem[2])
	doCreatureSay(cid, "You bought "..config.newItem[2].."x "..getItemNameById(config.newItem[1]).." for "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. ".", TALKTYPE_ORANGE_1)
	return true
end

Code:
local config = {
	cost = {9970, 0},
	newItem = {2173, 1}
}

local exhaust = createConditionObject(CONDITION_EXHAUSTED)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000) -- delay 5000 = 5 sec
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
     if (getCreatureCondition(cid, CONDITION_EXHAUSTED) == FALSE) then
	if not doPlayerRemoveItem(cid, config.cost[1], config.cost[2]) then
		doCreatureSay(cid, "You need "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. " to buy "..config.newItem[2].."x "..getItemNameById(config.newItem[1])..".", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)
		return true
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	doPlayerAddItem(cid, config.newItem[1], config.newItem[2])
	doCreatureSay(cid, "You bought "..config.newItem[2].."x "..getItemNameById(config.newItem[1]).." for "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. ".", TALKTYPE_ORANGE_1)
           doAddCondition(cid, exhaust)
     else
           doPlayerSendTextMessage(cid, 12, "Anti spam exhausted.")
     end
    return 1
end
 
Ive tried so many times to add it. Do you mind adding it the right way for me? heres the script
LUA:
local config = {
	cost = {9970, 0},
	newItem = {2173, 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not doPlayerRemoveItem(cid, config.cost[1], config.cost[2]) then
		doCreatureSay(cid, "You need "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. " to buy "..config.newItem[2].."x "..getItemNameById(config.newItem[1])..".", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)
		return true
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	doPlayerAddItem(cid, config.newItem[1], config.newItem[2])
	doCreatureSay(cid, "You bought "..config.newItem[2].."x "..getItemNameById(config.newItem[1]).." for "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. ".", TALKTYPE_ORANGE_1)
	return true
end

MORE EASY:

Ive tried so many times to add it. Do you mind adding it the right way for me? heres the script
LUA:
local config = {
	cost = {9970, 0},
	newItem = {2173, 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local storageValue = 9982
local exhaustTime = 1
	if(isExhausted(cid, storageValue, exhaustTime)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
                return TRUE
        end
	if not doPlayerRemoveItem(cid, config.cost[1], config.cost[2]) then
		doCreatureSay(cid, "You need "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. " to buy "..config.newItem[2].."x "..getItemNameById(config.newItem[1])..".", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getThingPos(cid), 2)
		return true
	end
	doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
	doPlayerAddItem(cid, config.newItem[1], config.newItem[2])
	setExhaust(cid, storageValue)
	doCreatureSay(cid, "You bought "..config.newItem[2].."x "..getItemNameById(config.newItem[1]).." for "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. ".", TALKTYPE_ORANGE_1)
	return true
end

AND WHY YOU ARE USING if not doPlayerRemoveItem(cid, config.cost[1], config.cost[2])

if you can perfect the script with
LUA:
if(getPlayerItemCount(cid, config.cost[1])>= config.cost[2]) then
 
Back
Top