[SIMPLE CODE RELEASE] GM Zuly Command
Hello RageZoners!
I'm bored and I have nothing better to do so I'm making some gm commands/updates in the erose source :)
With this command you can Add/Remove/Set/Drop zulie(GM COMMAND)
OPEN FILE: gmcmds.cpp
FIND:
Code:
else if (strcmp(command, "ann")==0)
{
return pakGMAnn(thisclient, P);
}
AFTER ADD:
Code:
else if (strcmp(command, "zuly")==0) {
if ((tmp = strtok_s(NULL, " ", &next_token))==NULL)
{
BEGINPACKET( pak, 0x702 );
ADDSTRING( pak, "Zuly command usage: /zuly mode(1=ADD 2=REMOVE 3=DROP 4=SET) amount charname(this can also be yourself)" );
ADDBYTE( pak, 0 );
thisclient->SendPacket( &pak );
return true;
}
unsigned mode=atoi(tmp);
if ((tmp = strtok_s(NULL, " ", &next_token))==NULL)
{
BEGINPACKET( pak, 0x702 );
ADDSTRING( pak, "Zuly command usage: /zuly mode(1=give 2=drop 3=set 4=remove) amount charname(this can also be yourself)" );
ADDBYTE( pak, 0 );
thisclient->SendPacket( &pak );
return true;
}
unsigned amount=atoi(tmp);
if ((tmp = strtok_s(NULL, " ", &next_token))==NULL)
{
BEGINPACKET( pak, 0x702 );
ADDSTRING( pak, "Zuly command usage: /zuly mode(1=ADD 2=REMOVE 3=DROP 4=SET) amount charname(this can also be yourself)" );
ADDBYTE( pak, 0 );
thisclient->SendPacket( &pak );
return true;
}
char* charname=tmp;
return pakGMZuly( thisclient, mode, amount, charname );
}
FIND:
Code:
// -----------------------------------------------------------------------------------------
// GM: Announcement
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMAnn( CWorldClient* thisclient, CPacket* P )
{
BEGINPACKET( pak, 0x702 );
ADDSTRING( pak, thisclient->charname );
ADDSTRING( pak, ": " );
ADDSTRING( pak, (&P->Buffer[5]) );
ADDBYTE( pak, 0 );
SendToAll( &pak );
return true;
}
AFTER ADD:
Code:
// -----------------------------------------------------------------------------------------
// GM: Add/Remove/Drop/Set zuly
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMZuly( CWorldClient* thisclient, int mode, int amount, char* charname )
{
CWorldClient* otherclient = GetClientByCharName(charname);
if (mode == 1)
{
//ADD
otherclient->c_zuly += amount;
BEGINPACKET( pak, 0x71d );
ADDQWORD( pak, otherclient->c_zuly );
otherclient->SendPacket( &pak );
}
if (mode == 2)
{
//REMOVE
otherclient->c_zuly -= amount;
BEGINPACKET( pak, 0x71d );
ADDQWORD( pak, otherclient->c_zuly );
otherclient->SendPacket( &pak );
}
if (mode == 3)
{
//DROP
CDrop* thisdrop = new CDrop;
thisdrop->clientid = GetNewClientID();
thisdrop->type = 1; // ZULY
thisdrop->pos.x = otherclient->pos.x;
thisdrop->pos.y = otherclient->pos.y;
thisdrop->posMap = otherclient->posMap;
thisdrop->droptime = time(NULL);
thisdrop->amount = amount;
thisdrop->owner = 0;
DropsList.push_back( thisdrop );
}
if (mode == 4)
{
//SET
otherclient->c_zuly = amount;
BEGINPACKET( pak, 0x71d );
ADDQWORD( pak, otherclient->c_zuly );
otherclient->SendPacket( &pak );
}
return true;
}
CLOSE FILE: gmcmds.cpp
OPEN FILE: worldsockets.h
FIND:
Code:
bool pakGMAnn ( CWorldClient* thisclient, CPacket* P );
AFTER ADD:
Code:
bool pakGMZuly ( CWorldClient* thisclient, int mode, int amount, char* charname );
CLOSE FILE: worldsockets.h
I know its a bit simple, but its usefull and my source didnt had this already :)
If this is already posted, I will remove it!
-If it doesnt work, or I made an mistake, post it and I will try to fix it!-
YOU WILL NEED THIS FUNCTION BY CAALI:
Quote:
Originally Posted by
Sander122
I learned c++ in a uhm.. month?
Its really easy, and I know this code doesnt work.
I Forgot to add something:
A function by Caali -
Code:
CWorldClient* otherclient = GetClientByCharName(charname);
Caali also uses this much, thats the reason why it doesnt work for you all!
You can get Caalis Function here!
-Btw if you readed his topic you should have seen this:
Functions (could help you at coding / are needed for my scripts):
-I WONT COMPILE THIS, IF YOU CANT COMPILE, DONT ASK ME, I HAVE POSTED EVERYTHING WHATS NEEDED AND IT SHOULD WORK!