need lil help..

Submit your code requests, and if you are good at coding come help others with their requests.
Tafka12
<3 bd long time
Posts: 772
Joined: Wed Dec 28, 2005 6:32 pm

Post by Tafka12 »

molo wrote:
Treax2 wrote: yes it is ... i meaned i can give his that codes what flow have and it works like molo wanted ...

and i saw that it was ur coded ... =D
:huh: :huh: Confused :unsure:
He means that he can give you code that he made for HB Flow2 that works.
<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' />
molo
Member
Posts: 140
Joined: Mon Jan 17, 2005 1:19 am

Post by molo »

ADDKiD wrote: Its ok Molo. Its not your fault you were born stupid.
its ok ADDKiD... Its not your fault you were born to right stupid.

BTW No One Talking to you.. <_<


Thanks Tafka12 B)
molo
Member
Posts: 140
Joined: Mon Jan 17, 2005 1:19 am

Post by molo »

Treax2 wrote: yes it is ... i meaned i can give his that codes what flow have and it works like molo wanted ...

and i saw that it was ur coded ... =D
sure thing... that would help alot people... would be nice if you post it ;)
ogeid
Member
Posts: 110
Joined: Thu Feb 02, 2006 11:11 pm

Post by ogeid »

n e e d a b a l l t r a de c o n f i g f i l e

t h a n k s :ph34r:
"Prefiero morir de pie que vivir arrodillado"
Shetar
Member
Posts: 148
Joined: Sun Nov 30, 2003 12:57 am

Post by Shetar »

Are you guys really only capable of copying and pasting source?

Just make it yourself, example;

Code: Select all

BallItem = 1 KlonessAxe 250
BallItem = 2 The_Devastator 300
The numbers behind the item names (which should match existing item names!) are the Ball Points needed for those items.

Because I don't work with normal server files I don't have a cfg, sorry.

Helbreath II Project Manager & All round Developer. <br><i>(Don't worry, we're not dead)</i>
ogeid
Member
Posts: 110
Joined: Thu Feb 02, 2006 11:11 pm

Post by ogeid »

hgserver crash whit that config
"Prefiero morir de pie que vivir arrodillado"
Psycho
Member
Posts: 116
Joined: Sat Jan 24, 2004 2:56 pm

Post by Psycho »

Shetar wrote: Are you guys really only capable of copying and pasting source?

<span style='font-size:14pt;line-height:100%'><span style='color:red'>Just make it yourself, example;</span></span>

Code: Select all

BallItem = 1 KlonessAxe 250
BallItem = 2 The_Devastator 300
The numbers behind the item names (which should match existing item names!) are the Ball Points needed for those items.

Because I don't work with normal server files I don't have a cfg, sorry.
know?¿


YoKo
<img src='http://img145.imageshack.us/img145/3999/firma1an0.jpg' border='0' alt='user posted image' />
Shetar
Member
Posts: 148
Joined: Sun Nov 30, 2003 12:57 am

Post by Shetar »

You must've done something wrong. You got the source, debug the code. If you can't fix it yourself copy the debug error here and I'll take a look.

Have a nice day
Helbreath II Project Manager & All round Developer. <br><i>(Don't worry, we're not dead)</i>
ogeid
Member
Posts: 110
Joined: Thu Feb 02, 2006 11:11 pm

Post by ogeid »

Shetar wrote: You must've done something wrong. You got the source, debug the code. If you can't fix it yourself copy the debug error here and I'll take a look.

Have a nice day
Hey thanks for the answer... i am a noob coder ,u know B)

i am recoding all src ;)
"Prefiero morir de pie que vivir arrodillado"
Pollof
noob
Posts: 15
Joined: Sat Jan 14, 2006 5:51 pm

Post by Pollof »

I have only 1 question... How does it work ?...
Treax2
Loyal fan
Posts: 281
Joined: Fri Mar 04, 2005 5:05 pm
Location: Estonia
Contact:

Post by Treax2 »

1) it crushed because about that dupclicate item name/number there is a delete pstrok and that crushes ... if u remove it ... then u can accept the config and put items there but they dont work on /trade
Namesis
Regular
Posts: 88
Joined: Fri Mar 03, 2006 12:53 pm

Post by Namesis »

Code: Select all

//code by Shetar added 1/15/06

~~~At Client.cpp add:
m_iBallPoints = 0;

~~~At Client.h add:
int m_iBallPoints;

~~~At Item.h add:
#define DEF_ITEMEFFECTTYPE_ADDBALLPOINTS 33


~~~At Game.cpp multiple snippets must be added.
~~~To start look for:

wsprintf(cTxt, "gizon-item-upgade-left = %d", m_pClientList[iClientH]->m_iGizonItemUpgradeLeft);
strcat(pData, cTxt
strcat(pData,"\n");

~~~~~And underneath that place this:

wsprintf(cTxt, "character-ball-points = %d", m_pClientList[iClientH]->m_iBallPoints);
strcat(pData, cTxt);
strcat(pData,"\n");

~~~~~Then look for these few lines

m_pClientList[iClientH]->m_iGizonItemUpgradeLeft = atoi(token);
cReadModeA = 0;
break;

~~~~~and again underneath it place:

case 81:
if (_bGetIsStringIsNumber(token) == FALSE) {
wsprintf(cTxt, "(!!!) Player(%s) data file error! (BallPoints) - Connection closed. ", m_pClientList[iClientH]->m_cCharName); 
PutLogList(cTxt);
delete pContents;
delete pStrTok;
return FALSE;
}

m_pClientList[iClientH]->m_iBallPoints = atoi(token);
cReadModeA = 0;
break;

then under..

if (memcmp(token, "gizon-item-upgade-left", 22) == 0) cReadModeA = 80;

place:

if (memcmp(token, "character-ball-points", 21) == 0) cReadModeA = 81;

~~~Then we go to the part which is giving balls the power to give Ball Points.
~~~Look for:

case DEF_ITEMEFFECTTYPE_STUDYMAGIC:
iV1 = m_pClientList[iClientH]->m_pItemList[sItemIndex]->m_sItemEffectValue1;
if (m_pMagicConfigList[iV1] != NULL) 
RequestStudyMagicHandler(iClientH, m_pMagicConfigList[iV1]->m_cName, FALSE);
break;

~~~~and underneath it place:

case DEF_ITEMEFFECTTYPE_ADDBALLPOINTS:
iV1 = m_pClientList[iClientH]->m_pItemList[sItemIndex]->m_sItemEffectValue1;
m_pClientList[iClientH]->m_iBallPoints += iV1;

wsprintf(cInfoString,"%d Ball Points added. Total Amount: %d ", iV1, m_pClientList[iClientH]->m_iBallPoints);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_IPACCOUNTINFO, NULL, NULL, NULL, cInfoString);
break;

~~~Then we're heading to the part which lets the HGServer read the special item file in which items are named which are buyable with Ball Points. Place this underneath the pieces of code which are loading the other CFG's:

if (bReadBallSystemConfigFile("..\\GameConfigs\\BallItems.cfg") == FALSE) {
PutLogList(" ");
PutLogList("(!!!) CRITICAL ERROR! Cannot execute server! AdminSettings.cfg file contents error!");
return FALSE;
}

~~~At the bottom of Game.cpp add the function which actually reads the file:

BOOL CGame::bReadBallSystemConfigFile(char * cFn)
{
FILE * pFile;
HANDLE hFile;
DWORD dwFileSize;
char * cp, * token, cReadModeA, cReadModeB;
char seps[] = "= \t\n";
int iIndex;
class CStrTok * pStrTok;
char cTxt[41];

cReadModeA = 0;
cReadModeB = 0;

hFile = CreateFile(cFn, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL);
dwFileSize = GetFileSize(hFile, NULL);
if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile);

pFile = fopen(cFn, "rt");
if (pFile == NULL) {

PutLogList("(!) Cannot open Ball System configuration file.");
return FALSE;
}
else {
PutLogList("(!) Reading Ball System configuration file...");
cp = new char[dwFileSize+2];
ZeroMemory(cp, dwFileSize+2);
fread(cp, dwFileSize, 1, pFile);

iIndex = 0;
pStrTok = new class CStrTok(cp, seps);
token = pStrTok->pGet();
while( token != NULL ) {
if (cReadModeA != 0) {
switch (cReadModeA) {
case 1:
switch (cReadModeB) {
case 1:

if (_bGetIsStringIsNumber(token) == FALSE) {
PutLogList("(!!!) CRITICAL ERROR! Ball System configuration file error - Wrong Data format(1).");
delete cp;
delete pStrTok;
return FALSE;
}
iIndex = atoi(token);

if (m_pBallItemConfigList[iIndex] != NULL) {

wsprintf(cTxt, "(!!!) CRITICAL ERROR! Duplicate Ball Item ID (%d)", iIndex);
PutLogList(cTxt);
delete pStrTok;
return FALSE;
}
m_pBallItemConfigList[iIndex] = new class CBallSystem;
m_pBallItemConfigList[iIndex]->m_sBS_ID = iIndex;

cReadModeB = 2;
break;

case 2:
ZeroMemory(m_pBallItemConfigList[iIndex]->m_cName, sizeof(m_pBallItemConfigList[iIndex]->m_cName));
memcpy(m_pBallItemConfigList[iIndex]->m_cName, token, strlen(token));
cReadModeB = 3;
break;

case 3:
m_pBallItemConfigList[iIndex]->m_iReqPoints = atoi(token);
cReadModeA = 0;
cReadModeB = 0;
}
break;

default: 
break;
}
}
else {
if (memcmp(token, "Ball-Item", 9) == 0) {
cReadModeA = 1;
cReadModeB = 1;
}

}
token = pStrTok->pGet();
} 

delete pStrTok;
delete cp;

if ((cReadModeA != 0) || (cReadModeB != 0)) {
PutLogList("(!!!) CRITICAL ERROR! Ball System configuration file contents error!");
return FALSE;
}
}

if (pFile != NULL) fclose(pFile);
return TRUE;
}



~~~~Now the command which lets a player obtain items!

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


~~~~Function which gets to be actived:

void CGame::RequestBallItem(int iClientH, char *pData, DWORD dwMsgSize)
{
char seps[] = "= \t\n";
char * cp, * token, cBuff[256], cWantedItemName[256], cData[256], cInfoString[56];
class CStrTok * pStrTok;
class CItem * pItem;
short * sp, sCounter;
int i, iRet, iEraseReq;
DWORD * dwp;
WORD * wp;

if (m_pClientList[iClientH] == NULL) return;

if ((dwMsgSize) <= 0) return;

ZeroMemory(cBuff, sizeof(cBuff));
memcpy(cBuff, pData, dwMsgSize);
pStrTok = new class CStrTok(cBuff, seps);
token = pStrTok->pGet();
token = pStrTok->pGet();

if (token != NULL) {
ZeroMemory(cWantedItemName, sizeof(cWantedItemName));
strcpy(cWantedItemName, token);
}

sCounter = 1;

for (i = 0, i < DEF_MAXBALLITEMS; i++;) {
if (sCounter == 1) {
if (m_pBallItemConfigList[i] != NULL) {
if (strcmp(cWantedItemName, m_pBallItemConfigList[i]->m_cName) == 0) {

if (m_pClientList[iClientH]->m_iBallPoints < m_pBallItemConfigList[i]->m_iReqPoints) {
wsprintf(cInfoString,"Item (%s) cannot be traded, not enough points. ", cWantedItemName);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_IPACCOUNTINFO, NULL, NULL, NULL, cInfoString);
return;
}

m_pClientList[iClientH]->m_iBallPoints -= m_pBallItemConfigList[i]->m_iReqPoints;

pItem = new class CItem;

if (_bInitItemAttr(pItem, cWantedItemName) == FALSE) {
delete pItem;
return; 
}

ZeroMemory(cData, sizeof(cData));
if (_bAddClientItemList(iClientH, pItem, &iEraseReq) == TRUE) {

dwp = (DWORD *)(cData + DEF_INDEX4_MSGID);
*dwp = MSGID_NOTIFY;
wp = (WORD *)(cData + DEF_INDEX2_MSGTYPE);
*wp = DEF_NOTIFY_ITEMOBTAINED;

cp = (char *)(cData + DEF_INDEX2_MSGTYPE + 2);

*cp = 1;
cp++;

memcpy(cp, pItem->m_cName, 20);
cp += 20;

dwp = (DWORD *)cp;
*dwp = pItem->m_dwCount;
cp += 4;

*cp = pItem->m_cItemType;
cp++;

*cp = pItem->m_cEquipPos;
cp++;

*cp = (char)0;
cp++;

sp = (short *)cp;
*sp = pItem->m_sLevelLimit;
cp += 2;

*cp = pItem->m_cGenderLimit;
cp++;

wp = (WORD *)cp;
*wp = pItem->m_wCurLifeSpan;
cp += 2;

wp = (WORD *)cp;
*wp = pItem->m_wWeight;
cp += 2;

sp = (short *)cp;
*sp = pItem->m_sSprite;
cp += 2;

sp = (short *)cp;
*sp = pItem->m_sSpriteFrame;
cp += 2;

*cp = pItem->m_cItemColor;
cp++;

*cp = (char)pItem->m_sItemSpecEffectValue2;
cp++;

dwp = (DWORD *)cp;
*dwp = pItem->m_dwAttribute;
cp += 4;

if (iEraseReq == 1) {
delete pItem;
pItem = NULL;
}

iRet = m_pClientList[iClientH]->m_pXSock->iSendMsg(cData, 53);

sCounter = 0;
return;
}
else {
sCounter = 0;
delete pItem;
return;
}
}
}
}
}
}



~~~~And at last.. a command which shows a player his amount of Ball Points:

if (memcmp(cp, "/ballpoint", 10) == 0) {
char cInfoString[50]; 
wsprintf(cInfoString," Amount of Ball Points: (%d) ", m_pClientList[iClientH]->m_iBallPoints);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_IPACCOUNTINFO, NULL, NULL, NULL, cInfoString);
return;
}
~~~~~ADD to Game.h Search DEF_MAXBANNED add this under it:
#define DEF_MAXBALLITEMS  	50

~~~~~Search
class CDelayEvent    * m_pDelayEventList[DEF_MAXDELAYEVENTS];

~~~~~add under it
class CBallSystem    * m_pBallItemConfigList[DEF_MAXBALLITEMS];

~~~~~also add
	void RequestBallItem(int iClientH, char *pData, DWORD dwMsgSize);
	BOOL bReadBallSystemConfigFile(char * cFn);

~~~befor
};

#endif // !defined(AFX_GAME_H__C3D29FC5_755B_11D2_A8E6_00001C7030A6__INCLUDED_)

~~~IN item.h
~~~befor
#endif // !defined(AFX_ITEM_H__211A1360_91B9_11D2_B143_00001C7030A6__INCLUDED_)

~~~ADD
	//ball trade
	class CBallSystem  
{
public:
	
  short m_sBS_ID;
  char m_cName[20];
  int m_iReqPoints;

};

~~~~~ missing a char under case DEF_ITEMEFFECTTYPE_ADDBALLPOINTS
~~~~~ search case DEF_ITEMEFFECTTYPE_ADDBALLPOINTS
~~~~~ add under it
char cInfoString[56];




Ball-Item = 1 Devastator   100 
Ball-Item = 2 KlonessAxe  60 
Ball-Item = 3 CancelManual 100
Namesis
Regular
Posts: 88
Joined: Fri Mar 03, 2006 12:53 pm

Post by Namesis »

:blink: better to see it that way :lol:
1+12
Member
Posts: 173
Joined: Sat Feb 04, 2006 5:05 pm

Post by 1+12 »

Might be an old topic but w/e anyone know why is it that I cannot even log in to the game?
I can get to the character-screen but after that it wont let me get past it, Im not behind a router, I've configured my firewall, and also I've compiled it with 0 errors and warnings...

Now Im just waiting for someone to tell me why adding this code gets my character all fucked.

character-exp = -4783947
characters int/str/mag/dex/vit/chr are all - 200
characters maj are -

Any reason?

I added the code perfectly.

EDIT://

Nvm I found out the problem.
Post Reply