PDA

View Full Version : #Lastname Change.


Kingly_Krab
11-07-2013, 06:08 PM
I changed my #lastname so it has almost the full functionality of #title.

Change this in command.cpp (Lines 4203 - 4215):
void command_lastname(Client *c, const Seperator *sep)
{
Client *t=c;

if(c->GetTarget() && c->GetTarget()->IsClient())
t=c->GetTarget()->CastToClient();
LogFile->write(EQEMuLog::Normal,"#lastname request from %s for %s", c->GetName(), t->GetName());

if(strlen(sep->arg[1]) <= 70)
t->ChangeLastName(sep->arg[1]);
else
c->Message(0, "Usage: #lastname <lastname> where <lastname> is less than 70 chars long");
}

To this:
void command_lastname(Client *c, const Seperator *sep)
{
Client *t=c;
if(sep->arg[1][0] == 0)
c->Message(0, "Usage: #lastname [remove|text] - remove or set lastname to 'text'");
else
{
if(c->GetTarget() && c->GetTarget()->IsClient())
t=c->GetTarget()->CastToClient();
else if(c->GetTarget() && !c->GetTarget()->IsClient())
{
c->Message(13, "#lastname only works on players.");
return;
}
else if(!c->GetTarget())
{
t = c;
}
LogFile->write(EQEMuLog::Normal,"#lastname request from %s for %s", c->GetName(), t->GetName());

if(strlen(sep->arg[1]) <= 70)
t->ChangeLastName(sep->arg[1]);
else
c->Message(0, "Lastname must be 70 characters or less.");

bool removed = false;
if(!strcasecmp(sep->arg[1], "remove"))
{
t->ChangeLastName("");
removed = true;
}
else
{
for(unsigned int i = 0; i < strlen(sep->arg[1]); i++)
if(sep->arg[1][i] == '_')
sep->arg[1][i] = ' ';
t->ChangeLastName(sep->arg[1]);
}


if(removed)
{
c->Message(13, "%s's lastname has been removed.", t->GetName(), sep->arg[1]);
if(t != c)
t->Message(13, "Your lastname has been removed.", sep->arg[1]);
}
else
{
c->Message(13, "%s's lastname has been changed to '%s'.", t->GetName(), sep->arg[1]);
if(t != c)
t->Message(13, "Your lastname has been changed to '%s'.", sep->arg[1]);
}
}
}