[src] Summon Guild (only On Same Maps)

Codes already submitted by people of the forums.
Post Reply
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Command coded by Drawjer this will summon all players logged on the same HGserver next to the guildmaster, with a cost.


<span style='color:red'>OPEN GAME.CPP</span>

ADD AT THE END

Code: Select all

void CGame::AdminOrder_SummonGuild(int iClientH, char *pData, DWORD dwMsgSize)
{
char   seps[] = "= \t\n";
char   * cBuff[256], cLocation[11]; 
int    pX, pY, i;
char buff [100];
if (m_pClientList[iClientH] == NULL) return;
if ((dwMsgSize) <= 0) return;

ZeroMemory(cBuff, sizeof(cBuff));
memcpy(cBuff, pData, dwMsgSize);

pX = m_pClientList[iClientH]->m_sX;
pY = m_pClientList[iClientH]->m_sY;
memcpy(cLocation, m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, 11);
wsprintf(buff,"Summon-Guild: %s (%s) %s %d %d",m_pClientList[iClientH]->m_cCharName,m_pClientList[iClientH]->m_cGuildName,cLocation,pX,pY);
PutLogList(buff);
for (i = 0; i < DEF_MAXCLIENTS; i++)
 
 if ((m_pClientList[i] != NULL) && (strcmp(m_pClientList[i]->m_cGuildName,m_pClientList[iClientH]->m_cGuildName) == 0) && (i != iClientH)) {
  RequestTeleportHandler(i, "2   ", cLocation, pX, pY);
 }
}
FIND

Code: Select all

  if (memcmp(cp, "/version", 8) == 0) {
  	ShowVersion(iClientH);
  	return;
  }
AFTER ADD

Code: Select all

 if (memcmp(cp, "/summonguild", 12) == 0) {
  if ((!m_bIsCrusadeMode) || (m_pClientList[iClientH]->m_iGuildRank == 0)) {    
  if (m_pClientList[iClientH]->m_iGuildRank == 0) {    
   if (dwGetItemCount(iClientH, "Gold") >= 5000)  {
   SetItemCount(iClientH, "Gold", dwGetItemCount(iClientH, "Gold") - 5000);
   AdminOrder_SummonGuild(iClientH, cp, dwMsgSize - 21);
  return;
  }
  }
  }
 }
<span style='color:red'>OPEN GAME.H</span>

FIND

Code: Select all

};
BEFORE ADD
void AdminOrder_SummonGuild(int iClientH, char *pData, DWORD dwMsgSize);

Code: Select all


[i]Credits for Drawjer[/i]

[b]Notes:[/b] Will only summon players on same HG and as default has 5000 gold cost. If you have on your sources anything related to SummonGuild on GAME.CPP or GAME.H must delete or comment it out.
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>
snoopy81
Loyal fan
Posts: 338
Joined: Mon Jul 12, 2004 7:13 pm

Post by snoopy81 »

Little variant:
Admins can summon any Guild.
Work on all servers.

Code: Select all

void CGame::AdminOrder_SummonGuild(int iClientH, char *pData, DWORD dwMsgSize)
{char   seps[] = "= \t\n";
 char   * token, * cp, cBuff[256], cMapName[11]; 
 char cGuildName[20]; 
 WORD   *wp;
 int    pX, pY, i;
 class  CStrTok * pStrTok;
 DWORD  dwGoldCount;
	if (m_pClientList[iClientH] == NULL) return;
	if ((dwMsgSize) <= 0) return;
	if (   (m_pClientList[iClientH]->m_iAdminUserLevel < m_iAdminLevelSummonGuild)
  && (m_pClientList[iClientH]->m_iAdminUserLevel != 0))
	{	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ADMINUSERLEVELLOW, NULL, NULL, NULL, NULL);
  return;
	}
	if (m_pClientList[iClientH]->m_iAdminUserLevel == 0) // Check if gm:
	{	if (m_pClientList[iClientH]->m_iGuildRank != 0) return;  
  dwGoldCount = dwGetItemCount(iClientH, "Gold");  // dwGoldCount = player gold
  if (m_iSummonGuildCost > dwGoldCount) 
  {	return;
  }else	// if summonguildcost is less than player gold
  {	SetItemCount(iClientH, "Gold", dwGoldCount - m_iSummonGuildCost); // reduce gold by summonguildcost  	
  }
	}else
	{	//wsprintf(G_cTxt, "GM Order(%-10s): /summonguild (%s)", m_pClientList[iClientH]->m_cCharName, m_pClientList[iClientH]->m_cGuildName);
  //bSendMsgToLS(MSGID_GAMEMASTERLOG, iClientH, FALSE, G_cTxt);
	}
	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;
	}
	pX = m_pClientList[iClientH]->m_sX;
	pY = m_pClientList[iClientH]->m_sY;
	ZeroMemory(cMapName, sizeof(cMapName));
	memcpy(cMapName, m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, 11);
	ZeroMemory(cGuildName, sizeof(cGuildName));
	if (strlen(token) > 20)
  	memcpy(cGuildName, token, 20);
  else memcpy(cGuildName, token, strlen(token));
	for (i = 0; i < DEF_MAXCLIENTS; i++)
	if ((m_pClientList[i] != NULL) && (strcmp(m_pClientList[i]->m_cGuildName, token) == 0)) 
	{	wsprintf(G_cTxt,"PC(%s) summoned by Guild(%s) to %s.", m_pClientList[i]->m_cCharName, cGuildName, cMapName);
  PutLogList(G_cTxt);
  RequestTeleportHandler(i, "2   ", cMapName, pX, pY);  
	}
	wsprintf(G_cTxt,"Guild(%s) summoned by PC(%s) to %s.", cGuildName, m_pClientList[iClientH]->m_cCharName, cMapName);
	PutLogList(G_cTxt);
	ZeroMemory(cBuff, sizeof(cBuff));
	cp = (char *)cBuff;
	*cp = GSM_REQUEST_SUMMONGUILD;
	cp++;
	memcpy(cp, cGuildName, 20);
	cp += 20;
	memcpy(cp, cMapName, 10);
	cp += 10;
	wp = (WORD *)cp;
	*wp = m_pClientList[iClientH]->m_sX;
	cp += 2;
	wp = (WORD *)cp;
	*wp = m_pClientList[iClientH]->m_sY;
	cp += 2;
	bStockMsgToGateServer(cBuff, 35);
	delete pStrTok;
}
in CGame::ServerStockMsgHandler(char *pData):

Code: Select all

  case GSM_REQUEST_SUMMONGUILD:
  	cp++;
  	ZeroMemory(cGuildName, sizeof(cGuildName));
  	memcpy(cGuildName, cp, 20);
  	cp += 20;
  	ZeroMemory(cTemp, sizeof(cMapName));
  	memcpy(cMapName, cp, 10);
  	cp += 10;
  	cp2 = (char *) cTemp + 10;
  	wp = (WORD *)cp;
  	wV1 = *wp;
  	cp += 2;
  	wp = (WORD *)cp;
  	wV2 = *wp;
  	cp += 2;
  	for (i = 0; i < DEF_MAXCLIENTS; i++)
  	if ((m_pClientList[i] != NULL) && (strcmp(m_pClientList[i]->m_cGuildName, cGuildName) == 0)) 
  	{	wsprintf(G_cTxt,"PC(%s) summoned by Guild(%s) to %s.", m_pClientList[i]->m_cCharName, cGuildName, cMapName);
    PutLogList(G_cTxt);
    RequestTeleportHandler(i, "2   ", cMapName, wV1, wV2);
  	}
  	break;
_\_ _<br> / , \__/ . \ Admin of Equilibrium Project<br> II\ \___ . O<br> III \_/ \ _ / <a href='http://www.equiprojet.com' target='_blank'>http://www.equiprojet.com</a><br> II I¯I
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Pretty good...Thx snoopy...

Wondering if anyone can help me to make it...so only can summon people that are on certain map...that will be selected that way people AFK on shop or else won't be summoned by GuildMaster...

And also make it...so that you can only use it on certain maps...like you cannot use the command in xxx map...

So not having a lot of "abuse"
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>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Anyone reading this...might help me on coding a part that when you use the command /summonguild and before it summons the people (talking about the first code not snoopy's) it will check if player has been damaged in the last 10 seconds, if haven't then will summon it; if it has been damaged it will ignore it.
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>
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

locobans wrote: Pretty good...Thx snoopy...

Wondering if anyone can help me to make it...so only can summon people that are on certain map...that will be selected that way people AFK on shop or else won't be summoned by GuildMaster...

And also make it...so that you can only use it on certain maps...like you cannot use the command in xxx map...

So not having a lot of "abuse"
This would be perfect to combine with 2.20 using an AFK aura. If players dont move for 5min they are "AFK" and cant be summoned, trade, party, take guild requests, etc..
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
Kiruku
Loyal fan
Posts: 268
Joined: Wed Feb 22, 2006 12:00 pm
Contact:

Post by Kiruku »

Nice work snoopy <3
<img src='http://lichtdrache.lima-city.de/helbrea ... aramba.gif' border='0' alt='user posted image' />
BlueChristmas
Loyal fan
Posts: 216
Joined: Wed Apr 19, 2006 12:19 am

Post by BlueChristmas »

Kiruku wrote: Nice work snoopy <3
don't bump old topics :angry:
<img src='http://img114.imageshack.us/img114/8618 ... 2dy3lx.jpg' border='0' alt='user posted image' />
Daryl
Regular
Posts: 74
Joined: Thu Dec 16, 2004 1:54 am

Post by Daryl »

OMFG.. damnit i coded this back in old HBX..... It was toad that dident want to fully put it in sources.....



Now look at this shit.
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Daryl wrote: OMFG.. damnit i coded this back in old HBX..... It was toad that dident want to fully put it in sources.....



Now look at this shit.
Yes...you did coded it...only problem was...

Yours didin't worked the way some people wanted it to. :)
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>
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Lol...
Crossfade
Loyal fan
Posts: 354
Joined: Sun Mar 20, 2005 5:55 pm

Post by Crossfade »

locobans wrote:
Daryl wrote: OMFG.. damnit i coded this back in old HBX..... It was toad that dident want to fully put it in sources.....



Now look at this shit.
Yes...you did coded it...only problem was...

Yours didin't worked the way some people wanted it to. :)
you gotta love change :D

OFF TOPIC: lol finally found my old account XD wish i could change the name from Crossfade to penguin lol
Post Reply