<span style='color:red'>go to function ChatMsgHandler and add</span>
<span style='color:red'>later to add this anywhere in game.cpp</span>//SetEk BY Drajwer!!!!!!!!!!
if (memcmp(cp, "/setek", 6) == 0) {
AdminOrder_SetEK(iClientH, cp, dwMsgSize - 21);;
return;
}
//SetEk BY Drajwer!!!!!!!!!!
void CGame::AdminOrder_SetEK (int iClientH, char *pData, DWORD dwMsgSize)
{
char seps[] = "= \t\n";
char *token, cBuff[256];
class CStrTok *pStrTok;
char *pk;
char cNick[20];
char cPK[5];
char notice[100];
int oldpk;
int i;
if (m_pClientList[iClientH] == NULL)
return;
if ((dwMsgSize) <= 0)
return;
if (m_pClientList[iClientH]->m_iAdminUserLevel == 0)
{
SendNotifyMsg (NULL, iClientH, DEF_NOTIFY_ADMINUSERLEVELLOW, NULL, NULL,
NULL, NULL);
return;
}
ZeroMemory (cBuff, sizeof (cBuff));
memcpy (cBuff, pData, dwMsgSize);
pStrTok = new class CStrTok (cBuff, seps);
token = pStrTok->pGet ();
token = pStrTok->pGet ();
if (token == NULL)
{
delete pStrTok;
return;
}
strcpy (cNick, token);
pk = pStrTok->pGet ();
if (pk == NULL)
{
delete pStrTok;
return;
}
strcpy (cPK, pk);
for (i = 0; i < DEF_MAXCLIENTS; i++)
{
if ((m_pClientList != NULL)
&& (memcmp (m_pClientList->m_cCharName, cNick, strlen (cNick)) ==
0))
{
oldpk = m_pClientList->m_iEnemyKillCount;
m_pClientList->m_iEnemyKillCount = atoi (cPK);
SendNotifyMsg (NULL, i, DEF_NOTIFY_ENEMYKILLS,
m_pClientList->m_iEnemyKillCount, NULL, NULL,
NULL);
wsprintf (notice,
"EK Count has been changed for player %s from %d to %d.",
m_pClientList[iClientH]->m_cCharName, oldpk, atoi (cPK));
ShowNotice (iClientH, notice);
}
}
delete pStrTok;
}
<span style='color:red'>and to register the function in game.h</span>
//SetEk BY Drajwer!!!!!!!!!!
void AdminOrder_SetEK(int iClientH, char *pData, DWORD dwMsgSize);
<span style='color:red'>and here is the Error it show's me..</span>
Compiling...
Game.cpp
C:\.....\HG SRC\Game.cpp(2043) : warning C4305: '=' : truncation from 'const int' to 'char'
C:\.....\HG SRC\Game.cpp(2043) : warning C4309: '=' : truncation of constant value
C:\.....\HG SRC\Game.cpp(8788) : warning C4305: '=' : truncation from 'const int' to 'short'
C:\.....\HG SRC\Game.cpp(8788) : warning C4309: '=' : truncation of constant value
C:\.....\HG SRC\Game.cpp(9064) : error C2601: 'AdminOrder_SetEK' : local function definitions are illegal
Error executing cl.exe.
Results
HGserver.exe - 1 error(s), 4 warning(s)
if anyone know why it show me.. please let me know...