[src] Cityhall Teleport

Codes already submitted by people of the forums.
Post Reply
snoopy81
Loyal fan
Posts: 338
Joined: Mon Jul 12, 2004 7:13 pm

Post by snoopy81 »

The TP system is already present in v2.20 server/client sources.
The version here was fixed to suit my needs, and the TPs for Heldenian winner side. As always functions need to be declared, and triggered by receiving the proper msg.

Code: Select all

/*
#define MSGID_REQUEST_TELEPORT_LIST  	0x0EA03202
#define MSGID_RESPONSE_TELEPORT_LIST  0x0EA03203
#define MSGID_REQUEST_CHARGED_TELEPORT  0x0EA03204
#define MSGID_RESPONSE_CHARGED_TELEPORT  0x0EA03205
#define MSGID_REQUEST_HELDENIAN_TP_LIST  0x0EA03206
#define MSGID_RESPONSE_HELDENIAN_TP_LIST	0x0EA03207
#define MSGID_REQUEST_HELDENIAN_TP  	0x0EA03208*/
// RequestTeleportListHandler
void CGame::RequestTeleportListHandler(int iClientH, char * pData, DWORD dwMsgSize)
{	if (m_pClientList[iClientH] == NULL) return;
	if (m_pClientList[iClientH]->m_bIsInitComplete == FALSE) return;
	if (m_pClientList[iClientH]->m_bIsKilled == TRUE) return;
	if (m_pClientList[iClientH]->m_bIsOnWaitingProcess == TRUE) return;
	if (m_pClientList[iClientH]->m_iLockedMapTime != NULL) 
	{	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_LOCKEDMAP, m_pClientList[iClientH]->m_iLockedMapTime, NULL, NULL, m_pClientList[iClientH]->m_cLockedMapName);
  return;
	}
char	*cp, cData[512];
int  iRet;
DWORD	*dwp;
WORD	*wp;
int  *listCount;
char	cNpcName[21];
int  *ip;
	cp = (char *)(pData + DEF_INDEX2_MSGTYPE + 2);
	ZeroMemory(cNpcName, sizeof(cNpcName));
	strncpy(cNpcName, cp, 20);
	cp += 20;
	ZeroMemory(cData, sizeof(cData));
	dwp  = (DWORD *)(cData + DEF_INDEX4_MSGID);
	*dwp = MSGID_RESPONSE_TELEPORT_LIST;
	wp   = (WORD *)(cData + DEF_INDEX2_MSGTYPE);
	*wp  = DEF_MSGTYPE_CONFIRM;
	cp = cData + 6;
	listCount = (int*) cp; 
	*listCount = 0;
	cp += 4; // sizeof(int)
	int  index;
	for&#40;index = 0; index < DEF_MAXTELEPORTLIST; index++&#41;
	&#123;	if&#40; m_pTeleportConfigList&#91;index&#93; == NULL &#41;
  	continue;
  if&#40; strncmp&#40; m_pMapList&#91;m_pClientList&#91;iClientH&#93;->m_cMapIndex&#93;->m_cLocationName, m_pTeleportConfigList&#91;index&#93;->m_cSourceMap, 10&#41; != 0 &#41;
  	continue;
  if&#40; strncmp&#40; m_pTeleportConfigList&#91;index&#93;->m_cTeleportNpcName, cNpcName, 20&#41; != 0 &#41;
  	continue;
  if&#40;    &#40;m_pTeleportConfigList&#91;index&#93;->m_sMinLevel > m_pClientList&#91;iClientH&#93;->m_iLevel&#41;
  	|| &#40;m_pTeleportConfigList&#91;index&#93;->m_sMaxLevel <= m_pClientList&#91;iClientH&#93;->m_iLevel&#41;&#41;
  	continue;
  if &#40;   &#40;m_pTeleportConfigList&#91;index&#93;->m_bHunter == FALSE&#41;
  	&& &#40;m_pClientList&#91;iClientH&#93;->m_bIsPlayerCivil == TRUE&#41;&#41;
  	continue;
  if &#40;   &#40;m_pTeleportConfigList&#91;index&#93;->m_bNetural == FALSE&#41;
  	&& &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 0&#41;&#41;
  	continue;
  if &#40;   &#40;m_pTeleportConfigList&#91;index&#93;->m_bCriminal == FALSE&#41; 
  	&& &#40;m_pClientList&#91;iClientH&#93;->m_iPKCount > 0 &#41;&#41;
  	continue;
  // Side
  switch &#40;m_pTeleportConfigList&#91;index&#93;->m_iSide&#41; &#123;
  default&#58;
  	break;
  case 1&#58;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 1&#41; goto LabelCorrrectTP;
  	break;
  case 2&#58;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 2&#41; goto LabelCorrrectTP;
  	break;
  case 4&#58;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 4&#41; goto LabelCorrrectTP;
  	break;
  case 66&#58; // For Heldenian winner...
  	if &#40;   &#40;m_sLastHeldenianWinner ==  m_pClientList&#91;iClientH&#93;->m_cSide&#41;
    && &#40;m_pClientList&#91;iClientH&#93;->m_bIsPlayerCivil != TRUE&#41; 
    && &#40;m_bIsHeldenianMode == FALSE&#41; &#41;    goto LabelCorrrectTP;
  	break;
  case 12&#58;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 1&#41; goto LabelCorrrectTP;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 2&#41; goto LabelCorrrectTP;
  	break;
  case 124&#58;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 1&#41; goto LabelCorrrectTP;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 2&#41; goto LabelCorrrectTP;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 4&#41; goto LabelCorrrectTP;
  	break;
LabelCorrrectTP&#58;;	
  	ip = &#40;int*&#41; cp;
  	*ip = index;
  	cp += 4;
  	memcpy&#40;cp, m_pTeleportConfigList&#91;index&#93;->m_cTargetMap, 10&#41;;
  	cp += 10;
  	ip = &#40;int*&#41; cp;
  	*ip = m_pTeleportConfigList&#91;index&#93;->m_iDestinationX;
  	cp += 4;
  	ip = &#40;int*&#41; cp;
  	*ip = m_pTeleportConfigList&#91;index&#93;->m_iDestinationY;
  	cp += 4;
  	ip = &#40;int*&#41; cp;
  	*ip = m_pTeleportConfigList&#91;index&#93;->m_iCost;
  	cp += 4;
  	&#40;*listCount&#41; ++;
  &#125;
	&#125; // for
	if &#40; &#40;*listCount&#41; == 0 &#41;*wp  = DEF_MSGTYPE_REJECT;
	// Teleport List
	iRet = m_pClientList&#91;iClientH&#93;->m_pXSock->iSendMsg&#40;cData, 10 + &#40;*listCount&#41; * 26 &#41;;
	switch &#40;iRet&#41; &#123;
	case DEF_XSOCKEVENT_QUENEFULL&#58;
	case DEF_XSOCKEVENT_SOCKETERROR&#58;
	case DEF_XSOCKEVENT_CRITICALERROR&#58;
	case DEF_XSOCKEVENT_SOCKETCLOSED&#58;
  DeleteClient&#40;iClientH, TRUE, TRUE&#41;;
  return;
	&#125;
&#125; // RequestTeleportListHandler

// RequestChargedTeleportHandler
void CGame&#58;&#58;RequestChargedTeleportHandler&#40;int iClientH, char *pData, DWORD dwMsgSize&#41;
&#123;	if &#40;m_pClientList&#91;iClientH&#93; == NULL&#41; return;
	if &#40;m_pClientList&#91;iClientH&#93;->m_bIsInitComplete == FALSE&#41; return;
	if &#40;m_pClientList&#91;iClientH&#93;->m_bIsKilled == TRUE&#41; return;
	if &#40;m_pClientList&#91;iClientH&#93;->m_bIsOnWaitingProcess == TRUE&#41; return;
	char	*cp, cData&#91;64&#93;;
	int  iRet;
	DWORD	*dwp;
	WORD	*wp;
	int  index;
	WORD	wConfirm = DEF_MSGTYPE_CONFIRM;
	short	sError = 0;
	// CHARGED_TELEPORT index
	cp = &#40;char *&#41;&#40;pData + DEF_INDEX2_MSGTYPE + 2&#41;;
	index = &#40;int&#41; &#40;*cp&#41;;
	cp += 4;
	if &#40;&#40;index < 0&#41; || &#40;index >= DEF_MAXTELEPORTLIST&#41;&#41;	return;
	if &#40;m_pTeleportConfigList&#91;index&#93; == NULL &#41;  return;
	if &#40;strncmp&#40; m_pMapList&#91;m_pClientList&#91;iClientH&#93;->m_cMapIndex&#93;->m_cLocationName, m_pTeleportConfigList&#91;index&#93;->m_cSourceMap, 10&#41; != 0 &#41;
  return;
	if &#40;   &#40;m_pTeleportConfigList&#91;index&#93;->m_sMinLevel > m_pClientList&#91;iClientH&#93;->m_iLevel&#41;
  || &#40;m_pTeleportConfigList&#91;index&#93;->m_sMaxLevel <= m_pClientList&#91;iClientH&#93;->m_iLevel&#41;&#41;
	&#123;	wConfirm = DEF_MSGTYPE_REJECT;
  sError = 1;
	&#125;
	if &#40;   &#40;wConfirm == DEF_MSGTYPE_CONFIRM&#41;
  && &#40;m_pTeleportConfigList&#91;index&#93;->m_bHunter == FALSE&#41;
  && &#40;m_pClientList&#91;iClientH&#93;->m_bIsPlayerCivil == TRUE&#41;&#41;
	&#123;	wConfirm = DEF_MSGTYPE_REJECT;
  sError = 2;
	&#125;
	if &#40;   &#40;wConfirm == DEF_MSGTYPE_CONFIRM&#41;
  && &#40;m_pTeleportConfigList&#91;index&#93;->m_bNetural == FALSE&#41;
  && &#40;m_pClientList&#91;iClientH&#93;->m_cSide == 0&#41;&#41;
	&#123;	wConfirm = DEF_MSGTYPE_REJECT;
  sError = 3;
	&#125;
	if &#40;   &#40;wConfirm == DEF_MSGTYPE_CONFIRM&#41;
  && &#40;m_pTeleportConfigList&#91;index&#93;->m_bCriminal == FALSE&#41;
  && &#40;m_pClientList&#91;iClientH&#93;->m_iPKCount > 0 &#41;&#41;
	&#123;  wConfirm = DEF_MSGTYPE_REJECT;
  sError = 4;
	&#125;
	if &#40;wConfirm == DEF_MSGTYPE_CONFIRM &#41;
	&#123;	switch &#40;m_pTeleportConfigList&#91;index&#93;->m_iSide&#41; &#123;
  default&#58;
  	break;
  case 1&#58;
  case 2&#58;
  case 4&#58;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide != m_pTeleportConfigList&#91;index&#93;->m_iSide&#41;
  	&#123;	wConfirm = DEF_MSGTYPE_REJECT;
    sError = 5;
  	&#125;
  	break;
  case 12&#58;
  	if &#40;m_pClientList&#91;iClientH&#93;->m_cSide > 2&#41;
  	&#123;	wConfirm = DEF_MSGTYPE_REJECT;
    sError = 5;
  	&#125;
  	break;
  case 66&#58; // For Heldenian winners only...
  	if &#40;   &#40;m_sLastHeldenianWinner !=  m_pClientList&#91;iClientH&#93;->m_cSide&#41;
    || &#40;m_pClientList&#91;iClientH&#93;->m_bIsPlayerCivil == TRUE&#41; 
    || &#40;m_bIsHeldenianMode == TRUE&#41; &#41;
  	&#123;	wConfirm = DEF_MSGTYPE_REJECT;
    sError = 7;
  	&#125;
  	break;
  case 124&#58;// Everybody
  	break;
  &#125;
	&#125;
	if &#40;wConfirm == DEF_MSGTYPE_CONFIRM &#41;
	&#123;	DWORD dwGoldCount = dwGetItemCount&#40;iClientH, "Gold"&#41;;
  if&#40; dwGoldCount >= m_pTeleportConfigList&#91;index&#93;->m_iCost &#41;
  &#123;	int iGoldWeight = SetItemCount&#40;iClientH, "Gold", dwGoldCount - m_pTeleportConfigList&#91;index&#93;->m_iCost&#41;;
  	iCalcTotalWeight&#40;iClientH&#41;;
  	m_stCityStatus&#91;m_pClientList&#91;iClientH&#93;->m_cSide&#93;.iFunds += m_pTeleportConfigList&#91;index&#93;->m_iCost;
  &#125;else
  &#123;	wConfirm = DEF_MSGTYPE_REJECT;
  	sError = 6;
  &#125;
	&#125;
	// Invalid Charged-teleport
	if &#40; wConfirm == DEF_MSGTYPE_REJECT &#41;
	&#123;	ZeroMemory&#40;cData, sizeof&#40;cData&#41;&#41;;
  dwp  = &#40;DWORD *&#41;&#40;cData + DEF_INDEX4_MSGID&#41;;
  *dwp = MSGID_RESPONSE_CHARGED_TELEPORT;
  wp   = &#40;WORD *&#41;&#40;cData + DEF_INDEX2_MSGTYPE&#41;;
  *wp  = wConfirm;
  cp = cData + DEF_INDEX2_MSGTYPE + 2;
  short	*sp;
  sp	= &#40;short*&#41; cp;
  *sp	= sError;
  cp += 2;
  // Teleport List
  iRet = m_pClientList&#91;iClientH&#93;->m_pXSock->iSendMsg&#40;cData, 6 + 2 &#41;;
  switch &#40;iRet&#41; &#123;
  case DEF_XSOCKEVENT_QUENEFULL&#58;
  case DEF_XSOCKEVENT_SOCKETERROR&#58;
  case DEF_XSOCKEVENT_CRITICALERROR&#58;
  case DEF_XSOCKEVENT_SOCKETCLOSED&#58;
  	DeleteClient&#40;iClientH, TRUE, TRUE&#41;;
  	return;
  &#125;
  return;
	&#125;
	// teleport
	RequestTeleportHandler&#40;iClientH, "2   ",
  m_pTeleportConfigList&#91;index&#93;->m_cTargetMap,
  m_pTeleportConfigList&#91;index&#93;->m_iDestinationX,
  m_pTeleportConfigList&#91;index&#93;->m_iDestinationY&#41;;

&#125; // RequestChargedTeleportHandler
// Snoopy&#58; Teleport List
BOOL CGame&#58;&#58;bDecodeTeleportList&#40;char *pFn&#41;
&#123;FILE * pFile;
 HANDLE hFile;
 DWORD  dwFileSize;
 char * cp, * token, cReadModeA, cReadModeB;
 char seps&#91;&#93; = "= &#092;t&#092;n";
 class CStrTok * pStrTok;
 int   iIndex;
 int iTeleportConfigListIndex; 
	for &#40;int i = 0; i <  DEF_MAXTELEPORTLIST; i++&#41;
	if &#40;m_pTeleportConfigList&#91;i&#93; != NULL&#41; 
	&#123;	delete m_pTeleportConfigList&#91;i&#93;;
  m_pTeleportConfigList&#91;i&#93; = NULL;
	&#125;
	cReadModeA = 0;
	cReadModeB = 0;
	iIndex = 0;
	hFile = CreateFile&#40;pFn, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL&#41;;
	dwFileSize = GetFileSize&#40;hFile, NULL&#41;;
	if &#40;hFile != INVALID_HANDLE_VALUE&#41; CloseHandle&#40;hFile&#41;;
	pFile = fopen&#40;pFn, "rt"&#41;;
	if &#40;pFile == NULL&#41;
	&#123;	PutLogList&#40;"&#40;!&#41; Cannot open Teleport.cfg file."&#41;;
  return FALSE;
	&#125;else
	&#123;	PutLogList&#40;"&#40;!&#41; Reading TeleportList.cfg..."&#41;;
  cp = new char&#91;dwFileSize+2&#93;;
  ZeroMemory&#40;cp, dwFileSize+2&#41;;
  fread&#40;cp, dwFileSize, 1, pFile&#41;;
  pStrTok = new class CStrTok&#40;cp, seps&#41;;
  token = pStrTok->pGet&#40;&#41;;
  while&#40; token != NULL &#41; 
  &#123;	if &#40;cReadModeA != 0&#41; 
  	&#123;	switch &#40;cReadModeA&#41; &#123;
    case 1&#58;
    	switch &#40;cReadModeB&#41; &#123;
    	case 1&#58; // Teleport n°
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Wrong Data format."&#41;;
      	delete pStrTok;	delete cp; return FALSE;
      &#125;
      iTeleportConfigListIndex = atoi&#40;token&#41;;
      if &#40;&#40;iTeleportConfigListIndex < 0&#41; || &#40;iTeleportConfigListIndex >= DEF_MAXTELEPORTLIST&#41;&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Wrong TeleportList number."&#41;;
      	return FALSE;
      &#125;
      if &#40;m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93; != NULL&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Duplicate TeleportList number."&#41;;
      	return FALSE;
      &#125;
      m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93; = new class CTeleport;
      cReadModeB = 2;
      break;
    	case 2&#58; // NPC name
      memcpy&#40;m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_cTeleportNpcName, token, strlen&#40;token&#41;&#41;;
      cReadModeB = 3;
      break;
    	case 3&#58; // SOURCE MAP
      memcpy&#40;m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_cSourceMap, token, strlen&#40;token&#41;&#41;;
      cReadModeB = 4;
      break;
    	case 4&#58; // TARGET MAP
      memcpy&#40;m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_cTargetMap, token, strlen&#40;token&#41;&#41;;
      cReadModeB = 5;
      	break;
    	case 5&#58; // TARGET MAP X
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - X - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iDestinationX = atoi&#40;token&#41;;
      cReadModeB = 6;
      break;
    	case 6&#58; // TARGET MAP Y
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Y - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iDestinationY = atoi&#40;token&#41;;
      cReadModeB = 7;
      break;
    	case 7&#58; // COST
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Cost - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iCost = atoi&#40;token&#41;;
      cReadModeB = 8;
      break;
    	case 8&#58; // Minimum Level
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - MinLvl - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_sMinLevel = atoi&#40;token&#41;;
      cReadModeB = 9;
      break;
    	case 9&#58; // Maximum Level
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - MaxLvl- Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_sMaxLevel = atoi&#40;token&#41;;
      cReadModeB = 10;
      break;
    	case 10&#58; // Side &#40;aresden, elvein&#41;
      if&#40; memcmp&#40;token, "aresden", 7&#41; == 0 &#41;
      &#123;	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iSide = 1;
      &#125;else if&#40; memcmp&#40;token, "elvine", 6&#41; == 0 &#41;
      &#123;	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iSide = 2;
      &#125;else if&#40; memcmp&#40;token, "both", 4&#41; == 0 &#41;
      &#123;	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iSide = 12;
      &#125;else if&#40; memcmp&#40;token, "evil", 4&#41; == 0 &#41;
      &#123;	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iSide = 4;
      &#125;else if&#40; memcmp&#40;token, "all", 3&#41; == 0 &#41;
      &#123;	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iSide = 124;
      &#125;else if&#40; memcmp&#40;token, "heldenian", 9&#41; == 0 &#41;
      &#123;	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_iSide = 66;
      &#125;else
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Side - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      cReadModeB = 11;
      break;
    	case 11&#58; // HuntMode &#40;0,1&#41;
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41; &#123;
      	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Hunter - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      if&#40; memcmp&#40;token,"0",1&#41; == 0 &#41;
      	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_bHunter = FALSE;
      else if&#40; memcmp&#40;token,"1",1&#41; == 0 &#41;
      	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_bHunter = TRUE;
      else
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Hunter - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      cReadModeB = 12;
      break;
    	case 12&#58; // Netural &#40;0,1&#41;
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Neutral - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      if&#40; memcmp&#40;token,"0",1&#41; == 0 &#41;
      	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_bNetural = FALSE;
      else if&#40; memcmp&#40;token,"1",1&#41; == 0 &#41;
      	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_bNetural = TRUE;
      else
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Neutral - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      cReadModeB = 13;
      break;
    	case 13&#58; // Criminal &#40;0,1&#41;
      if &#40;_bGetIsStringIsNumber&#40;token&#41; == FALSE&#41;
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Crim - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      if &#40; memcmp&#40;token,"0",1&#41; == 0 &#41;
      	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_bCriminal = FALSE;
      else if&#40; memcmp&#40;token,"1",1&#41; == 0 &#41;
      	m_pTeleportConfigList&#91;iTeleportConfigListIndex&#93;->m_bCriminal = TRUE;
      else
      &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file error - Crim - Wrong Data format."&#41;;
      	delete cp; delete pStrTok; return FALSE;
      &#125;
      cReadModeA = 0;
      cReadModeB = 0;
      break;
    	&#125;
    	break;
    default&#58;
    	break;
    &#125;
  	&#125;else
  	&#123;	if &#40;memcmp&#40;token, "teleport", 8&#41; == 0&#41;
    &#123;	cReadModeA = 1;
    	cReadModeB = 1;
    &#125;else if &#40;memcmp&#40;token, "&#91;END&#93;", 5&#41; == 0&#41;
    &#123;	cReadModeA = 0;
    	cReadModeB = 0;
    	break; // Stop While Loop
    &#125;
  	&#125;
  	token = pStrTok->pGet&#40;&#41;;
  &#125; // while
  delete pStrTok;	delete cp;
  if &#40;&#40;cReadModeA != 0&#41; || &#40;cReadModeB != 0&#41;||&#40;iTeleportConfigListIndex < 0&#41;||&#40;iTeleportConfigListIndex >= DEF_MAXTELEPORTLIST&#41;&#41;
  &#123;	PutLogList&#40;"&#40;!!!&#41; CRITICAL ERROR! TELEPORT-LIST configuration file contents error!"&#41;;
  	return FALSE;
  &#125;
  if &#40;pFile != NULL&#41; fclose&#40;pFile&#41;;
  wsprintf&#40;G_cTxt, "&#40;!&#41; TELEPORT-LIST&#40;Total&#58;%d&#41; configuration - success!", iTeleportConfigListIndex&#41;;
  PutLogList&#40;G_cTxt&#41;;
  return TRUE;
	&#125;
&#125;
<span style='color:purple'>As for all evoluted codes given here, it's not just a matter of clip'n paste. If you don't know C++, learn first!</span>
_\_ _<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 »

Thanks snoopy ^_^
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>
SlammeR
Loyal fan
Posts: 219
Joined: Fri Nov 04, 2005 1:52 am
Location: Brazil

Post by SlammeR »

i added this to 2.24b sources without problems... modified here and there, but in game everytime i ask for tp it says "There is no Area That You Can Teleport" any idea of how to solve it!? i checked and compared with 2.2 its almost the same... help plz
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>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Remember your WorldLogServer must send the TeleportList.cfg to the HGserver so it can read it successfully...
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>
SlammeR
Loyal fan
Posts: 219
Joined: Fri Nov 04, 2005 1:52 am
Location: Brazil

Post by SlammeR »

locobans wrote: Remember your WorldLogServer must send the TeleportList.cfg to the HGserver so it can read it successfully...
it reads from GameConfigs folder...

Code: Select all

(2006: 9: 6:11:59) - (!) Reading Teleport.cfg...
(2006: 9: 6:11:59) - (!) TELEPORT-LIST(Total:6) configuration - success!
i dont think the error is on Decode function

***EDIT***

nvm fixed ;) got it working ^^
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>
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

x.x, this is an old topic... but cool
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

What was the problem anyways SlammeR?
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 »

SlammeR????

P.S: You have a copy of Teleport.cfg too SlammeR ???
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>
SlammeR
Loyal fan
Posts: 219
Joined: Fri Nov 04, 2005 1:52 am
Location: Brazil

Post by SlammeR »

What was the problem anyways SlammeR?
the error was here:
if(strncmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cLocationName, m_pTeleportConfigList[index]->m_cSourceMap, 10) != 0) continue;
with that i get "There Is No Area That You Can Teleport" everytime i ask for tp, so i went to 2.20 sources and found this:
if(strncmp(m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->m_cName, m_pTeleportConfigList[index]->m_cSourceMap, 10) != 0) continue;
so fixed my problem ;D
locobans wrote: SlammeR????

P.S: You have a copy of Teleport.cfg too SlammeR ???
what u mean!?
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>
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

Forget 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>
Post Reply