/setpk Nick Pkcount

All Helbreath Server Source Discussion here.
omar_omiez
Loyal fan
Posts: 235
Joined: Mon Jul 12, 2004 9:36 am

Post by omar_omiez »

im learning how to code helbreath source, so i tried to make a /setrep command using Drajwer's /setpk code. Tell me where i went wrong pls. Thx. I really want to learn to code.
void CGame::AdminOrder_SetPlayerReputation(int iClientH, char *pData, DWORD dwMsgSize)
{
char   seps[] = "= \t\n";
char   * token, cBuff[256];
class  CStrTok * pStrTok;
char * rep;
char cNick[20];
char cRep[5];
char notice[100];
int oldrep;
int i;
if (m_pClientList[iClientH] == NULL) return;
if ((dwMsgSize) <= 0) return; //if user types /SetREP wifout nick
if (m_pClientList[iClientH]->m_iAdminUserLevel == 0) { 
   SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ADMINUSERLEVELLOW, NULL, NULL, NULL, NULL); //if user is not enuf admin lvl
   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);
   rep = pStrTok->pGet();
   if (rep == NULL) {
     delete pStrTok;
     return;
   }
   strcpy(cRep, rep);
   for (i = 0; i < DEF_MAXCLIENTS; i++)  {
     if ((m_pClientList != NULL) && (memcmp(m_pClientList->m_cCharName, cNick, strlen(cNick)) == 0)) {
oldrep = m_pClientList->m_iRating; //this is to define the previous rep
       m_pClientList->m_iRating=atoi(cRep); //this is to change the current value to the one typed
       SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_RATINGPLAYER, NULL, NULL, NULL, NULL); //this is to show the notice of succesful change of rep count.
wsprintf(notice,"Rep Count has been changed for player %s from %d to %d.",m_pClientList[iClientH]->m_cCharName,oldrep,atoi(cRep));
ShowNotice(iClientH,notice);
     }
   }
   delete pStrTok;
}



Im not sure about hte shownotice part, what it does and where to add it but is use Drajwer's one.

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


and the usage is

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


so pls, point out my mistakes. im noob in this area, im learning, not like some noobs who just ask for codes. <span style='color:red'>And thx drajwer cos ur post made me want to learn to code lol.</span> :P and can someone tell me a link to dwld a compiler? gosh im so noob. :blink:
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
omar_omiez
Loyal fan
Posts: 235
Joined: Mon Jul 12, 2004 9:36 am

Post by omar_omiez »

*bump*
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
No-1
Loyal fan
Posts: 291
Joined: Sun Sep 12, 2004 5:57 am
Location: tdy

Post by No-1 »

Drawjer so keng.. <3
Support Outpost@HBTop50<br><a href='http://hbtop50.berserkvision.com/in.php?id=582' target='_blank'>Outpost@HBTop50</a><br>
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

B)
<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)
omar_omiez
Loyal fan
Posts: 235
Joined: Mon Jul 12, 2004 9:36 am

Post by omar_omiez »

so i assume the code is correct? yay.
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Ummm yeah setek would be nice :D :lol:
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
omar_omiez
Loyal fan
Posts: 235
Joined: Mon Jul 12, 2004 9:36 am

Post by omar_omiez »

i try make. :P
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
omar_omiez
Loyal fan
Posts: 235
Joined: Mon Jul 12, 2004 9:36 am

Post by omar_omiez »

void CGame::AdminOrder_SetPlayerEnemyKillCount(int iClientH, char *pData, DWORD dwMsgSize)
{
char  seps[] = "= \t\n";
char  * token, cBuff[256];
class  CStrTok * pStrTok;
char * ek;
char cNick[20];
char cEk[5];
char notice[100];
int oldek;
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); //if user is not enuf admin lvl
  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);
  ek = pStrTok->pGet();
  if (ek == NULL) {
    delete pStrTok;
    return;
  }
  strcpy(cEk, ek);
  for (i = 0; i < DEF_MAXCLIENTS; i++)  {
    if ((m_pClientList != NULL) && (memcmp(m_pClientList->m_cCharName, cNick, strlen(cNick)) == 0)) {
oldek = m_pClientList->m_iEnemyKillCount; //this is to define the previous ek
      m_pClientList->m_iEnemyKillCount=atoi(cEk); //this is to change the current value to the one typed
      SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ENEMYKILLS, NULL, NULL, NULL, NULL);
wsprintf(notice,"EK Count has been changed for player %s from %d to %d.",m_pClientList[iClientH]->m_cCharName,oldek,atoi(cEk));
ShowNotice(iClientH,notice);
    }
  }
  delete pStrTok;
}


usage is


if (memcmp(cp, "/setek ", 7) == 0) {
AdminOrder_SetPlayerEnemyKillCount(iClientH, cp, dwMsgSize - 21);
return;
}



i not sure if its correct. Someone try it then post pls. thx. :P
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
Post Reply