Someone Check This Code

All Helbreath Server Source Discussion here.
Post Reply
madcan
just visiting
Posts: 9
Joined: Wed Sep 07, 2005 10:32 am

Post by madcan »

my first attempt. Is there anything wrong with it?

Code: Select all

void CGame::AdminOrder_SetPlayerCont(int iClientH, char *pData, DWORD dwMsgSize)
{
char  seps[] = "= \t\n";
char  * token, cBuff[256];
class  CStrTok * pStrTok;
char * cont;
char cNick[20];
char cCont[5];
char notice[100];
int oldcont;
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); //adminuserlvl
  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);
  cont = pStrTok->pGet();
  if (cont == NULL) {
    delete pStrTok;
    return;
  }
  strcpy(cCont, cont);
  for (i = 0; i < DEF_MAXCLIENTS; i++)  {
    if ((m_pClientList[i] != NULL) && (memcmp(m_pClientList[i]->m_cCharName, cNick, strlen(cNick)) == 0)) {
oldcont = m_pClientList[i]->m_iContribution; //prev cont
      m_pClientList[i]->m_iContribution=atoi(cCont); //change to new cont
      SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_QUESTCOUNTER, NULL, NULL, NULL, NULL);
wsprintf(notice,"Contribution has been changed for player %s from %d to %d.",m_pClientList[iClientH]->m_cCharName,oldcont,atoi(cCont));
ShowNotice(iClientH,notice);
    }
  }
  delete pStrTok;
}

Code: Select all

if (memcmp(cp, "/setcont ", 9) == 0) {
AdminOrder_SetPlayerCont(iClientH, cp, dwMsgSize - 21);
return;
}
<img src='http://www.2and2.net/Uploads/Images/noobs.gif' border='0' alt='user posted image' /><br><br>FATHER!<br>FATHER!<br>FATHER!
Ice-T
Loyal fan
Posts: 262
Joined: Sat Oct 18, 2003 8:51 am
Location: nowere

Post by Ice-T »

when u nick code from otherfunctions it helps to define all varibles, and or rename them rofls
<img src='http://www.prism.gatech.edu/~gtg818f/basesig.gif' border='0' alt='user posted image' /><br><img src='http://img228.imageshack.us/img228/439/steam1tf.gif' border='0' alt='user posted image' />
Spawn
Regular
Posts: 82
Joined: Thu Nov 20, 2003 8:29 am
Location: Melbourne, Australia

Post by Spawn »

what's the code for? what is it meant 2 do?
<img src='http://img139.imageshack.us/img139/8760 ... opy7og.jpg' border='0' alt='user posted image' />
tamir
Regular
Posts: 53
Joined: Wed Feb 04, 2004 8:42 am

Post by tamir »

did you get any error, or you just too lazy to check it by yourself and you want us to do it?
<a href='http://tfps.fateback.com/scripts/index.html' target='_blank'>my php scripts</a>
madcan
just visiting
Posts: 9
Joined: Wed Sep 07, 2005 10:32 am

Post by madcan »

im dling vb studio, my one is corrupt for some reason. nafxcwd.lib.


just tested. It works. You gotta log in and log out after you use the command.


it changes players contribution
<img src='http://www.2and2.net/Uploads/Images/noobs.gif' border='0' alt='user posted image' /><br><br>FATHER!<br>FATHER!<br>FATHER!
Post Reply