[Src] Skeleton For Admin Mode

Codes already submitted by people of the forums.
Post Reply
Acidx
Member
Posts: 198
Joined: Tue Mar 23, 2004 4:27 am

Post by Acidx »

Well i get alot of time to just create new bits and pieces of code
So Heres an example of the AdminMode Command im making..
This is gunna use a command to set a value to a storage class.
Saying That you are Active as an admin or Not active..
So the admin would say...
/gmmode 1
(You are Now an Active GameMaster)
/gmmode 0
(You are no Longer an Active GameMaster)

Alot of you are gunna say well this is useless...
or might not understand it...
WELL in theory this is perfect and adds alot of diffrent Actions to process here...
We could take this skeleton and Use it for MANY many things..
Say For instance if you disable your admin powers.. you wont except whispers and you go into observer mode, while all your GM powers are Inactive.. just if your pissed or dont want bothered...
Now... Another good spot it comes in handy is new functions that can added and integrated with this system...
Alot of commands can be activated from this alone instead of using that gay Standerd admin verify...
Well ill leave it up to you guys to decide what you want to do with it...
Ill also Update my /admins command at the end of this to show an example of its usage...




in ChatMsgHandler(); add this in there

Code: Select all

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

Now in Game.CPP add the following Function

Code: Select all

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ÀÌ ³·¾Æ¼­ ÀÌ ±â´ÉÀ» »ç¿ëÇÒ ¼ö ¾ø´Ù.
  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: Select all

void AdminOrder_AdminMode(int iClientH, char *pData, DWORD dwMsgSize);
Now in Client.h Find int m_iRating;
add this bellow it.

Code: Select all

int m_iGMMode;//Acidx added for GMMODE
Now in Client.CPP find m_cAura = 0;
add this bellow it

Code: Select all

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: Select all

/*===========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);
}
i hope you guys use this small Skeleton i designed...
its fairly simple for activation/de-activation and it has alot of potential
Enjoy ;)
<b>-<span style='color:green'>ACiD-x </span><span style='color:red'> Owning PCs Since 1987</span><br><img src='http://img204.imageshack.us/img204/2245/hackertf5.gif' border='0' alt='user posted image' /><br><img src='http://img509.imageshack.us/img509/6697 ... 4sc4ed.png' border='0' alt='user posted image' /><br><span style='color:orange'>i am Pwn NetGAYLORDS !</span></b><br><span style='color:blue'><br>I Pwn HBUSA =)</span>
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

if (memcmp(cp, "/gmmode ", 8) == 0) {
if (m_pClientList[iClientH]->m_iAdminUserLevel>0) m_pClientList[iClientH]->m_bActiveGM=!m_pClientList[iClientH]->m_bActiveGM;
return;
}

much shorter
<img src='http://img440.imageshack.us/img440/2627/15pt.jpg' border='0' alt='user posted image' /><br><br>HBPolska characters:<br><br>Hellios 150+ Aresden Hero Mage<br>TheBill 120 Aresden plrider<br>Kill_Me 100 Full-Hero plrider<br>Rockeater 110+ Aresden Plate Mage<br><br><a href='http://www.helbreath.org' target='_blank'>http://www.helbreath.org</a> come and play (250 ppl online)
jonisan
Member
Posts: 164
Joined: Sat Jan 07, 2006 1:14 pm
Location: Fin

Post by jonisan »

Erm, sorry for asking this but aint somebody done this thing already ?
<img src='http://i72.imagethrust.com/i/160466/newww.png' border='0' alt='user posted image' /><br><br><img src='http://img154.imageshack.us/img154/9360/tagi7wk.png' border='0' alt='user posted image' /><br><br><img src='http://img446.imageshack.us/img446/6094/uusi0xr.png' border='0' alt='user posted image' /><br><br><img src='http://img73.imageshack.us/img73/9738/xpuser3xy.png' border='0' alt='user posted image' /><br><br><b><u><span style='color:red'>Noobie List:</span></u></b><br><span style='color:blue'><i>BlueChristmas</i></span>
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

Nice code, Haven't had heaps of time to look at it.. but it looks cool :D:D
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Kiruku
Loyal fan
Posts: 268
Joined: Wed Feb 22, 2006 12:00 pm
Contact:

Post by Kiruku »

search /adminattack by dax its a better code :S
<img src='http://lichtdrache.lima-city.de/helbrea ... aramba.gif' border='0' alt='user posted image' />
Tafka12
&lt;3 bd long time
Posts: 772
Joined: Wed Dec 28, 2005 6:32 pm

Post by Tafka12 »

these are 2 different codes. Idiot
<img src='http://www.hot.ee/carvanho/taavi.png' border='0' alt='user posted image' /><br><br><img src='http://www.hot.ee/carvanho/Elvine.png' border='0' alt='user posted image' /><br><img src='http://www.hot.ee/carvanho/LieroX.png' border='0' alt='user posted image' /><br><img src='http://www.hot.ee/carvanho/Football.png' border='0' alt='user posted image' />
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

Tafka12 wrote: these are 2 different codes. Idiot
Not really. Mine stores an "Active" status and i think it's method is a little cleaner then this 1 also.

[EDIT] I say that because this was posted as some kind of core to future codes. Chopping existing codes are just as effective.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
Post Reply