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

When You get Level x You Get Money X

Rambo

☠ Hazard ☠
Joined
Dec 11, 2010
Messages
2,694
Reaction score
100
Location
Bahrain
This might be basic one
But This is my first tutorial
Wish you like it :)
Example: You Reach level 50 You get 50 crystal coin
Data-->Creaturescript-->Scripts
Add new file and call it getmoney.lua
And add this in it
Code:
local config = {
                levelReach = 50,
                item = 2160,
                count = 50
                }
 
function onAdvance(cid, skill, oldLevel, newLevel)
 
if(skill == SKILL__LEVEL and newLevel >= config.levelReach and getPlayerStorageValue(cid, 58557) == -1) then
        setPlayerStorageValue(cid, 58557, 1)
        doPlayerAddItem(cid, config.item, config.count)
end
 
return TRUE
end

Now Go to Creaturescripts.xml
And add this
Code:
<event type="advance" name="getmoney" event="script" value="getmoney.lua"/>
Rep+ if i helped you :)
 
I merely present this in hopes you learn from it.
~/data/../mods/getmoney.xml
Code:
<?[COLOR=darkorange]xml version[/COLOR]="1.0" [COLOR=darkorange]encoding[/COLOR]="UTF-8"?>
<[COLOR=darkorange]mod name[/COLOR]="Level Advance Rewards" [COLOR=darkorange]version[/COLOR]="1.0" [COLOR=darkorange]author[/COLOR]="RushCrush" [COLOR=darkorange]contact[/COLOR]="http://otland.net" [COLOR=darkorange]enabled[/COLOR]="yes">
    [COLOR=blue]<!-- Level advance rewards. Modularized and debugged by Lessaire. -->[/COLOR]
    <[COLOR=darkorange]description[/COLOR]>[COLOR=yellow]<![CDATA[    When You get Level x You Get Money X    ]]>[/COLOR]</[COLOR=darkorange]description[/COLOR]>
    <[COLOR=darkorange]config name[/COLOR]="advLevelConfig">[COLOR=red]<![CDATA[
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]]--
--[[~~ Originally by RushCrush @ http://otland.net ~~]]--
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]]--
local config = {
    levelReach =    50,
    rewardStorage = 58557,
    rewardItem =    2160,
    rewardCount =   50
    }
     ]]>[/COLOR]</[COLOR=darkorange]config[/COLOR]>
    <[COLOR=darkorange]event type[/COLOR]="advance" [COLOR=darkorange]name[/COLOR]="advLevelReward" [COLOR=darkorange]event[/COLOR]="script">[COLOR=red]<![CDATA[
domodlib("advLevelConfig")
function onAdvance(cid, skill, oldLevel, newLevel)
    if(skill == SKILL__LEVEL and newLevel >= config.levelReach and getPlayerStorageValue(cid, config.rewardStorage) == EMPTY_STORAGE) then
        setPlayerStorageValue(cid, config.rewardStorage, 1)
        doPlayerAddItem(cid, config.rewardItem, config.rewardCount)
    end
    return true
end
    ]]>[/COLOR]</[COLOR=darkorange]event[/COLOR]>
</[COLOR=darkorange]mod[/COLOR]>
 
Last edited:
if im lvl 50, I got the reward, but if im 51 and loss 1 lvl i get the moeny again?

You really can't just LOOK AT THE CODE and tell?
Code:
[COLOR=red]function onAdvance(cid, skill, oldLevel, newLevel)
    if(skill == SKILL__LEVEL and newLevel >= config.levelReach and getPlayerStorageValue(cid, config.rewardStorage) == EMPTY_STORAGE) then[/COLOR]
        setPlayerStorageValue(cid, config.rewardStorage, 1)
        doPlayerAddItem(cid, config.rewardItem, config.rewardCount)
    end
    return true
end
 
and if i want to add a msg? like "Congratulazions You Reached level 50 here is 50k for you to spend!" dont post a full script just learn me how to do if u now how :p


thankz in regardz
 
I merely present this in hopes you learn from it.
Code:
<?[COLOR=darkorange]xml version[/COLOR]="1.0" [COLOR=darkorange]encoding[/COLOR]="UTF-8"?>
<[COLOR=darkorange]mod name[/COLOR]="Level Advance Rewards" [COLOR=darkorange]version[/COLOR]="1.0" [COLOR=darkorange]author[/COLOR]="RushCrush" [COLOR=darkorange]contact[/COLOR]="http://otland.net" [COLOR=darkorange]enabled[/COLOR]="yes">
    [COLOR=blue]<!-- Level advance rewards. Modularized and debugged by Lessaire. -->[/COLOR]
    <[COLOR=darkorange]description[/COLOR]>[COLOR=yellow]<=!=[=C=D=A=T=A=[    When You get Level x You Get Money X    ]=]=>[/COLOR]</[COLOR=darkorange]description[/COLOR]>
    <[COLOR=darkorange]config name[/COLOR]="advLevelConfig">[COLOR=red]<=!=[=C=D=A=T=A=[
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]]--
--[[~~ Originally by RushCrush @ http://otland.net ~~]]--
--[[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]]--
local config = {
    levelReach =    50,
    rewardStorage = 58557,
    rewardItem =    2160,
    rewardCount =   50
    }
     ]=]=>[/COLOR]</[COLOR=darkorange]config[/COLOR]>
    <[COLOR=darkorange]event type[/COLOR]="advance" [COLOR=darkorange]name[/COLOR]="advLevelReward" [COLOR=darkorange]event[/COLOR]="script">[COLOR=red]<=!=[=C=D=A=T=A=[
domodlib("advLevelConfig")
function onAdvance(cid, skill, oldLevel, newLevel)
    if(skill == SKILL__LEVEL and newLevel >= config.levelReach and getPlayerStorageValue(cid, config.rewardStorage) == EMPTY_STORAGE) then
        setPlayerStorageValue(cid, config.rewardStorage, 1)
        doPlayerAddItem(cid, config.rewardItem, config.rewardCount)
    end
    return true
end
    ]=]=>[/COLOR]</[COLOR=darkorange]event[/COLOR]>
</[COLOR=darkorange]mod[/COLOR]>
the config should all be global not local
 
Doesnt want to work :(

RushCruch's script crashed my server and Fallen'n just didn't work. Any ideas?
 
Back
Top