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
Anybody knows?
Thanks
local storageValue = 9982
local exhaustTime = 1
if(isExhausted(cid, storageValue, exhaustTime)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return TRUE
end
setExhaust(cid, storageValue)
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
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
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
if(getPlayerItemCount(cid, config.cost[1])>= config.cost[2]) then