[CODE] Active Admin

#1
this was coded acidx

Code: Select all

in ChatMsgHandler(); add this in there

CODE  

if (memcmp(cp, "/gmmode ", 8) == 0) {
  AdminOrder_AdminMode(iClientH, cp, dwMsgSize - 21);
  return; 
 }
 




Now in Game.CPP add the following Function



CODE  
void CGame::AdminOrder_AdminMode(int iClientH, char *pData, DWORD dwMsgSize)
{
char   seps[] = "= \t\n";
char   * token, cBuff[256]; 
class  CStrTok * pStrTok;
char cAdminModeMsg[100];
if (m_pClientList[iClientH] == NULL) return;
if ((dwMsgSize) <= 0) return;
int i;
if (m_pClientList[iClientH]->m_iAdminUserLevel < 1) {
 // Admin user level?€?Œ A³A·A¾?†A¼A­ ?€?Œ A±?¢A´?‰?€A» A»?§A??«?‡?’ A¼?¶ A¾?¸A´?™.
 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) {

 if (token[0] == '1')
 {
  //Todo: Add some Shit here To activate if admin mode is on... 
  wsprintf(cAdminModeMsg,"The Admin: %s Has Now Became Active",m_pClientList[iClientH]->m_cCharName);
  m_pClientList[iClientH]->m_iGMMode = 1;
  SetInvisibilityFlag(iClientH, DEF_OWNERTYPE_PLAYER, TRUE);

 }
 else
  //Todo: Add some shit here to de-activate if admin mode is off...
  wsprintf(cAdminModeMsg,"The Admin: %s is Now In-Active",m_pClientList[iClientH]->m_cCharName);
  if (token[0] == '0') m_pClientList[iClientH]->m_iGMMode = 0;
  SetInvisibilityFlag(iClientH, DEF_OWNERTYPE_PLAYER, TRUE);

}
for (i = 1; i < DEF_MAXCLIENTS; i++)
SendNotifyMsg(NULL, i, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, cAdminModeMsg);
delete pStrTok;

} 




Now in Game.H add the following 

CODE  
void AdminOrder_AdminMode(int iClientH, char *pData, DWORD dwMsgSize);
 



Now in Client.h Find int m_iRating;
add this bellow it.

CODE  

int m_iGMMode;//Acidx added for GMMODE
 



Now in Client.CPP find m_cAura = 0;
add this bellow it


CODE  
m_iGMMode = 0; 



There we go Working Admin mode... Well it should be i havnt tested it at all haha

Now to use it in a function...
Lets say you have my /admins already in.. if not you can try it out...
its not Cross server but it gets the job done...
Anyways here is an example of my /admins Re-Written to use this..


CODE  
/*===========Get Admins==By Acidx====/admins=======*/
void CGame::PlayerCommandCheckAdmins(int iClientH)
{//An Acidx Production - Last Updated:Aug.29.2006
char  cNotifyMessage[256],cNotifyMessage2[256], cGMName[12];
int i,x;
WORD   * wp;
char   * cp;
char cBuff[256];
cGMName[12];
ZeroMemory(cNotifyMessage, sizeof(cNotifyMessage));
ZeroMemory(cNotifyMessage2, sizeof(cNotifyMessage2));
x = 0;
for (i = 0; i < DEF_MAXCLIENTS; i++) 
if (m_pClientList[i] != NULL) {

if (m_pClientList[i]->m_iAdminUserLevel > 1) {
 if(m_pClientList[i]->m_iGMMode == 1)
 {
wsprintf(cNotifyMessage, "Active Admin: %s", m_pClientList[i]->m_cCharName);
ShowClientMsg(iClientH, cNotifyMessage, 4);
 }
 else if (m_pClientList[i]->m_iGMMode == 0)
 {
wsprintf(cNotifyMessage, "In-Active Admin: %s", m_pClientList[i]->m_cCharName);
ShowClientMsg(iClientH, cNotifyMessage, 4);
 }
}
}
// wsprintf(cNotifyMessage2, "%i Admins Are Online", x);
//ShowClientMsg(iClientH, cNotifyMessage2, 10);
} 

Who is online

Users browsing this forum: No registered users and 0 guests

cron