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

CRYSTAL COIN to Platinum Coin.

Axelor

Member
Joined
Sep 2, 2010
Messages
505
Reaction score
9
Hello,

How can I make a delay when changing money to other money
example: from CRYSTAL COIN TO PLAITNUM coin= when 100platinum coin used and 1 cc obtained, wait 3-5 secs untill use the cc to make 100 platinum again.

So people cant spam much
 
Last edited:
data/actions/scripts/other/changegold.lua
LUA:
local coins = {
	[ITEM_GOLD_COIN] = {
		to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
	},
	[ITEM_PLATINUM_COIN] = {
		from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
	},
	[ITEM_CRYSTAL_COIN] = {
		from = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_TEAL
	}
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, 5)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 4 * 1000)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM) or hasCondition(cid, CONDITION_EXHAUST, 5)) then
		return false
	end

	local coin = coins[item.itemid]
	if(not coin) then
		return false
	end

	doAddCondition(cid, exhaust)
	if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, coin.to, 1)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
	elseif(coin.from ~= nil) then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
	end
	return true
end
 
data/actions/scripts/other/changegold.lua
LUA:
local coins = {
	[ITEM_GOLD_COIN] = {
		to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
	},
	[ITEM_PLATINUM_COIN] = {
		from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
	},
	[ITEM_CRYSTAL_COIN] = {
		from = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_TEAL
	}
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, 5)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 4 * 1000)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM) or hasCondition(cid, CONDITION_EXHAUST, 5)) then
		return false
	end

	local coin = coins[item.itemid]
	if(not coin) then
		return false
	end

	doAddCondition(cid, exhaust)
	if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
		doChangeTypeItem(item.uid, item.type - item.type)
		doPlayerAddItem(cid, coin.to, 1)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
	elseif(coin.from ~= nil) then
		doChangeTypeItem(item.uid, item.type - 1)
		doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
		doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
	end
	return true
end


thx, is it true that, if many people use everytime non stop.
There will be lagg, or server can crash?
 
Back
Top