[src]Notice Messages (with comments)

Codes already submitted by people of the forums.
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

Seeing as I stopped working on HBXP source because too many nubs pissed me off, i'm going to release some of the stuff I made.. Not sure if its any use, but I had fun with it.

Basically it will display a random message every few minutes, can be useful for reminding people of stuff, or whatever you want to put in there..

Anyway- here's the code.

In HGServer ->> game.cpp

FIND:

Code: Select all

void CGame::OnTimer(char cType)
ADD at the top:

Code: Select all

	int q; //added for "advertiser"
	char cAdvert[1000]; //holds the text for the "advert"
	ZeroMemory(cAdvert, sizeof(cAdvert));
FIND

Code: Select all

	if ((dwTime - m_dwGameTime3) > 3000) {
  SyncMiddlelandMapInfo();
  CheckDynamicObjectList();
  DynamicObjectEffectProcessor();
  NoticeHandler();
  SpecialEventHandler();
  EnergySphereProcessor();
  m_dwGameTime3 = dwTime;
	}
ADD BELOW:

Code: Select all

	//Orkl: Advertiser Code
	if ((dwTime - m_dwGameTime7) > 800000) { //Timer
   switch(iDice(1,10)) { //Pick a random advert
//Change these to whatever you want to display
    case  1: wsprintf(cAdvert, "SERVER: Advert1"); break;
    case  2: wsprintf(cAdvert, "SERVER: Advert2"); break;
    case  3: wsprintf(cAdvert, "SERVER: Advert3"); break;
    case  4: wsprintf(cAdvert, "SERVER: Advert4"); break;
    case  5: wsprintf(cAdvert, "SERVER: Advert5"); break;
    case  6: wsprintf(cAdvert, "SERVER: Advert6"); break;
    case  7: wsprintf(cAdvert, "SERVER: Advert7"); break;
    case  8: wsprintf(cAdvert, "SERVER: Advert8"); break;
    case  9: wsprintf(cAdvert, "SERVER: Advert9"); break;
    case 10: wsprintf(cAdvert, "SERVER: Advert10"); break;
   }

  	for (q = 1; q < DEF_MAXCLIENTS; q++) // Check all clients
  	{
     if ((m_pClientList[q] != NULL))  // Check if client is active
    	{ //Send message to server.
      SendNotifyMsg(NULL, q, DEF_NOTIFY_NOTICEMSG, NULL, NULL, NULL, cAdvert);
    	}
  	}
  m_dwGameTime7 = dwTime; //Reset timer so it doesn't spam :D
	}
	//end

In HGServer ->> Game.h

FIND:

Code: Select all

DWORD m_dwWhetherTime, m_dwGameTime1, m_dwGameTime2, m_dwGameTime3, m_dwGameTime4, m_dwGameTime5, m_dwGameTime6, m_dwFishTime; 
REPLACE WITH

Code: Select all

DWORD m_dwWhetherTime, m_dwGameTime1, m_dwGameTime2, m_dwGameTime3, m_dwGameTime4, m_dwGameTime5, m_dwGameTime6, m_dwGameTime7, m_dwFishTime; //Orkl - added 7 for advertiser
->>Save all & build

Basically this will display one of the 10 messages to the client every time the timer goes off.. You can change the time to whatever you want, but what its set as works quite well.

Suggestions for adverts:

"SERVER: Welcome to ~SERVER~, we hope you enjoy your stay"
"SERVER: Please vote for us by visiting: <a href='http://SERVER.EXTENSION' target='_blank'>http://SERVER.EXTENSION</a> and clicking on the buttons!"
"SERVER: Please dont annoy GM's for events, if a GM is free, they may do an event"

You get the idea..

Enjoy :D
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
User avatar
Shinakuma
Member
Posts: 110
Joined: Thu Aug 04, 2005 3:52 pm
Location: USA

Post by Shinakuma »

<3 Orkl!
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

i want xml based advertismen list with popup and banner :unsure:
<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)
SlammeR
Loyal fan
Posts: 219
Joined: Fri Nov 04, 2005 1:52 am
Location: Brazil

Post by SlammeR »

i think this is allready coded but unused by servers o.O

take a look on

Code: Select all

BOOL CGame::bReadNotifyMsgListFile(char * cFn)
just create a new txt named notice.txt and add the following txt

notify_msg = ENJOY OUR SERVER

;)
OWNED!<br><img src='http://img50.imageshack.us/img50/1386/p ... 3vsqn2.gif' border='0' alt='user posted image' /><br><br><img src="http://hbtop50.com/button.php?u=hbuonline" alt="Helbreath Top 50 - Keepin' it real." border="0" /><br><a href='http://www.hbuonline.net' target='_blank'>Helbreath United</a>
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

SlammeR wrote: i think this is allready coded but unused by servers o.O

take a look on

Code: Select all

BOOL CGame::bReadNotifyMsgListFile(char * cFn)
just create a new txt named notice.txt and add the following txt

notify_msg = ENJOY OUR SERVER

;)
I noticed that.. but my server didn't seem to like it.. meh, can do it either way I guess.
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Hepha
Regular
Posts: 31
Joined: Wed Dec 14, 2005 10:57 pm

Post by Hepha »

Very nice.. thx :D
<img src='http://img174.imageshack.us/img174/9513 ... ionrv6.png' border='0' alt='user posted image' />
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Yes. More Submissions the better..
maku
Regular
Posts: 42
Joined: Sat Dec 11, 2004 5:10 am

Post by maku »

C:\Documents and Settings\********\*****\******\2.20a Sources\Game.cpp(49781) : error C2146: syntax error : missing ';' before identifier 'q'
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

maku wrote: C:\Documents and Settings\********\*****\******\2.20a Sources\Game.cpp(49781) : error C2146: syntax error : missing ';' before identifier 'q'
Compiled ok for me.. i'm at work at the moment and will look at it again when I get home.
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

Orkl wrote:
maku wrote: C:\Documents and Settings\********\*****\******\2.20a Sources\Game.cpp(49781) : error C2146: syntax error : missing ';' before identifier 'q'
Compiled ok for me.. i'm at work at the moment and will look at it again when I get home.
Nope, compiled ok for me.. Make sure you follow instructions correctly..

Anyone else having this issue?
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
maku
Regular
Posts: 42
Joined: Sat Dec 11, 2004 5:10 am

Post by maku »

done :) works now =)
small error ;P
User avatar
Shinakuma
Member
Posts: 110
Joined: Thu Aug 04, 2005 3:52 pm
Location: USA

Post by Shinakuma »

maku what did you do to fix it?
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

maku wrote: done :) works now =)
small error ;P
What error did you find?
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
User avatar
Shinakuma
Member
Posts: 110
Joined: Thu Aug 04, 2005 3:52 pm
Location: USA

Post by Shinakuma »

Game.cpp(3102) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition

Code i've entered.

Code: Select all

void CGame::OnTimer(char cType);
int q; // Added for "Advertiser
char cAdvert[1000]; // Holds the text for the "Advert"
ZeroMemory(cAdvert, sizeof(cAdvert))
{ <---- is what the error is directed at.
	DWORD dwTime;

	dwTime = timeGetTime();
	GameProcess();
	if ((dwTime - m_dwGameTime2) > 3000) {
  CheckClientResponseTime();
  SendMsgToGateServer(MSGID_GAMESERVERALIVE, NULL, NULL);
  CheckDayOrNightMode();
  InvalidateRect(G_hWnd, NULL, TRUE);
  m_dwGameTime2 = dwTime;
  _CheckGateSockConnection();
  if ((m_bIsGameStarted == FALSE)     && (m_bIsItemAvailable == TRUE)      && 
  	(m_bIsNpcAvailable == TRUE)     && (m_bIsGateSockAvailable == TRUE)  &&
  	(m_bIsLogSockAvailable == TRUE) && (m_bIsMagicAvailable == TRUE)     &&
  	(m_bIsSkillAvailable == TRUE)   && (m_bIsPotionAvailable == TRUE)   &&
  	(m_bIsQuestAvailable == TRUE)   && (m_bIsBuildItemAvailable == TRUE) && 
  	(m_iSubLogSockActiveCount == DEF_MAXSUBLOGSOCK)) { // && (m_bIsWLServerAvailable == TRUE)) {
  	PutLogList("Sending start message...");
  	SendMessage(m_hWnd, WM_USER_STARTGAMESIGNAL, NULL, NULL);
  	m_bIsGameStarted = TRUE;
  }
	}
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

There's your problem there:

CHANGE::

Code: Select all

void CGame::OnTimer(char cType);
TO::

Code: Select all

void CGame::OnTimer(char cType) {
-and-

CHANGE::

Code: Select all

ZeroMemory(cAdvert, sizeof(cAdvert))
TO::

Code: Select all

ZeroMemory(cAdvert, sizeof(cAdvert));
Make sure you copy + paste or re-write code correctly >.>
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Post Reply