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

I need a script that gives players a reward when they reach certain levels

Samaster

Raptorserver.ddns.net
Joined
Jun 9, 2013
Messages
291
Reaction score
23
Location
UK
Hey, i need someone who knows the script that spawns (example 5cc when they reach level 50).. Like a reward system for when they reached desired levels please?:)
 
reward.lua
Code:
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
login.lua
Code:
registerCreatureEvent(cid, "levelplayer")
creaturescripts.xml
Code:
 <event type="advance" name="levelplayer" script="reward.lua"/>
 
thank you:) and can you help me with the currency..
i want to change 100cc into 1 golden nugget and i dont know how to? do you have the script?:)
 
i want to change 100cc into 1 golden nugget and i dont know how to? do you have the script?
smile.gif

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, 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

lib/000-constant.lua, insert ITEM_GOLD_NUGGET like this
Code:
ITEM_GOLD_COIN = 2148
ITEM_PLATINUM_COIN = 2152
ITEM_CRYSTAL_COIN = 2160
[COLOR=#ff0000]ITEM_GOLD_NUGGET = 2157[/COLOR]

This has not been tested, took the code from TFS 0.3.6 and just added a new coin (gold nugget).

Don't forget to give them a new attribute as well, (worth)
XML:
<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
    <attribute key="weight" value="10" />
    <attribute key="worth" value="1000000" />
</item>
 
Last edited:
my 000-constant is full of random shit? idk where to add it?

Edited:
It doesn't work? I am using cryingdamson 0.3.6 (8.60) V8.2 (TheForgottenServer).. Well it works, but i cant turn golden nuggets into Crystal coins again:/

Nevermind i found out what i was missing, dont worry (SOLVED)
 
Last edited:
Back
Top