• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[Trinity] Reward LevelUper

amir_cinderella

Exalted Member
Hey Guys!
I'm Here To Release This Little System That I Think Really Useful.

What It DoEs ?

With this script you can made a event - > when player get level 30 or ... server will set max level your players and teleport your players to shop mall and give some money for buy item and ... , This will help your players have fun :)

link script : https://gist.github.com/irancore/11248607

I hope you like it!

Sry For Bad Eng ;)
 
Last edited:

Tommy

Founder
Very nice and thanks for sharing. Here's a few tips though:

You don't need to include 'ScriptMgr' and I don't believe you need to include 'Config.h', but I'll leave that in there since I'm not too sure. You could unify your code brackets like '{ }' as it looks better than '{}'. Also, when using 'PSendSysMessage', it kinda expects arguments. Use 'SendSysMessage' instead. Script is lacking indentation and has whitespaces that could be cleaned up. Instead of having two define directives, you could just add comments where people need to edit those values.

The hook "OnLevelChanged" does not have one parameter. It should be "OnLevelChanged(Player* player, uint8 oldLevel)".

Other than that everything else looks fine!

Code:
#include "Config.h"
 
class levelrewardonlevel : public PlayerScript
{
public:
    levelrewardonlevel() : PlayerScript("levelrewardonlevel") { }

    void OnLevelChanged(Player* player, uint8 oldLevel)
    {
        if (oldLevel == 29 && player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) // CHANGE 30 to your LEVEL requirement
        {
            player->SetLevel(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
            player->ModifyMoney(50000000); // CHANGE MONEY VALUE HERE
            player->TeleportTo(1, -3709.901123f, 1084.681641f, 131.969360f, 5.293728f); // MapId, X, Y, Z, O shop mall
            ChatHandler(player->GetSession()).SendSysMessage("Your character has leveled so fast that you have earned MaxLevel!");
        }
    }
};

void AddSC_levelrewardonlevel()
{
    new levelrewardonlevel();
}
 

Rochet2

Moderator / Eluna Dev
Im not sure if this part is correct:
I think if the player for example have 30k gold, this set his gold to 5k, I would use
If Im wrong please correct me.

Regards, Eleinder.

ModifyMoney takes an int, which will determine how much money is added or removed. The amount is in copper.
The function you are talking about would be SetMoney.
 
Top