local config =
{
storage = 1112,
item = {2160,1},
level = 25
}
function onAdvance(cid, skill, oldLevel, newLevel)
local storage = getPlayerStorageValue(cid, config.storage)
if (skill == SKILL__LEVEL and newLevel == config.level and storage == -1) then
doPlayerAddItem(cid, config.item[1], config.item[2])
doPlayerSendTextMessage(cid,21,'Gratz on level 25! We rewarded you with 10k to make your life easier.')
setPlayerStorageValue(cid, config.storage, 1)
end
return true
end
registerCreatureEvent(cid, "levelplayer")
<event type="advance" name="levelplayer" script="reward.lua"/>
i want to change 100cc into 1 golden nugget and i dont know how to? do you have the script?![]()
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, to = ITEM_GOLD_NUGGET, effect = TEXTCOLOR_TEAL
},
[ITEM_GOLD_NUGGET] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_YELLOW
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
return false
end
local coin = coins[item.itemid]
if(not coin) then
return false
end
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
ITEM_GOLD_COIN = 2148
ITEM_PLATINUM_COIN = 2152
ITEM_CRYSTAL_COIN = 2160
[COLOR=#ff0000]ITEM_GOLD_NUGGET = 2157[/COLOR]
<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
<attribute key="weight" value="10" />
<attribute key="worth" value="1000000" />
</item>