Newbie Spellweaver
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:
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: