/setpk Nick Pkcount

All Helbreath Server Source Discussion here.
Drajwer
<3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

Code: Select all

void CGame::AdminOrder_SetPK(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[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cNick, strlen(cNick)) == 0)) {
  oldpk = m_pClientList[i]->m_iPKCount;
        m_pClientList[i]->m_iPKCount=atoi(cPK);
        SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_PKPENALTY, NULL, NULL, NULL, NULL);
  wsprintf(notice,"PK Count has been changed for player %s from %d to %d.",m_pClientList[iClientH]->m_cCharName,oldpk,atoi(cPK));
  ShowNotice(iClientH,notice);
      }
    }
    delete pStrTok;
}

ShowNotice is

Code: Select all

void CGame::ShowNotice(int iClientH,char *pMsg)
{
	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, pMsg);
}
and usage

Code: Select all

if (memcmp(cp, "/setpk ", 7) == 0) {
AdminOrder_SetPK(iClientH, cp, dwMsgSize - 21);
return;
}
<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)
binarydata
DBfiller
Posts: 3816
Joined: Fri Oct 31, 2003 5:30 am
Location: San Diego CA, USA
Contact:

Post by binarydata »

very nice
<img src='http://img88.exs.cx/img88/2290/7666.jpg' border='0' alt='user posted image' />
CDWriter
Member
Posts: 123
Joined: Sun Feb 22, 2004 12:08 am

Post by CDWriter »

so changing this to use EK would be ?

This would be great for them that Lame on your server so u can ajust it back to what it should be or Take them all away


binarydata
DBfiller
Posts: 3816
Joined: Fri Oct 31, 2003 5:30 am
Location: San Diego CA, USA
Contact:

Post by binarydata »

this is pk or crim, not ek
this is good tool for punishing players
<img src='http://img88.exs.cx/img88/2290/7666.jpg' border='0' alt='user posted image' />
hummmu
Member
Posts: 165
Joined: Sun Dec 12, 2004 7:59 pm

Post by hummmu »

nice snippets... very simply done.
<a href='http://www.hb2k4.tk' target='_blank'><span style='color:blue'> Use do not abuse.</span> </a> <br><br>-MySeLF-
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

i think ShowNotice is cool B) B) B) u can use it for ex. /checkrep B)

[edit]
ok here is my /checkrep

Code: Select all

if (memcmp(cp, "/checkrep", 9) == 0) {
char checkrep[100];
wsprintf(checkrep,"You have %d reputation oints.",m_pClientList[iClientH]->m_iRating);
ShowNotice(iClientH,checkrep);
return;
}
and my own /who (do simple loop to check cities)

Code: Select all

if (memcmp(cp, "/who", 4) == 0) {
char who[100];
wsprintf(who,"Total players connected: %d. Aresden: %s. Elvine: %s.",(WORD)m_iTotalGameServerClients,"?","?");
ShowNotice(iClientH,who);
return;
}
<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)
pronoob
Regular
Posts: 68
Joined: Sat Jan 08, 2005 7:35 am

Post by pronoob »

Drajwer wrote:

Code: Select all

void CGame::AdminOrder_SetPK(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[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cNick, strlen(cNick)) == 0)) {
  oldpk = m_pClientList[i]->m_iPKCount;
        m_pClientList[i]->m_iPKCount=atoi(cPK);
        SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_PKPENALTY, NULL, NULL, NULL, NULL);
  wsprintf(notice,"PK Count has been changed for player %s from %d to %d.",m_pClientList[iClientH]->m_cCharName,oldpk,atoi(cPK));
  ShowNotice(iClientH,notice);
      }
    }
    delete pStrTok;
}

ShowNotice is

Code: Select all

void CGame::ShowNotice(int iClientH,char *pMsg)
{
	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, pMsg);
}
and usage

Code: Select all

if (memcmp(cp, "/setpk ", 7) == 0) {
AdminOrder_SetPK(iClientH, cp, dwMsgSize - 21);
return;
}
which file to put the code in there r 3 code there
game.cpp game.h?
tell me pls
KLKS
Loyal fan
Posts: 218
Joined: Sun Feb 22, 2004 2:32 pm

Post by KLKS »

if u dont know how to add the code then ur not qualified to add the code.

a note on optimization, instead of looping trough all the 2000 elements in DEF_MAXCLIENTS,u can use the array with players in it, forgot the variable name but i remember one,

and another thing, if the player is on another HG, u must broadcast the message to all other HG's to find that player and set the pk count.

:)

btw nice coding
binarydata
DBfiller
Posts: 3816
Joined: Fri Oct 31, 2003 5:30 am
Location: San Diego CA, USA
Contact:

Post by binarydata »

KLKS wrote: if u dont know how to add the code then ur not qualified to add the code.
PWNT
<img src='http://img88.exs.cx/img88/2290/7666.jpg' border='0' alt='user posted image' />
pronoob
Regular
Posts: 68
Joined: Sat Jan 08, 2005 7:35 am

Post by pronoob »

Drajwer wrote: i think ShowNotice is cool B) B) B) u can use it for ex. /checkrep B)

[edit]
ok here is my /checkrep

Code: Select all

if (memcmp(cp, "/checkrep", 9) == 0) {
char checkrep[100];
wsprintf(checkrep,"You have %d reputation oints.",m_pClientList[iClientH]->m_iRating);
ShowNotice(iClientH,checkrep);
return;
}
and my own /who (do simple loop to check cities)

Code: Select all

if (memcmp(cp, "/who", 4) == 0) {
char who[100];
wsprintf(who,"Total players connected: %d. Aresden: %s. Elvine: %s.",(WORD)m_iTotalGameServerClients,"?","?");
ShowNotice(iClientH,who);
return;
}
the /who is not wokring
it showed ? aresden and ? elvine
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

do ur own loop and count aresdens and elvines
<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)
pronoob
Regular
Posts: 68
Joined: Sat Jan 08, 2005 7:35 am

Post by pronoob »

how?
full code pls
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

5 euro pls
<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)
KLKS
Loyal fan
Posts: 218
Joined: Sun Feb 22, 2004 2:32 pm

Post by KLKS »

pronoob wrote: how?
full code pls
noob get hit by a car
bigchief
Loyal fan
Posts: 289
Joined: Sat Feb 28, 2004 12:45 pm
Location: In Chicks Rooms/Dorms Or Passed Out On The Floor
Contact:

Post by bigchief »

KLKS wrote:
pronoob wrote: how?
full code pls
noob get hit by a car
rofl dofl lol
Just remember if you shake it more then 3 times your playing with it.
Post Reply