ServersMU - Comunidad

Zona Programadores => Sources => Mensaje iniciado por: Applayo en Abril 22, 2021, 12:28:17 am

Título: Command Set Level para MuEMU
Publicado por: Applayo en Abril 22, 2021, 12:28:17 am
[b]CommandManager.h[/b]
Dentro de [b]enum eCommandNumber[/b]

[code]COMMAND_SETLVL = 109,[/code]


Dentro de [b]class CCommandManager[/b]

[code]bool CCommandManager::CommandSetLevel(LPOBJ lpObj,char* arg);[/code]


[b]CommandManager.cpp[/b]


[code]        case COMMAND_SETLVL:
            Result = CommandSetLevel(lpObj,argument);
            break;
[/code]

[code]bool CCommandManager::CommandSetLevel(LPOBJ lpObj,char* arg) // OK
{
char name[11] = {0};

this->GetString(arg,name,sizeof(name),0);

LPOBJ lpTarget = gObjFind(name);

if(lpTarget == 0)
{
gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,"O personagem não existe ou não está online.");
return 0;
}

int level = this->GetNumber(arg,1);

if(level >= 401)
{
gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,"O valor que você entrou é invalido.");
return 0;
}

lpTarget->Level = level;

GCLevelUpSend(lpTarget);

gLog.Output(LOG_COMMAND,"[CommandSetLevel][%s][%s] - (Name: %s, Level: %d)",lpObj->Account,lpObj->Name,name,level);
}[/code]

[b]Command.txt[/b]

[code] 108 "/setlvl" 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 //setlvl <player> <nivel> - Editar nivel[/code]

Creditos:
SaintZeus
Emershow
Título: Re: Command Set Level para MuEMU
Publicado por: robins1998 en Mayo 27, 2021, 02:29:01 am
Very helpful, thanks for sharing.