Jump to content
metin2dev
Metin2International
  • 0
Sign in to follow this  
bumxd

global chat c++

Question

how to fix it?

http://i.imgur.com/8ggnAov.jpg

 

in input main so:

const char* kingdoms[3] = {"|cFFFF0000|H|h[shinso]|cFFA7FFD4|H|h","|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jino]|cFFA7FFD4|H|h"};
char chatbuf_global[CHAT_MAX_LEN + 1];
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s",kingdoms[ch->GetEmpire()-1],chatbuf);

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0

Just use the Code which is been released here in the Forum, this is working for me. If you have any further questions feel free to add me in Skype: pascal24426

Regards

Share this post


Link to post
Share on other sites
  • 0

Just use the Code which is been released here in the Forum, this is working for me. If you have any further questions feel free to add me in Skype: pascal24426

Regards

i use this code what on forum.. but maybe i think codect need other?

Share this post


Link to post
Share on other sites
  • 0
	static const char* colorbuf[]={"|cFFffa200|H|h[Team-Member]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
	int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

they it

Share this post


Link to post
Share on other sites
  • 0
	static const char* colorbuf[]={"|cFFffa200|H|h[Team-Member]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
	int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

they it

 

change global chat code for your?

Share this post


Link to post
Share on other sites
  • 0

me code:

const char* kingdoms[4] = {"|cFF47DA00|H|h[admin]|cFFA7FFD4|H|h","|cFFff0000|H|h[Shinsoo]|cFFA7FFD4|H|h","|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"};
        char chatbuf_global[CHAT_MAX_LEN + 1];
        int my_level = ch->GetLevel();
        if (gSpecialShout == 1)
        {
            if (ch->GetGMLevel() != GM_PLAYER)
            {
                if (MasterGhostChat == 1)
                {
                    int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",kingdoms[0], buf);
                }
                else
                {
                    if ((MasterColorEmpire == 1) and (MasterLevelChat == 0))
                    {
                        int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s : %s",ch->GetName(), kingdoms[ch->GetEmpire()], buf);
                    }
                    else if ((MasterColorEmpire == 1) and (MasterLevelChat == 1))
                    {
                        int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s [%d] : %s",ch->GetName(), kingdoms[ch->GetEmpire()], my_level, buf);
                    }
                    else if ((MasterColorEmpire == 0) and (MasterLevelChat == 1))
                    {
                        int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s [%d] : %s",ch->GetName(), my_level, buf);
                    }
                    else
                    {
                        int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
                    }
                }
            }
            else
            {
                if ((PlayerColorEmpire == 1) and (PlayerLevelChat == 0))
                {
                    int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s : %s",ch->GetName(), kingdoms[ch->GetEmpire()], buf);
                }
                else if ((PlayerColorEmpire == 1) and (PlayerLevelChat == 1))
                {
                    int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s [%d] : %s",ch->GetName(), kingdoms[ch->GetEmpire()], my_level, buf);
                }
                else if ((PlayerColorEmpire == 0) and (PlayerLevelChat == 1))
                {
                    int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s [%d] : %s",ch->GetName(), my_level, buf);
                }
                else
                {
                    int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
                }
            }
        }
        else
        {
            int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
        }

Share this post


Link to post
Share on other sites
  • 0

i would not hurt my head to make something as huge as that some things can realy be usless for player the only thing that you need is a hgihlighting for the player names you can do this with c++ or even some old public python code

Share this post


Link to post
Share on other sites
  • 0

 

	static const char* colorbuf[]={"|cFFffa200|H|h[Team-Member]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
	int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

they it

 

change global chat code for your?

 

me function change for this function?

Share this post


Link to post
Share on other sites
  • 0

 

 

	static const char* colorbuf[]={"|cFFffa200|H|h[Team-Member]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
	int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

they it

 

change global chat code for your?

 

me function change for this function?

 

don`t compile:

 

PetSystem.h:163:31: warning: no newline at end of file
char.cpp:7211: warning: this decimal constant is unsigned only in ISO C90
compile char_change_empire.cpp
compile char_horse.cpp
In file included from char_battle.cpp:27:
shop_manager.h:40:7: warning: no newline at end of file
compile char_item.cpp
compile char_manager.cpp
In file included from char_horse.cpp:14:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
compile char_quickslot.cpp
In file included from char_item.cpp:44:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
In file included from char_item.cpp:47:
belt_inventory_helper.h:108:42: warning: no newline at end of file
compile char_resist.cpp
compile char_skill.cpp
compile char_state.cpp
compile PetSystem.cpp
compile cmd.cpp
compile cmd_emotion.cpp
compile cmd_general.cpp
compile cmd_gm.cpp
compile cmd_oxevent.cpp
In file included from char_state.cpp:25:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
compile config.cpp
In file included from cmd_general.cpp:36:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
compile constants.cpp
In file included from PetSystem.cpp:8:
PetSystem.h:163:31: warning: no newline at end of file
In file included from PetSystem.cpp:9:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
PetSystem.cpp:637:2: warning: no newline at end of file
char.cpp: In member function 'void CHARACTER::PointChange(BYTE, int, bool, bool)':
char.cpp:3088: warning: comparison between signed and unsigned integer expressions
compile crc32.cpp
compile cube.cpp
compile db.cpp
compile desc.cpp
constants.cpp:276: warning: this decimal constant is unsigned only in ISO C90
constants.cpp:277: warning: this decimal constant is unsigned only in ISO C90
constants.cpp:278: warning: this decimal constant is unsigned only in ISO C90
constants.cpp:279: warning: this decimal constant is unsigned only in ISO C90
constants.cpp:280: warning: this decimal constant is unsigned only in ISO C90
constants.cpp:281: warning: this decimal constant is unsigned only in ISO C90
compile desc_client.cpp
compile desc_manager.cpp
compile desc_p2p.cpp
In file included from char_item.cpp:47:
belt_inventory_helper.h: In static member function 'static BYTE CBeltInventoryHelper::GetBeltGradeByRefineLevel(int)':
belt_inventory_helper.h:28: warning: comparison between signed and unsigned integer expressions
In file included from desc_manager.cpp:15:
ClientPackageCryptInfo.h:117:41: warning: no newline at end of file
char_item.cpp: In member function 'bool CHARACTER::IsEmptyItemGrid(TItemPos, BYTE, int) const':
char_item.cpp:640: warning: comparison is always false due to limited range of data type
char_item.cpp:666: warning: comparison is always false due to limited range of data type
char_item.cpp: In member function 'bool CHARACTER::UseItemEx(CItem*, TItemPos)':
char_item.cpp:2387: warning: format '%d' expects type 'int', but argument 6 has type 'long int'
char_item.cpp:2391: warning: format '%d' expects type 'int', but argument 6 has type 'long int'
char_item.cpp:2403: warning: format '%d' expects type 'int', but argument 5 has type 'long int'
char_item.cpp:2407: warning: format '%d' expects type 'int', but argument 5 has type 'long int'
char_item.cpp:2434: warning: format '%d' expects type 'int', but argument 6 has type 'long int'
char_item.cpp:2442: warning: format '%d' expects type 'int', but argument 5 has type 'long int'
char_item.cpp:5090: warning: comparison between signed and unsigned integer expressions
char_item.cpp: In member function 'bool CHARACTER::UseItem(TItemPos, TItemPos)':
char_item.cpp:5162: warning: unused variable 'wDestCell'
char_item.cpp:5163: warning: unused variable 'bDestInven'
char_item.cpp: In member function 'bool CHARACTER::EquipItem(CItem*, int)':
char_item.cpp:6167: warning: array subscript has type 'char'
char_item.cpp: In member function 'void CHARACTER::BuffOnAttr_AddBuffsFromItem(CItem*)':
char_item.cpp:6231: warning: comparison between signed and unsigned integer expressions
char_item.cpp: In member function 'void CHARACTER::BuffOnAttr_RemoveBuffsFromItem(CItem*)':
char_item.cpp:6243: warning: comparison between signed and unsigned integer expressions
char_item.cpp: In member function 'bool CHARACTER::CanEquipNow(CItem*, const TItemPos&, const TItemPos&)':
char_item.cpp:7429: warning: unused variable 'itemType'
char_item.cpp:7430: warning: unused variable 'itemSubType'
compile dev_log.cpp
desc_client.cpp: In member function 'void CLIENT_DESC::UpdateChannelStatus(DWORD, bool)':
desc_client.cpp:299: warning: comparison between signed and unsigned integer expressions
cube.cpp: In function 'bool Cube_make(CHARACTER*)':
cube.cpp:544: warning: comparison between signed and unsigned integer expressions
cube.cpp: In function 'void Cube_MakeCubeInformationText()':
cube.cpp:716: warning: unused variable 'npcVNUM'
cube.cpp: In function 'bool Cube_InformationInitialize()':
cube.cpp:783: warning: comparison between signed and unsigned integer expressions
PetSystem.cpp: In member function 'virtual bool CPetActor::_UpdateFollowAI()':
PetSystem.cpp:246: warning: unused variable 'bDoMoveAlone'
PetSystem.cpp: In member function 'CPetActor* CPetSystem::Summon(DWORD, CItem*, const char*, bool, DWORD)':
PetSystem.cpp:552: warning: unused variable 'petVID'
compile dungeon.cpp
compile empire_text_convert.cpp
In file included from config.cpp:22:
check_server.h: In static member function 'static bool CheckServer::CheckIp(const char*)':
check_server.h:24: warning: comparison between signed and unsigned integer expressions
config.cpp: In function 'void config_init(const std::string&)':
config.cpp:442: warning: NULL used in arithmetic
config.cpp:466: warning: NULL used in arithmetic
config.cpp:490: warning: NULL used in arithmetic
config.cpp:512: warning: unused variable 'line'
char_state.cpp: In member function 'virtual void CHARACTER::StateMove()':
char_state.cpp:901: warning: unused variable 'rider'
compile entity.cpp
char_item.cpp: In member function 'bool CHARACTER::IsEmptyItemGrid(TItemPos, BYTE, int) const':
char_item.cpp:679: warning: control reaches end of non-void function
compile entity_view.cpp
compile event.cpp
cmd_gm.cpp: In function 'void do_set_stat(CHARACTER*, const char*, int, int)':
cmd_gm.cpp:3935: warning: NULL used in arithmetic
compile event_queue.cpp
compile exchange.cpp
compile file_loader.cpp
compile fishing.cpp
compile gm.cpp
compile guild.cpp
compile guild_manager.cpp
compile guild_war.cpp
char_item.cpp: In member function 'void CHARACTER::BuffOnAttr_ValueChange(BYTE, BYTE, BYTE)':
char_item.cpp:6278: warning: 'pBuff' may be used uninitialized in this function
cmd_gm.cpp: In function 'void do_use_item(CHARACTER*, const char*, int, int)':
cmd_gm.cpp:4357: warning: 'cell' may be used uninitialized in this function
cmd_gm.cpp: In function 'void do_set_stat(CHARACTER*, const char*, int, int)':
cmd_gm.cpp:3977: warning: 'n' may be used uninitialized in this function
cmd_gm.cpp: In function 'void do_mob_ld(CHARACTER*, const char*, int, int)':
cmd_gm.cpp:855: warning: 'x' may be used uninitialized in this function
cmd_gm.cpp:855: warning: 'y' may be used uninitialized in this function
compile horse_rider.cpp
compile horsename_manager.cpp
compile input.cpp
compile input_auth.cpp
compile input_db.cpp
compile input_login.cpp
compile input_main.cpp
In file included from input_db.cpp:13:
shop_manager.h:40:7: warning: no newline at end of file
input_db.cpp:2722:2: warning: no newline at end of file
compile input_p2p.cpp
In file included from input_main.cpp:16:
shop_manager.h:40:7: warning: no newline at end of file
input_auth.cpp: In member function 'int CInputAuth::auth_OpenID(const char*, const char*, char*)':
input_auth.cpp:467: warning: unused variable 'last'
compile input_teen.cpp
compile input_udp.cpp
compile ip_ban.cpp
compile item.cpp
compile item_addon.cpp
compile item_attribute.cpp
compile item_manager.cpp
compile item_manager_idrange.cpp
compile locale.cpp
In file included from item_manager.cpp:21:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
In file included from item.cpp:22:
belt_inventory_helper.h:108:42: warning: no newline at end of file
In file included from item.cpp:23:
../../common/VnumHelper.h:59:32: warning: no newline at end of file
item.cpp:2087:2: warning: no newline at end of file
input_main.cpp: In member function 'int CInputMain::Chat(CHARACTER*, const char*, size_t)':
input_main.cpp:752: error: 'chatbuf_global' was not declared in this scope
input_main.cpp:746: warning: unused variable 'len'
compile locale_service.cpp
compile log.cpp
gmake: *** [OBJDIR/input_main.o] Error 1
gmake: *** Waiting for unfinished jobs....
item_manager.cpp: In member function 'TItemTable* ITEM_MANAGER::GetTable(DWORD)':
item_manager.cpp:604: warning: comparison between signed and unsigned integer expressions
In file included from item.cpp:22:
belt_inventory_helper.h: In static member function 'static BYTE CBeltInventoryHelper::GetBeltGradeByRefineLevel(int)':
belt_inventory_helper.h:28: warning: comparison between signed and unsigned integer expressions
item.h: In constructor 'CItem::CItem(DWORD)':
item.h:286: warning: 'CItem::m_pkRealTimeExpireEvent' will be initialized after
item.h:283: warning:   'LPEVENT CItem::m_pkExpireEvent'
item.cpp:25: warning:   when initialized here
item.cpp: In function 'const bool CanPutIntoRing(CItem*, CItem*)':
item.cpp:1728: warning: unused variable 'vnum'
item.cpp: In member function 'bool CItem::CanPutInto(CItem*)':
item.cpp:1761: warning: comparison between signed and unsigned integer expressions
item.cpp: In member function 'int CItem::GiveMoreTime_Per(float)':
item.cpp:2017: warning: comparison between signed and unsigned integer expressions
item.cpp:2019: warning: comparison between signed and unsigned integer expressions
item.cpp: In member function 'int CItem::GiveMoreTime_Fix(DWORD)':
item.cpp:2041: warning: comparison between signed and unsigned integer expressions
item.cpp: In member function 'int CItem::GetDuration()':
item.cpp:2072: warning: array subscript has type 'char'
root@BddAdsa:/usr/src/mainline/Srcs/Server/game/src #

Share this post


Link to post
Share on other sites
  • 0

input_main.cpp:752: error: 'chatbuf_global' was not declared in this scope

 

whats on line 752?

Share this post


Link to post
Share on other sites
  • 0

input_main.cpp:752: error: 'chatbuf_global' was not declared in this scope

 

whats on line 752?

this problem in your function.. but here screen: 

fL8jAxK.jpg

Share this post


Link to post
Share on other sites
  • 0

this is the definition in your old code

char chatbuf_global[CHAT_MAX_LEN + 1];

just do this :

change

int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

to :

int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

and add this

char chatbuf_global[CHAT_MAX_LEN + 1];

above it

Share this post


Link to post
Share on other sites
  • 0

this is the definition in your old code

char chatbuf_global[CHAT_MAX_LEN + 1];

just do this :

change

int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

to :

int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

and add this

char chatbuf_global[CHAT_MAX_LEN + 1];

above it

where add?char chatbuf_global[CHAT_MAX_LEN + 1];

Share this post


Link to post
Share on other sites
  • 0

add it like this

char chatbuf_global[CHAT_MAX_LEN + 1];
int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

Share this post


Link to post
Share on other sites
  • 0

 

add it like this

char chatbuf_global[CHAT_MAX_LEN + 1];
int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);
 
input_main.cpp: In member function 'int CInputMain::Chat(CHARACTER*, const char*, size_t)':
input_main.cpp:747: error: 'chatbuf_global' was not declared in this scope
input_main.cpp:747: warning: unused variable 'len'
compile mining.cpp
compile mob_manager.cpp
compile monarch.cpp
gmake: *** [OBJDIR/input_main.o] Error 1
gmake: *** Waiting for unfinished jobs....
 
error..
 
this code:
static const char* colorbuf[]={"|cFFffa200|H|h[Team-Member]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);
char chatbuf_global[CHAT_MAX_LEN + 1];

747 linea:

int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

Share this post


Link to post
Share on other sites
  • 0

 

 

add it like this

char chatbuf_global[CHAT_MAX_LEN + 1];
int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

 
input_main.cpp: In member function 'int CInputMain::Chat(CHARACTER*, const char*, size_t)':
input_main.cpp:747: error: 'chatbuf_global' was not declared in this scope
input_main.cpp:747: warning: unused variable 'len'
compile mining.cpp
compile mob_manager.cpp
compile monarch.cpp
gmake: *** [OBJDIR/input_main.o] Error 1
gmake: *** Waiting for unfinished jobs....
 
error..
 
this code:
static const char* colorbuf[]={"|cFFffa200|H|h[Team-Member]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);
char chatbuf_global[CHAT_MAX_LEN + 1];

747 linea:

int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

 

not like that , like this :

char chatbuf_global[CHAT_MAX_LEN + 1];
static const char* colorbuf[]={"|cFFffa200|H|h[Team-Member]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
int len = snprintf(chatbuf_global, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

chatbuf_global must be declared b4 len

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×