Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

New Buff/CallEvent.dll

Newbie Spellweaver
Joined
Jul 2, 2014
Messages
29
Reaction score
94
Location
Germany
Yo guys so I want to release my first dll for this community since I got kicked by an private server as admin I started with programming

So I am a newbe in this C++ programming.

I hope you will enjoy this dll I wont crypt it or something else.
Functions of this .dll are:
- /custombuff [BuffID] [BuffCD] [BuffGrade] - Every online Player will get this buff!
- /playerbuff [PlayerName] [BuffID] [BuffCD] [BuffGrade] - Selected online Player will get this buff!
- /buffevent - Every online Player will get the standart buffs as G4
- /strongbuffevent -Every online Player will get the standart buffs as G10!
- /callevent - Every online Player will get the standart calls as G4
- /strongcallevent - Every online Player will get the standart calls as G10
- /areabuff [Range] [BuffCD] [BuffGrade] - Every online Player who is in that range from you will get this buff!
- /help -There you can get all functions of the dll
- /getbuff [BuffID] - with this function you can see the name of the buff compares to the BuffID!

A Special thanks goes to Darn. He helped me alot and was very helpful for me!

So here we go: (newer version with some fixings)
View attachment BuffCallEvent.zip

Okay I will post it directly here and change some things at the dll now!

The Source Code:

Code:
#undef UNICODE#pragma comment(lib, "KosaLib.lib")
#include "stdafx.h"
#include <KServer.h>
#include <KPlayer.h>
#include <KCommand.h>
#include <KMonster.h>


using namespace std;
class ICommand
{
    private:
        KPlayer *player;
        KCommand *command;
        int *playerp;


    public:
    ICommand(int *playerptr, char *comm)
    {
        this->player = new KPlayer(playerptr);
        this->playerp = playerptr;
        this->command = new KCommand(comm);
    } 


    void buffall();
    void areabuff();
    void help();
    void buffplayer();
    void getbuff();
    void getonlineplayer();
    void buffevent();
    void strongbuffevent();
    void callevent();
    void strongcallevent();
    virtual ~ICommand();
};

Code:
#include "stdafx.h"#include "Command.h"
#include "Features.h"
#include <cstring>


#define ENTER_CRIT Server::CIOCriticalSection::Enter((void*)0x004e2078); Server::CIOCriticalSection::Enter((void*)0x004e2098); Server::CLink::MoveTo((void*)0x004e200c,(int)0x004e2004); Server::CIOCriticalSection::Leave((void*)0x004e2098);
#define GET_PLAYER_LIST for ( DWORD pp = *(DWORD*)0x004e2004; pp != 0x004e2004; pp = *(DWORD*)pp)
#define PLAYER_POINTER (int*)(pp-428)
#define LEAVE_CRIT Server::CIOCriticalSection::Leave((void*)0x004e2078);


void ICommand::buffall()
{
    if(this->command->beginWith("/custumbuff") && this->player->isAdmin())
    {
        int BuffID = this->command->GetIntValue(1);
        int BuffCD = this->command->GetIntValue(2);
        int BuffState = this->command->GetIntValue(3);
        char Message[1024];
        char Notice[1024];
        Features features;
        string name = features.bufflist(BuffID);
        char * buffer = new char[name.length()];
        strcpy(buffer,name.c_str());
        sprintf_s(Message, "&All Player got the Buff: %s Duration: %i Buff Grade: %i!", buffer, BuffCD, BuffState);
        sprintf_s(Notice, "You got the Buff: %s Duration: %i Buff Grade: %i!", buffer, BuffCD, BuffState);
        if(BuffID <= 0 || BuffCD <= 0 || BuffState <= 0)
            {
                player->PlayerMessage("Server", "#Invalid Arguments!");
            }
        else if(BuffID > 0 && BuffCD > 0 && BuffState > 0)
            {
                ENTER_CRIT
                GET_PLAYER_LIST
                {
                    KPlayer Target(PLAYER_POINTER);
                    Target.Buff(BuffID, BuffCD, BuffState);
                    Target.Notice(Notice);
                }
                LEAVE_CRIT
                this->player->PlayerMessage("Server",Message);
                delete[] buffer;
            }
    }


}
void ICommand::buffplayer()
{
    if(this->command->beginWith("/playerbuff") && this->player->isAdmin())
    {
        string name = "NULL";
        name = this->command->GetStrValue(1);
        int BuffID = this->command->GetIntValue(2);
        int BuffCD = this->command->GetIntValue(3);
        int BuffState = this->command->GetIntValue(4);
        char Message[1024];
        char Notice[1024];
        char * buffer = new char[name.length()];
        strcpy(buffer,name.c_str());
        Features features;
        string bez = features.bufflist(BuffID);
        char * buffer2 = new char[bez.length()];
        strcpy(buffer2,bez.c_str());
        sprintf_s(Message, "&%s got the Buff: %s Duration: %i Buff Grade: %i",buffer, buffer2, BuffCD, BuffState);
        sprintf_s(Notice, "%s, You got the Buff: %s Duration: %i Buff Grade: %i!",buffer, buffer2, BuffCD, BuffState);
        if(BuffID <= 0 || BuffCD <= 0 || BuffState <= 0){
                player->PlayerMessage("Server", "#Invalid Arguments!");
            }
        else if(BuffID > 0 && BuffCD > 0 && BuffState > 0)
            {
                ENTER_CRIT
                GET_PLAYER_LIST
                {
                    KPlayer Target(PLAYER_POINTER);
                    if(name.compare(Target.GetName())==0){
                        Target.Buff(BuffID,BuffCD,BuffState);
                        Target.Notice(Notice);    }
                }
                LEAVE_CRIT
                this->player->PlayerMessage("Server",Message);
            }
        delete[] buffer;
        delete[] buffer2;
    }
}
void ICommand::buffevent()
{
    if(this->command->beginWith("/buffevent") && this->player->isAdmin())
    {
                ENTER_CRIT
                GET_PLAYER_LIST
                {
                    KPlayer Target(PLAYER_POINTER);
                    Target.Buff(46,1800,4);
                    Target.Buff(47,1800,4);
                    Target.Buff(48,1800,4);
                    Target.Buff(49,1800,4);
                    Target.Buff(50,1800,4);
                    Target.Buff(36,1800,4);
                    Target.Notice("Buffevent started! Enjoy your G4 buffs!");
                }
                LEAVE_CRIT
                this->player->PlayerMessage("Server","The G4 Buffevent is started!");
    }


}
void ICommand::strongbuffevent()
{
    if(this->command->beginWith("/strongbuffevent") && this->player->isAdmin())
    {
                ENTER_CRIT
                GET_PLAYER_LIST
                {
                    KPlayer Target(PLAYER_POINTER);
                    Target.Buff(46,1800,10);
                    Target.Buff(47,1800,10);
                    Target.Buff(48,1800,10);
                    Target.Buff(49,1800,10);
                    Target.Buff(50,1800,10);
                    Target.Buff(36,1800,10);
                    Target.Notice("Buffevent started! Enjoy your G10 buffs!");
                }
                LEAVE_CRIT
                this->player->PlayerMessage("Server","The G10 Buffevent is started!");
    }


}
void ICommand::callevent()
{
    if(this->command->beginWith("/callevent") && this->player->isAdmin())
    {
                ENTER_CRIT
                GET_PLAYER_LIST
                {
                    KPlayer Target(PLAYER_POINTER);
                    Target.Buff(70,1800,4);
                    Target.Buff(71,1800,4);
                    Target.Buff(72,1800,4);
                    Target.Buff(73,1800,4);
                    Target.Buff(74,1800,4);
                    Target.Buff(76,1800,4);
                    Target.Buff(77,1800,4);
                    Target.Buff(78,1800,4);
                    Target.Buff(79,1800,4);
                    Target.Notice("Callevent started! Enjoy your G4 calls!");
                }
                LEAVE_CRIT
                this->player->PlayerMessage("Server","The G4 Callevent is started!");
    }


}
void ICommand::strongcallevent()
{
    if(this->command->beginWith("/strongcallevent") && this->player->isAdmin())
    {
                ENTER_CRIT
                GET_PLAYER_LIST
                {
                    KPlayer Target(PLAYER_POINTER);
                    Target.Buff(70,1800,10);
                    Target.Buff(71,1800,10);
                    Target.Buff(72,1800,10);
                    Target.Buff(73,1800,10);
                    Target.Buff(74,1800,10);
                    Target.Buff(76,1800,10);
                    Target.Buff(77,1800,10);
                    Target.Buff(78,1800,10);
                    Target.Buff(79,1800,10);
                    Target.Notice("Callevent started! Enjoy your G10 calls!");
                }
                LEAVE_CRIT
                this->player->PlayerMessage("Server","The G10 Callevent is started!");
    }


}
void ICommand::areabuff()
{
    int GAdmin = 8;
     if(this->command->beginWith("/areabuff") && this->player->GetAdmin()>=GAdmin)
        {
                int *pPlayer, *pObject;
                int Range = this->command->GetIntValue(1);
                int BuffID = this->command->GetIntValue(2);
                int BuffCD = this->command->GetIntValue(3);
                int BuffState = this->command->GetIntValue(4);
                char Message[1024];
                char Notice[1024];
                Features features;
                string bez = features.bufflist(BuffID);
                char * buffer2 = new char[bez.length()];
                strcpy(buffer2,bez.c_str());
                sprintf_s(Message, "&All Player in the Range of %i got the Buff: %s Duration: %i Buff Grade: %i",Range, buffer2, BuffCD, BuffState);
                pObject = Server::CPlayer::GetObjectsAround(this->playerp[80], &this->playerp[81], Range);
                if(Range<=0 || BuffID <= 0 || BuffCD <= 0 || BuffState <= 0){
                    player->PlayerMessage("Server", "#Invalid Arguments!");
                }
                else if(Range>50){
                    this->player->PlayerMessage("Server","#The Range must be under 50!");
                }
                else if(Range>0 && Range<=50 && BuffID > 0 && BuffCD > 0 && BuffState > 0){
                while(pObject)
                {
                    pPlayer = (int*)*(int*)pObject;
                    if(this->playerp != pPlayer)
                    {
                        KPlayer Player(pPlayer);
                        Player.Buff(BuffID,BuffCD,BuffState);
                        Player.Notice(Message);
                    }
                    pObject = Server::CBaseList::Pop(pObject);
                }
                this->player->PlayerMessage("Server",Message);
     }
                delete[] buffer2;
  }
}
void ICommand::help()
{
    int GAdmin = 0;
    if(this->command->beginWith("/help") && this->player->GetAdmin()>GAdmin)
        {
                this->player->PlayerMessage("Server","$BlueDragons Buff/CallEvent Help!");
                this->player->PlayerMessage("Server","*/custombuff [BuffID] [BuffCD] [BuffGrade] -for Admins only!");
                this->player->PlayerMessage("Server","*/playerbuff [PlayerName] [BuffID] [BuffCD] [BuffGrade] -for Admins only!");
                this->player->PlayerMessage("Server","*/buffevent -for Admins only!");
                this->player->PlayerMessage("Server","*/strongbuffevent -for Admins only!");
                this->player->PlayerMessage("Server","*/callevent -for Admins only!");
                this->player->PlayerMessage("Server","*/strongcallevent -for Admins only!");
                this->player->PlayerMessage("Server","*/areabuff [Range] [BuffID] [BuffCD] [BuffGrade] -for Admins/GMs only!");
                this->player->PlayerMessage("Server","*/getbuff [BuffID] -for Admins/GMs and SPs only!");
                this->player->PlayerMessage("Server","*/getonlineplayer -for everyone!");
     }
  }
void ICommand::getbuff()
{
    int GAdmin = 0;
    if(this->command->beginWith("/getbuff") && this->player->GetAdmin()>GAdmin)
    {
        int BuffID = this->command->GetIntValue(1);
        Features features;
        string bez = features.bufflist(BuffID);
        char * buffer = new char[bez.length()];
        strcpy(buffer,bez.c_str());
        char Message[1024];
        sprintf_s(Message, "$The Buff %s got the BuffID: %i",buffer, BuffID);
        this->player->PlayerMessage("Buff System",Message);
        delete[] buffer;
    }
}


void ICommand::getonlineplayer()
{
    int GAdmin = 0;
    if(this->command->beginWith("/getonlineplayer") && this->player->GetAdmin()>=GAdmin)
    {
        string name = "NULL";
        int level;
        char Message[1024];
        GET_PLAYER_LIST
        {
            KPlayer Target(PLAYER_POINTER);
            name = Target.GetName();
            level = Target.GetLevel();
            char * buffer = new char[name.length()];
            strcpy(buffer,name.c_str());
            sprintf_s(Message, "$The Player %s (Level %i) is online!", buffer,level);
            this->player->PlayerMessage("Server",Message);
            delete[] buffer;
        }
    }
}
ICommand::~ICommand(){}
 

Attachments

Last edited:
Nice release but it dosen't work on mine, is there meant to be a, Reading [BuffCallEvent] . . .
in the main server? I use Obsidian and placed it in DLLLoader folder.

-W
 
the procedure entry point flushprocess writebufferes couldnt be located in the dynamic link library KERNEL32.dll
some one could explain ?:D
 
How does the /custombuff work?

i tryed:
/custombuff 12 3600 4
as 12=speed medicine CD=3600 4=Grade

also tryed=
/custombuff [BuffID 12] [BuffCD 3600] BuffGrade 4]

any help please?

-W
 
Thanks for this release mates but can i ask you how to add a timer in you're codes or a command to disabled them ? greatings
 
Ok guys, the dll works on my server as i said, but i just tested it on my local system.

On my winserver it doesn't load. So - after some "research" i can tell you how to fix: Install c++ redistributable package 2012 (i installed x86 & x64 cuz i got x64 system).

After installing it, your server will load the dll

-------------------------------------------------------------
Edit: Ok, it starts but crashes on command. How could it be that it works perfect on win 7 but crashes on winserver 2008 R2 enterprise?
 
Last edited:
okay I edited my post and added the source code and uploaded a newer dll version
So yeah I've tested it a bit, noticed a bug.
When you use area buff within the range of another player, he/she gets the buff you entered without a problem... but when there's a mob in the range radius of your area buff, the server crashes.
You should upload another version of your awesome dll :D
 
Last edited:
Back