ServersMU - Comunidad

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

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

[code]COMMAND_PKSETLVL = 110,[/code]


Dentro de [b]class CCommandManager[/b]

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


[b]CommandManager.cpp[/b]

[code]        case COMMAND_PKSETLVL:
            Result = CommandSetPKLevel(lpObj,argument,Npc);
            break;[/code]

[code]bool CCommandManager::CommandSetPKLevel(LPOBJ lpObj,char* arg, int Npc)
{
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 pk = this->GetNumber(arg,1);

if(pk >= 7)
{
gNotice.GCNoticeSend(lpObj->Index,1,0,0,0,0,0,"O Valor que você entrou é inválido.");
return 0;
}

lpTarget->PKLevel = pk;

GCPKLevelSend(lpTarget->Index,lpTarget->PKLevel);

if (Npc <= -1)
{
GCChatTargetNewSend(lpTarget,Npc,gMessage.GetMessage(536));
}

gLog.Output(LOG_COMMAND,"[CommandSetPKLevel][%s][%s] - (PKLevel: %d)",lpTarget->Account,lpTarget->Name,lpTarget->PKLevel);

return 1;
}[/code]

[b]Command.txt[/b]

[code] 109 "/setlvlpk" 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 PK[/code]
Título: Re: Command Set PK Level para MuEMU
Publicado por: robins1998 en Mayo 27, 2021, 02:29:14 am
Very helpful, thanks for sharing.