- Joined
- Oct 10, 2015
- Messages
- 32
- Reaction score
- 0
Aight i'm new to C++, so I have to start with the basics. What I wanted to do:
- Add "[characterName]" to the /system message, for example:
my char name = boom
/system blabla => [boom] blabla
So basicly people see who used the /system command.
I did it on the following method, but I guess its kinda messy
So I'd love to get some feedback on how this easy little thing could be improved.
- Add "[characterName]" to the /system message, for example:
my char name = boom
/system blabla => [boom] blabla
So basicly people see who used the /system command.
I did it on the following method, but I guess its kinda messy
So I'd love to get some feedback on how this easy little thing could be improved.BOOL TextCmd_System( CScanner & scanner ){
#ifdef __WORLDSERVER
CHAR szString[512] = "";
CHAR a[30] = "";
CUser* pUser = (CUser*)scanner.dwValue;
std::string str; std::string str2= pUser->GetName(); str.append("[");
str.append(str2);
str.append("] ");
scanner.GetLastFull();
if( strlen( scanner.token ) >= 512 )
return TRUE;
strcpy(a, str.c_str());
strcpy( szString, scanner.token );
StringTrimRight( szString );
strcat(a, szString);
g_DPCoreClient.SendSystem( a );
#endif // __WORLDSERVER return TRUE;
}
#ifdef __WORLDSERVER
CHAR szString[512] = "";
CHAR a[30] = "";
CUser* pUser = (CUser*)scanner.dwValue;
std::string str; std::string str2= pUser->GetName(); str.append("[");
str.append(str2);
str.append("] ");
scanner.GetLastFull();
if( strlen( scanner.token ) >= 512 )
return TRUE;
strcpy(a, str.c_str());
strcpy( szString, scanner.token );
StringTrimRight( szString );
strcat(a, szString);
g_DPCoreClient.SendSystem( a );
#endif // __WORLDSERVER return TRUE;
}

