/giveexp

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

Post by omar_omiez »

void CGame::AdminOrder_GivePlayerExp(int iClientH, char *pData, DWORD dwMsgSize)
{
char  seps[] = "= \t\n";
char  * token, cBuff[256];
class  CStrTok * pStrTok;
char * Exp;
char cNick[20];
char cExp[5];
char notice[100];
int oldExp;
int newExp;
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);
  exp = pStrTok->pGet();
  if (exp == NULL) {
    delete pStrTok;
    return;
  }
  strcpy(cExp, exp);
  for (i = 0; i < DEF_MAXCLIENTS; i++)  {
    if ((m_pClientList != NULL) && (memcmp(m_pClientList->m_cCharName, cNick, strlen(cNick)) == 0)) {
oldExp = m_pClientList->m_iExp;
newExp = m_pClientList->m_iExp+atoi(cExp);
      m_pClientList->newExp;
      SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_RATINGPLAYER, NULL, NULL, NULL, NULL);
wsprintf(notice,"Exp Count has been increased for player %s from %d to %d.",m_pClientList[iClientH]->m_cCharName,oldExp,newExp);
ShowNotice(iClientH,notice);
    }
  }
  delete pStrTok;
}


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



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



let gm reward players with exp. was in school when i wrote this, try it see if it works. :P
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
Raptile
Member
Posts: 145
Joined: Fri May 07, 2004 4:31 pm

Post by Raptile »

nice code :)
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

it prolly dont work :P
<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 »

Drajwer wrote: it prolly dont work :P
i think so too but just cant put my finger on which part.

maybe if too much exp will cause crash? or no lvl up?
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

Code: Select all

oldExp = m_pClientList[i]->m_iExp;
newExp = m_pClientList[i]->m_iExp+atoi(cExp);
m_pClientList[i]->newExp;
to:

Code: Select all

oldExp = m_pClientList[i]->m_iExp;
newExp = oldExp;
newExp += atoi(cExp);
m_pClientList[i]->m_iExp = newExp;
SendNotifyMsg(NULL, i, DEF_NOTIFY_EXP, NULL, NULL, NULL, NULL);
bCheckLevelUp(i);
i think, i dont test it
<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 »

i bet thats right, too bad i coded like java lol.
- Tbone<br><a href="http://cyborg.namedecoder.com"><br><img src="http://cyborg.namedecoder.com/webimages ... ng"<br></a>
youth89
Loyal fan
Posts: 239
Joined: Sun Mar 07, 2004 8:57 pm

Post by youth89 »

Post a compiled client?
asdfd
Regular
Posts: 47
Joined: Sat Nov 13, 2004 7:27 am

Post by asdfd »

Question, i'm just starting out.. I can compile clients and stuff like that, but how do I set this up? Does they go in their own files? Or do i add them into something? Thanks.
kazoo
Regular
Posts: 92
Joined: Thu Oct 28, 2004 11:19 pm

Post by kazoo »

seems like everytime i turn around there is some new idea out there that has already been coded into Nova and Medieval Times by Ice-T and Dax....
not saying you took an idea or anyhting like that, just talking :-) well good job if it works, nice try if it dont, youll get it :-)
<img src='http://www.hbuonline.net/media/hbutop50.jpg' border='0' alt='user posted image' /><br><br>www.hbuonline.net<br><br>Currently customizing files, no longer in beta stage! HBUnited aims to build a 100% stable fun environment for free. Bugs are fixed the version after they are found and we are constantly adding hb features along with our own features with every update. Come check it out and help us test our files and grow as a server.<br><br><img src="http://hbtop50.com/button.php?u=hbuonline" alt="Helbreath Top 50 - Keepin' it real." border="0" /><br>
Chlis
Member
Posts: 168
Joined: Thu Mar 18, 2004 9:07 am

Post by Chlis »

nova was the shit <3
Slipknight
Loyal fan
Posts: 423
Joined: Thu Apr 07, 2005 7:53 pm

Post by Slipknight »

didnt work 4 me I usuing 2.24c edited sources, it gave me like 52 errors

EDIT: I fixed alotta errors in it but got 2 errors that show you wrote the code wrong. :/
<img src='http://www.bleachportal.net/interactive ... irjjkt.jpg' border='0' alt='user posted image' /><br><img src='http://www.hazegfx.com/UserBanners/Slipknot%20Fan.jpg' border='0' alt='user posted image' /><br><img src='http://www.hazegfx.com/UserBanners/UT2004%20Player.jpg' border='0' alt='user posted image' /><br><img src='http://www.hazegfx.com/UserBanners/AC%20DC%20Fan.png' border='0' alt='user posted image' /><br>
Post Reply