Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

My /add command code :P

Newbie Spellweaver
Joined
Oct 19, 2007
Messages
20
Reaction score
0
Here is my /add command :p
thanks to Yukura & leo123 for the help :p

here is it:

Code:
void AddStats(int aIndex)
{
    if (!IsAddCmd) return;
    cObj->Init(aIndex);
    if (!strcmpi(Message, "/add"))
    {
        MessageOutput(aIndex, "Useage: /add <Type> <Amount>");
        MessageOutput(aIndex, "The price for Add is: %d, Maximum stats: %d", AddPrice, AddMax);
        return;
    }
    if (cObj->Money < AddPrice)
    {
        MessageOutput(aIndex, "You are lacking zen! %d", AddPrice - cObj->Money);
        return;
    }
    char Param1[100];
    memset(Param1, 0x00, 100);
    GetParam(1, Message, Param1);
    int AddType = 0;
    if (!strcmpi(Param1, "str")) AddType = 0xB8;
    if (!strcmpi(Param1, "agi")) AddType = 0xBA;
    if (!strcmpi(Param1, "vit")) AddType = 0xBC;
    if (!strcmpi(Param1, "eng")) AddType = 0xBE;
    if (!strcmpi(Param1, "cmd")) AddType = 0xD8;
    if (!AddType)
    {
        MessageOutput(aIndex, "You have selected wrong type! The types are: str, agi, vit, eng, cmd");
        return;
    }
    if (cObj->Class != 4 && AddType == 0xD8)
    {
        MessageOutput(aIndex, "Only Dark Lords can use the add cmd type.");
        return;
    }
    char Param2[100];
    memset(Param2, 0x00, 100);
    GetParam(2, Message, Param2);
    int StatsToAdd = atoi(Param2);
    if (cObj->LvlUpPoints < StatsToAdd)
    {
        MessageOutput(aIndex, "You are lacking level up points! %d", StatsToAdd - cObj->LvlUpPoints);
        return;
    }
    int NowStats = cObj->GetWord(AddType);
    if ((StatsToAdd + NowStats) > AddMax)
    {
        MessageOutput(aIndex, "You are not allowed to add more than %d points!", AddMax);
        return;
    }
    BYTE Packet[5] = {0xC1, 0x05, 0x0F3, 0x06};
    Packet[4] = ((AddType % 16) ^ 8) / 2; // Nice algorithm by coNsept to convert from gObj Offsets to the add types :P
    if (AddType == 0xD8) Packet[4] = 0x04;
    if (StatsToAdd <= 100)
        for (int i=0; i<StatsToAdd; i++)
            CGLevelUpPointAdd(Packet, aIndex);
    else
    {
        int Amount = (cObj->LvlUpPoints - StatsToAdd - 1);
        cObj->SetInt(0xA4, Amount);
        cObj->AddInt(AddType, StatsToAdd - 1);
        CGLevelUpPointAdd(Packet, aIndex);
    }
    cObj->SetInt(0xB4, cObj->Money - AddPrice);
    CGMoneySend(aIndex, cObj->Money - AddPrice);
    cObj->Init(aIndex);
    MessageOutput(aIndex, "You've added %d points. You have now %d points left.", StatsToAdd, cObj->LvlUpPoints);
    if (StatsToAdd > 100)
        MessageOutput(aIndex, "Please relog and your stats will be updated.");
}
I'm using CzF's 1.00.08 GS.. :p

Enjoy xD
 
Newbie Spellweaver
Joined
Apr 7, 2007
Messages
8
Reaction score
0
Re: [Release] My /add command code :P

GOod job very good using now ;D
 
Legendary Battlemage
Loyal Member
Joined
Nov 3, 2006
Messages
648
Reaction score
2
Re: [Release] My /add command code :P

/add what ? :)
 
Junior Spellweaver
Joined
Jul 5, 2007
Messages
181
Reaction score
9
Re: [Release] My /add command code :P

Wows thank you i will try to add it into the Luciano's last release.
 
Experienced Elementalist
Joined
Aug 25, 2005
Messages
253
Reaction score
20
Re: [Release] My /add command code :P

You're amazing. :|
 
iNewLegend , Leo123
Joined
Apr 26, 2006
Messages
296
Reaction score
81
Re: [Release] My /add command code :P

good work liad :p
 
Newbie Spellweaver
Joined
Oct 22, 2005
Messages
64
Reaction score
0
Re: [Release] My /add command code :P

this works fine? not need swith character, right?

PD: kudo if you add the code to luciano files can upload it pls? Thanks
 
Junior Spellweaver
Joined
Jul 24, 2007
Messages
139
Reaction score
30
Re: [Release] My /add command code :P

Nope, i am not a C++ coder but yes an ASM coder, and i can easily understand the code and this part says:

Code:
  MessageOutput(aIndex, "You've added %d points. You have now %d points left.", StatsToAdd, cObj->LvlUpPoints);
    if (StatsToAdd > 100)
        MessageOutput(aIndex, "Please relog and your stats will be updated.");
}
That if you put more than 100 points you need to relog the character, if not you don
 
Newbie Spellweaver
Joined
Oct 22, 2005
Messages
64
Reaction score
0
Re: [Release] My /add command code :P

cool, now i could understand, thanks holy.
 
Newbie Spellweaver
Joined
Oct 19, 2007
Messages
20
Reaction score
0
Re: [Release] My /add command code :P

this works fine? not need swith character, right?

PD: kudo if you add the code to luciano files can upload it pls? Thanks

without relog it will take alot of CPU and cause some lags...
because if you add below 100 points its doing loop that doing the function when you click on the plus button in the character menu, so if you add 32000 points with it, it will do a loop of 32000 times and there will be alot of lags and waste of CPU...
 
Master Summoner
Loyal Member
Joined
Jun 17, 2006
Messages
549
Reaction score
3
Re: [Release] My /add command code :P

With my 1 month of c++ i understood most of it xP

To make it infinite (32767) just edit:

if (StatsToAdd > XXX)
MessageOutput(aIndex, "Please relog and your stats will be updated.");
}

Put 32768 there if u want unlimited

BYTE Packet[5] = {0xC1, 0x05, 0x0F3, 0x06};
Packet[4] = ((AddType % 16) ^ 8) / 2; // Nice algorithm by coNsept to convert from gObj Offsets to the add types :p
if (AddType == 0xD8) Packet[4] = 0x04;
if (StatsToAdd <= XXXXXX)
for (int i=0; i<StatsToAdd; i++)
CGLevelUpPointAdd(Packet, aIndex);


Put 32767 there for unlimited.


/Edit: Enjoy xD
 
Member
Joined
Jan 10, 2007
Messages
530
Reaction score
12
Re: [Release] My /add command code :P

hey, that's nice, but how to add it? could u post guide?
 
Newbie Spellweaver
Joined
Oct 19, 2007
Messages
20
Reaction score
0
Re: [Release] My /add command code :P

With my 1 month of c++ i understood most of it xP

To make it infinite (32767) just edit:

if (StatsToAdd > XXX)
MessageOutput(aIndex, "Please relog and your stats will be updated.");
}

Put 32768 there if u want unlimited

BYTE Packet[5] = {0xC1, 0x05, 0x0F3, 0x06};
Packet[4] = ((AddType % 16) ^ 8) / 2; // Nice algorithm by coNsept to convert from gObj Offsets to the add types :p
if (AddType == 0xD8) Packet[4] = 0x04;
if (StatsToAdd <= XXXXXX)
for (int i=0; i<StatsToAdd; i++)
CGLevelUpPointAdd(Packet, aIndex);


Put 32767 there for unlimited.


/Edit: Enjoy xD

Yes :p
And if you want it always be the max stats, you can just do
If (StatsToAdd <= AddMax)
 
Member
Joined
Jan 10, 2007
Messages
530
Reaction score
12
Re: [Release] My /add command code :P

WOW.. i didnot understand anything. im not a coder, please tell me how to add this; Skype: tautviux55884
 
Newbie Spellweaver
Joined
Oct 22, 2005
Messages
64
Reaction score
0
Re: [Release] My /add command code :P

hehe me too can anybody copy/paste this codes into the lucianoairbar files?

PD: where can i learn to be a coder C++? =P
 
Newbie Spellweaver
Joined
Mar 6, 2007
Messages
21
Reaction score
0
Re: [Release] My /add command code :P

zolamu, about the offsets.. what offset i know to find? and.. i compile this code in one dll?
 
Member
Joined
Jan 10, 2007
Messages
530
Reaction score
12
Re: [Release] My /add command code :P

how to add this to czf season1 full???
 
Back
Top