Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [SSGM 4.0 Plugin] RadioCommands
Re: [SSGM 4.0 Plugin] RadioCommands [message #470780 is a reply to message #470748] Thu, 05 July 2012 13:41 Go to previous message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma:
Colonel
const wchar_t *Get_Wide_Player_Name_By_ID(int ID) {
	cPlayer *x = Find_Player(ID);
	if (!x) {
		return L"None";
	}
	return x->PlayerName;
}


For things that are stored as wide chars internally, like player names and translated strings, it's always better to use the wide version of their function. This produces cleaner, slightly more efficient code that doesn't have a chance of leaking memory if you forget to delete it.

If you need them in a char for some reason, such as comparison, you can convert them like this:

StringClass Name = Get_Wide_Player_Name_By_ID(ID);

or 

StringClass(Get_Wide_Player_Name_By_ID(ID))


And StringClass will automatically handle the conversion and memory allocation.


Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [TOOL] chunky
Next Topic: Westwood Scripts [M02]
Goto Forum:
  


Current Time: Mon Nov 25 08:53:46 MST 2024

Total time taken to generate the page: 0.00849 seconds