Join Helbreath
Would you like to react to this message? Create an account in a few clicks or log in to continue.


An essential info site for anyone learning the game. Great community and often very insightful posts.
 
HomeUseful information for Helbreath beginnersPlay, discover, and broadcast your Helbreath moments for free.Statistics overviewSearchMemberlistRulesRegisterLog in
 

 [CODE] Capture The Flag

Go down 
AuthorMessage
Centuu.-
‏‏‎ ‎‏‏‎ ‎
‏‏‎ ‎‏‏‎ ‎
Centuu.-

Posts : 232

[CODE] Capture The Flag Empty
PostSubject: [CODE] Capture The Flag   [CODE] Capture The Flag 999101/13/2020, 2:16 pm

Code:
ClientSRC:
Game.cpp:
Buscar:
Código:

m_iIlusionOwnerH = NULL;
 m_cIlusionOwnerType = NULL;

y justo abajo agregar:
Código:

//50Cent - Capture The Flag
 m_bIsCTFMode = false;
 m_sElvineFlagCount = 0;
 m_sAresdenFlagCount = 0;
 m_bIsElvineFlagStatus = true;
 m_bIsAresdenFlagStatus = true;

Buscar:
Código:

case DEF_NOTIFY_APOCFORCERECALLPLAYERS: // Snoopy ;  Case BD7 of switch 00454077
 AddEventList( "You are recalled by force, because the Apocalypse is started.", 10 );
 break;

y justo abajo agregar:
Código:

//50Cent - Capture The Flag
 case DEF_NOTIFY_CAPTURETHEFLAGSTART:
 m_bIsCTFMode = true;
 SetTopMsg("Capture The Flag Event has started!", 10);
 break;
 case DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG:
 m_bIsElvineFlagStatus = false;
 SetTopMsg("Aresden Captured Elvine Flag!", 10);
 break;
 case DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG:
 m_bIsAresdenFlagStatus = false;
 SetTopMsg("Elvine Captured Aresden Flag!", 10);
 break;
 case DEF_NOTIFY_ELVINEFLAGBACKTOCH:
 m_bIsElvineFlagStatus = true;
 SetTopMsg("Elvine Flag Back to Base!", 10);
 break;
 case DEF_NOTIFY_ARESDENFLAGBACKTOCH:
 m_bIsAresdenFlagStatus = true;
 SetTopMsg("Aresden Flag Back to Base!", 10);
 break;
 case DEF_NOTIFY_ELVINEWINSROUND:
 m_sElvineFlagCount++;
 m_bIsAresdenFlagStatus = true;
 SetTopMsg("Elvine wins this Round!", 10);
 break;
 case DEF_NOTIFY_ARESDENWINSROUND:
 m_sAresdenFlagCount++;
 m_bIsElvineFlagStatus = true;
 SetTopMsg("Aresden wins this Round!", 10);
 break;
 case DEF_NOTIFY_ELVINEWINCTF:
 m_bIsCTFMode = false;
 m_sElvineFlagCount = 0;
 m_sAresdenFlagCount = 0;
 m_bIsElvineFlagStatus = true;
 m_bIsAresdenFlagStatus = true;
 SetTopMsg("Elvine wins Capture The Flag Event!", 10);
 break;
 case DEF_NOTIFY_ARESDENWINCTF:
 m_bIsCTFMode = false;
 m_sElvineFlagCount = 0;
 m_sAresdenFlagCount = 0;
 m_bIsElvineFlagStatus = true;
 m_bIsAresdenFlagStatus = true;
 SetTopMsg("Aresden wins Capture The Flag Event!", 10);
 break;
 case DEF_NOTIFY_TIECTF:
 m_bIsCTFMode = false;
 m_sElvineFlagCount = 0;
 m_sAresdenFlagCount = 0;
 m_bIsElvineFlagStatus = true;
 m_bIsAresdenFlagStatus = true;
 SetTopMsg("Capture The Flag Event ended in a tie.", 10);
 break;

Buscar:
Código:

if (   (iUpdateRet != 0 ) && (m_iHeldenianAresdenLeftTower != -1)
 && (memcmp(m_cCurLocation, "BtField", 7) == 0))
 { wsprintf( G_cTxt, "Aresden Flags : %d",  m_iHeldenianAresdenFlags);
 PutString( 10, 140, G_cTxt, RGB(255,255,255) );
 wsprintf( G_cTxt, "Aresden Flags : %d",  m_iHeldenianElvineFlags);
 PutString( 10, 160, G_cTxt, RGB(255,255,255) );
 wsprintf( G_cTxt, "Aresden's rest building number : %d",  m_iHeldenianAresdenLeftTower);
 PutString( 10, 180, G_cTxt, RGB(255,255,255) );
 wsprintf( G_cTxt, "Elvine's rest building number : %d",  m_iHeldenianElvineLeftTower);
 PutString( 10, 200, G_cTxt, RGB(255,255,255) );
 }

y justo abajo agregar:
Código:

//50Cent - Capture The Flag
 if(m_bIsCTFMode)
 {
 wsprintf(G_cTxt, "Elvine Flags: %d",  m_sElvineFlagCount);
 PutString(10, 140, G_cTxt, RGB(255,255,255));
 if(m_bIsElvineFlagStatus) PutString(10, 160, "Elvine Flag Protected", RGB(0,255,0));
 else PutString(10, 160, "Elvine Flag Captured!", RGB(255,0,0));

 wsprintf(G_cTxt, "Aresden Flags: %d",  m_sAresdenFlagCount);
 PutString(10, 180, G_cTxt, RGB(255,255,255));
 if(m_bIsAresdenFlagStatus) PutString(10, 200, "Aresden Flag Protected", RGB(0,255,0));
 else PutString(10, 200, "Aresden Flag Captured!", RGB(255,0,0));

 if(m_bIsElvineFlagStatus) if(memcmp(m_cCurLocation, "elvine", 6) == 0) m_pSprite[DEF_SPRID_ITEMDYNAMIC_PIVOTPOINT + 2]->PutSpriteFast(151*32 - m_sViewPointX - 96, 132*32 - m_sViewPointY - 69, 5, dwTime); //elvine flag
 else if(memcmp(m_cCurLocation, "elvine", 6) == 0) m_pSprite[DEF_SPRID_ITEMDYNAMIC_PIVOTPOINT + 2]->PutTransSprite2(151*32 - m_sViewPointX - 96, 132*32 - m_sViewPointY - 69, 5, dwTime); //elvine flag
 
 if(m_bIsAresdenFlagStatus) if(memcmp(m_cCurLocation, "aresden", 7) == 0) m_pSprite[DEF_SPRID_ITEMDYNAMIC_PIVOTPOINT + 2]->PutSpriteFast(151*32 - m_sViewPointX - 96, 132*32 - m_sViewPointY - 69, 1, dwTime); //aresden flag
 else if(memcmp(m_cCurLocation, "aresden", 7) == 0) m_pSprite[DEF_SPRID_ITEMDYNAMIC_PIVOTPOINT + 2]->PutTransSprite2(151*32 - m_sViewPointX - 96, 132*32 - m_sViewPointY - 69, 1, dwTime); //aresden flag
 }

Buscar en todos los metodos DrawObject_On...:
Código:

DrawAngel(40+(_tmp_cDir - 1), sX+20, sY-20, _tmp_cFrame%4, dwTime);
 CheckActiveAura2(sX, sY, dwTime,  _tmp_sOwnerType);

y justo abajo agregar:
Código:

//50Cent - Capture The Flag
 DrawFlagCarrier(sX, sY, _tmp_cFrame, dwTime);

alfinal del game.cpp agregar:
Código:

//50Cent - Capture The Flag
void CGame::DrawFlagCarrier(short sX, short sY, char cFrame, DWORD dwTime)
{
 if((_tmp_iStatus & 0x80000) != 0) m_pSprite[DEF_SPRID_ITEMGROUND_PIVOTPOINT + 6]->PutSpriteFast(sX, sY - 80, 57, dwTime); //elvine flag
 else if((_tmp_iStatus & 0x40000) != 0) m_pSprite[DEF_SPRID_ITEMGROUND_PIVOTPOINT + 6]->PutSpriteFast(sX, sY - 80, 56, dwTime); //aresden flag
}

Game.h:
Declarar:
Código:

//50Cent - Capture The Flag
 void DrawFlagCarrier(short sX, short sY, char cFrame, DWORD dwTime);

//50Cent - Capture The Flag
 BOOL m_bIsCTFMode;
 short m_sElvineFlagCount;
 short m_sAresdenFlagCount;
 BOOL m_bIsElvineFlagStatus;
 BOOL m_bIsAresdenFlagStatus;

Netmessage.h:
Código:

//50Cent - Capture The Flag
#define DEF_NOTIFY_CAPTURETHEFLAGSTART 0x1F19
#define DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG 0x1F21
#define DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG 0x1F22
#define DEF_NOTIFY_ELVINEFLAGBACKTOCH 0x1F23
#define DEF_NOTIFY_ARESDENFLAGBACKTOCH 0x1F24
#define DEF_NOTIFY_ELVINEWINSROUND 0x1F25
#define DEF_NOTIFY_ARESDENWINSROUND 0x1F26
#define DEF_NOTIFY_ELVINEWINCTF 0x1F27
#define DEF_NOTIFY_ARESDENWINCTF 0x1F28
#define DEF_NOTIFY_TIECTF 0x1F29


HGServerSRC
Code:

HGSRC:
Game.cpp:
Buscar:
Código:

ZeroMemory(m_cHeldenianMapName, sizeof(m_cHeldenianMapName));

justo despues agregar:
Código:

//50Cent - Capture The Flag
 m_sFlagCountWin = 0;
 m_bIsCTFMode = false;
 m_bIsElvineFlagCaptured = false;
 m_bIsAresdenFlagCaptured = false;
 m_iFlagCarrierIndex = -1;

Buscar:
Código:

delete m_pClientList[iClientH];
 m_pClientList[iClientH] = NULL;

 RemoveClientShortCut(iClientH);

y justo antes agregar:
Código:

//50Cent - Capture The Flag
 if(bCheckIfIsFlagCarrier(iClientH))
 {
 SetFlagCarrierFlag(iClientH, false);
 SetIceFlag(iClientH, DEF_OWNERTYPE_PLAYER, false);
 }

Buscar:
Código:

if (m_bIsApocalypseMode == TRUE) {
 if (memcmp(m_pMapList[m_pClientList[i]->m_cMapIndex]->m_cName, "abaddon", 7) == 0) {
 SendNotifyMsg(NULL, i, DEF_NOTIFY_APOCGATEOPEN, 167, 169, NULL, m_pClientList[i]->m_cMapName);
 }
 else if (memcmp(m_pMapList[m_pClientList[i]->m_cMapIndex]->m_cName, "icebound",  == 0) {
 SendNotifyMsg(NULL, i, DEF_NOTIFY_APOCGATEOPEN, 89, 31, NULL, m_pClientList[i]->m_cMapName);
 }
 }

justo despues agregar:
Código:

//50Cent - Capture The Flag
 if(m_bIsCTFMode)
 {
 RequestCheckFlag(i);
 if(bCheckIfIsFlagCarrier(i))
 {
 if(m_pClientList[i]->m_iHP >= 1)
 {
 SetInvisibilityFlag(i, DEF_OWNERTYPE_PLAYER, false);
 SetIceFlag(i, DEF_OWNERTYPE_PLAYER, true);
 }
 }
 }

Buscar:
Código:

if (memcmp(cp, "/who", 4) == 0) {
 // New 08/05/2003
 if (m_pClientList[iClientH]->m_iAdminUserLevel >= m_iAdminLevelWho) {
 // Àüü »ç¿ëÀÚ ¼ö¸¦ ¹¯´Â °ÍÀÌ´Ù.
 SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_TOTALUSERS, NULL, NULL, NULL, NULL);
 }
 return;
 }

justo despues agregar:
Código:

//50Cent - Capture The Flag
 if (memcmp(cp, "/startctf", 9) == 0) {
 if (m_pClientList[iClientH]->m_iAdminUserLevel >= 4) StartCaptureTheFlag();
 return;
 }
 if (memcmp(cp, "/endctf", 7) == 0) {
 if (m_pClientList[iClientH]->m_iAdminUserLevel >= 4) EndCaptureTheFlag(0);
 return;
 }

buscar:
Código:

case DEF_NOTIFY_NORECALL:

justo despues agregar:
Código:

//50Cent - Capture The Flag
 case DEF_NOTIFY_CAPTURETHEFLAGSTART:
 case DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG:
 case DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG:
 case DEF_NOTIFY_ELVINEFLAGBACKTOCH:
 case DEF_NOTIFY_ARESDENFLAGBACKTOCH:
 case DEF_NOTIFY_ELVINEWINSROUND:
 case DEF_NOTIFY_ARESDENWINSROUND:
 case DEF_NOTIFY_ELVINEWINCTF:
 case DEF_NOTIFY_ARESDENWINCTF:
 case DEF_NOTIFY_TIECTF:

Buscar:
Código:

 case DEF_MAGICTYPE_TELEPORT:
 // ÅÚ·¹Ãâ€*÷Ãâ€*® ¸¶¹ý. sValue 4¿¡ µû¶ó¼ÂÂ* ÅÚ·¹Ãâ€*÷Ãâ€*® ¸ñÀûÁö°¡ °áÁ¤µÈ´Ù.
 m_pMapList[m_pClientList[iClientH]->m_cMapIndex]->GetOwner(&sOwnerH, &cOwnerType, dX, dY);

y justo despues del //comentario agregar:
Código:

//50Cent - Capture The Flag
 if(bCheckIfIsFlagCarrier(iClientH))
 {
 ShowClientMsg(iClientH, "You can not use that magic being a flag carrier.");
 goto MAGIC_NOEFFECT;
 }

Buscar:
Código:

 case DEF_MAGICTYPE_INVISIBILITY:
 switch (m_pMagicConfigList[sType]->m_sValue4) {

y justo antes del comienzo del switch, agregar:
Código:

//50Cent - Capture The flag
 if(bCheckIfIsFlagCarrier(iClientH))
 {
 ShowClientMsg(iClientH, "You can not use that magic being a flag carrier.");
 goto MAGIC_NOEFFECT;
 }

Buscar:
Código:

if (cAttackerType == DEF_OWNERTYPE_PLAYER) {
 // v1.432
 // Ư¼ö ´É·ÂÀÌ ÀÖ´Â ¹«±â·Î °ø°ÝÀ» ´çÇß´Ù.
 switch (m_pClientList[iAttackerH]->m_iSpecialAbilityType) {
 case 1:
 case 2:
 case 3:
 case 4:
 case 5:
 bIsSAattacked = TRUE;
 break;
 }

y justo arriba agregar:
Código:

//50Cent - Capture The Flag
 if(bCheckIfIsFlagCarrier(iClientH))
 {
 SetIceFlag(iClientH, DEF_OWNERTYPE_PLAYER, false);
 SetFlagCarrierFlag(iClientH, false);
 }

Buscar:
Código:

switch (m_pClientList[iClientH]->m_pItemList[sItemIndex]->m_sItemEffectValue1) {
 case 1:
 // Recall ¸¶¹ý È¿°ú°¡ ÀÖ´Â ¾ÆÀÌÅÛ.
 // testcode
 RequestTeleportHandler(iClientH, "1   ");

y remplazar "RequestTeleportHandler(iClientH, "1 ");" por:
Código:

if(bCheckIfIsFlagCarrier(iClientH)) ShowClientMsg(iClientH, "You can not use that item being a flag carrier.");
 else RequestTeleportHandler(iClientH, "1   ");

Buscar:
Código:

case 2:
 // Åõ¸Ã* ¸¶¹ýÈ¿°ú°¡ ÀÖ´Â ¾ÆÀÌÅÛ.
 PlayerMagicHandler(iClientH, m_pClientList[iClientH]->m_sX, m_pClientList[iClientH]->m_sY, 32, TRUE);

y remplzar "PlayerMagicHandler(iClientH, m_pClientList[iClientH]->m_sX, m_pClientList[iClientH]->m_sY, 32, TRUE);" por:
if(bCheckIfIsFlagCarrier(iClientH)) ShowClientMsg(iClientH, "You can not use that item being a flag carrier.");
 else PlayerMagicHandler(iClientH, m_pClientList[iClientH]->m_sX, m_pClientList[iClientH]->m_sY, 32, TRUE);

Buscar:
Código:

case 4:
 // fixed location teleportation: ÀÔÀå±Ç µîµî
 switch (m_pClientList[iClientH]->m_pItemList[sItemIndex]->m_sItemEffectValue2) {
 case 1:
 // ºÃ*¸®µù ¾ÆÀÏ·Î °£´Ù
 if (memcmp(m_pClientList[iClientH]->m_cMapName, "bisle", 5) != 0) {
 //v1.42
 ItemDepleteHandler(iClientH, sItemIndex, TRUE, TRUE);
 RequestTeleportHandler(iClientH, "2   ", "bisle", -1, -1);
 }

y remplazar:
Código:

if (memcmp(m_pClientList[iClientH]->m_cMapName, "bisle", 5) != 0) {
 //v1.42
 ItemDepleteHandler(iClientH, sItemIndex, TRUE, TRUE);
 RequestTeleportHandler(iClientH, "2   ", "bisle", -1, -1);
 }

por:
Código:

if(bCheckIfIsFlagCarrier(iClientH)) ShowClientMsg(iClientH, "You can not use that item being a flag carrier.");
 else
 {
 if (memcmp(m_pClientList[iClientH]->m_cMapName, "bisle", 5) != 0)
 {
 ItemDepleteHandler(iClientH, sItemIndex, TRUE, TRUE);
 RequestTeleportHandler(iClientH, "2   ", "bisle", -1, -1);
 }
 }

alfinal del game.cpp agregar:
Código:

//50Cent - Capture The Flag
void CGame::StartCaptureTheFlag()
{
 if(m_bIsCTFMode) return;
 
 m_sFlagCountWin = 5;
 
 wsprintf(G_cTxt,"Capture The Flag: Win Flag Count(%d)", m_sFlagCountWin);
 PutLogList(G_cTxt);

 m_bIsCTFMode = true;

 for(int i = 0; i < DEF_MAXCLIENTS; i++)
 {
 if(m_pClientList[i] != NULL)
 {
 SendNotifyMsg(NULL, i, DEF_NOTIFY_CAPTURETHEFLAGSTART, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 }
 }
 PutLogList("(*) Capture The Flag Started!");
}
void CGame::RequestCheckFlag(int iClientH)
{
 if(!m_bIsCTFMode) return;
 if(m_pClientList[iClientH] == NULL) return;

 if(m_pClientList[iClientH]->m_cSide == 0) RequestTeleportHandler(iClientH, "2   ", "default", -1, -1);

 if((m_pClientList[iClientH]->m_sX == 151) && (m_pClientList[iClientH]->m_sY == 132))//Elvine Flag Cords
 {
 if(m_pClientList[iClientH]->m_iLevel >= 120)
 {
 if(m_pClientList[iClientH]->m_cSide == 1) //Aresden Side
 {
 if((!m_bIsAresdenFlagCaptured) && (!m_bIsElvineFlagCaptured)) //Aresden Capture Elvine Flag
 {
 PutLogList("Capture The Flag: Aresden Captured Elvine Flag!");
 SetFlagCarrierFlag(iClientH, true);
 
 }
 }
 else //Elvine Side
 {
 if((m_bIsAresdenFlagCaptured) && (!m_bIsElvineFlagCaptured))
 {
 PutLogList("Capture The Flag: Elvine wins this round!");
 m_sElvineFlagCount++;
 m_bIsAresdenFlagCaptured = false;
 for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINEWINSROUND, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 if(m_sElvineFlagCount == 5)
 {
 EndCaptureTheFlag(2);
 }
 }
 }

 }
 else RequestTeleportHandler(iClientH, "2   ", "elvine", -1, -1);
 }
 else if((m_pClientList[iClientH]->m_sX == 151) && (m_pClientList[iClientH]->m_sY == 128))//Aresden Flag Cords
 {
 if(m_pClientList[iClientH]->m_iLevel >= 120)
 {
 if(m_pClientList[iClientH]->m_cSide == 2) //Elvine Side
 {
 if((!m_bIsElvineFlagCaptured) && (!m_bIsAresdenFlagCaptured)) //Elvine Capture Aresden Flag
 {
 PutLogList("Capture The Flag: Elvine Captured Aresden Flag!");
 SetFlagCarrierFlag(iClientH, true);
 }
 }
 else //Aresden Side
 {
 if((m_bIsElvineFlagCaptured) && (!m_bIsAresdenFlagCaptured))
 {
 PutLogList("Capture The Flag: Aresden wins this round!");
 m_sAresdenFlagCount++;
 m_bIsElvineFlagCaptured = false;
 for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENWINSROUND, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 if(m_sAresdenFlagCount == 5)
 {
 EndCaptureTheFlag(1);
 }
 }
 }
 }
 else RequestTeleportHandler(iClientH, "2   ", "aresden", -1, -1);
 }
}
BOOL CGame::bCheckIfIsFlagCarrier(int iClientH)
{
 if(!m_bIsCTFMode) return false;
 if(m_iFlagCarrierIndex == -1) return false;
 if(m_pClientList[iClientH] == NULL) return false;

 if(iClientH == m_iFlagCarrierIndex) return true;
 else return false;
}
void CGame::SetFlagCarrierFlag(int iClientH, BOOL bFlagMode)
{  
 if(!m_bIsCTFMode) return;
 if(m_pClientList[iClientH] == NULL) return;

 if(bFlagMode)
 {
 PutLogList("Capture The Flag: New Flag Carrier!");
 m_iFlagCarrierIndex = iClientH;
 if(m_pClientList[iClientH]->m_cSide == 1)
 {
 m_bIsElvineFlagCaptured = true;
 for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 }
 else
 {
 m_bIsAresdenFlagCaptured = true;
 for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINEFLAGBACKTOCH, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 }
 m_pClientList[iClientH]->m_iEnemyKillCount += 20;
 SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_ENEMYKILLREWARD, iClientH, NULL, NULL, NULL);
 if(m_pClientList[iClientH]->m_cSide == 1) m_pClientList[iClientH]->m_iStatus = m_pClientList[iClientH]->m_iStatus | 0x80000; //Aresden Flag
 else if(m_pClientList[iClientH]->m_cSide == 2) m_pClientList[iClientH]->m_iStatus = m_pClientList[iClientH]->m_iStatus | 0x40000; //Elvine Flag
 }
 else
 {
 PutLogList("Capture The Flag: Flag Carrier Reset.");
 m_iFlagCarrierIndex = -1;
 if(m_pClientList[iClientH]->m_cSide == 1)
 {
 m_bIsElvineFlagCaptured = false;
 for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 }
 else
 {
 m_bIsAresdenFlagCaptured = false;
 for(int i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENFLAGBACKTOCH, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 }
 m_pClientList[iClientH]->m_iStatus = m_pClientList[iClientH]->m_iStatus | 0x00001000;
 }
}
void CGame::EndCaptureTheFlag(int iOption)
{
 if(!m_bIsCTFMode) return;
 int i;
 switch(iOption)
 {
 case 0://Finished by GM
 for(i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_TIECTF, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 _CreateCTFGUID(0);
 break;
 case 1://Aresden Win
 for(i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ARESDENWINCTF, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 _CreateCTFGUID(1);
 break;
 case 2://Elvine Win
 for(i = 0; i < DEF_MAXCLIENTS; i++) if(m_pClientList[i] != NULL) SendNotifyMsg(NULL, i, DEF_NOTIFY_ELVINEWINCTF, NULL, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL);
 _CreateCTFGUID(2);
 break;
 }
}
void CGame::_CreateCTFGUID(int iWinnerSide)
{
 char * cp, cTxt[256], cFn[256], cTemp[1024];
 FILE * pFile;
 
 _mkdir("GameData");
 ZeroMemory(cFn, sizeof(cFn));
 
 strcat(cFn,"GameData");
 strcat(cFn,"\\");
 strcat(cFn,"\\");  
 strcat(cFn,"CTFGUID.Txt");
 
 pFile = fopen(cFn, "wt");
 if (pFile == NULL) {
 PutLogList("(!) Cannot create CTFGUID(%d) file");
 }
 else {
 ZeroMemory(cTemp, sizeof(cTemp));
 
 ZeroMemory(cTxt, sizeof(cTxt));
 wsprintf(cTxt, "winner-side = %d\n", iWinnerSide);
 strcat(cTemp, cTxt);
 
 cp = (char *)cTemp;
 fwrite(cp, strlen(cp), 1, pFile);
 
 PutLogList("(O) CTFGUID(%d) file created");
 }
 if (pFile != NULL) fclose(pFile);
}

Game.h:
Declarar:
Código:

//50Cent - Capture The Flag
 void StartCaptureTheFlag();
 void RequestCheckFlag(int iClientH);
 BOOL bCheckIfIsFlagCarrier(int iClientH);
 void SetFlagCarrierFlag(int iClientH, BOOL bFlagMode);
 void EndCaptureTheFlag(int iOption);
 void _CreateCTFGUID(int iWinnerSide);

//50Cent - Capture The Flag
 BOOL m_bIsCTFMode;
 short m_sFlagCountWin;
 short m_sElvineFlagCount;
 short m_sAresdenFlagCount;
 BOOL m_bIsElvineFlagCaptured;
 BOOL m_bIsAresdenFlagCaptured;
 int m_iFlagCarrierIndex;

Netmessage.h:
Código:

//50Cent - Capture The Flag
#define DEF_NOTIFY_CAPTURETHEFLAGSTART 0x1F19
#define MSGID_REQUEST_CHECKFLAG 0x1F20
#define DEF_NOTIFY_ARESDENCAPTUREDELVINEFLAG 0x1F21
#define DEF_NOTIFY_ELVINECAPTUREDARESDENFLAG 0x1F22
#define DEF_NOTIFY_ELVINEFLAGBACKTOCH 0x1F23
#define DEF_NOTIFY_ARESDENFLAGBACKTOCH 0x1F24
#define DEF_NOTIFY_ELVINEWINSROUND 0x1F25
#define DEF_NOTIFY_ARESDENWINSROUND 0x1F26
#define DEF_NOTIFY_ELVINEWINCTF 0x1F27
#define DEF_NOTIFY_ARESDENWINCTF 0x1F28
#define DEF_NOTIFY_TIECTF 0x1F29



binarydata » Wed Apr 06, 2005 8:14 pm wrote:
hb dead anyways
Back to top Go down
 
[CODE] Capture The Flag
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Join Helbreath :: Open Source / Development Corner :: C++-
Jump to: