Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » old ssgm chatcommandclass ported to 4.0
old ssgm chatcommandclass ported to 4.0 [message #465127] Fri, 30 March 2012 06:38
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
ive remade as i thought it was easy to use ill just share if anyone else wants it


CommmandClass.h



CommandClass.cpp


example command
class ChatCommandExample : public ChatCommandClass
{
	void Triggered(int ID,const TokenClass &Text)
	{
           //Do some shit here
	}
};
ChatCommandRegistrant<ChatCommandExample> ChatCommandExample_Reg("!example;!ex",0);



how to make it work

bool Example::OnChat(int PlayerID,TextMessageEnum Type,const wchar_t *Message,int recieverID)
{
		StringClass Msg = Message;
		if (Msg[0] == '!' ) {
		TokenClass Text(Msg);
		StringClass Command = Text[1];
		Text.erase(1);
		
			if (ChatCommandList::CommandsMap.Exists(Command))
			{ // If so
				ChatCommandInfo *Temp = ChatCommandList::CommandsMap.Get(Command,0);
				Temp->Ptr->Triggered(PlayerID,Text);
			}
		}
	return true;
}



If i missed something pls tell me i just fast copied it out my plugin so might have made some errors

note:

i removed chattype out of triggered because i didnt need it, it stil exist in the regristrant though
if you want to use it its just a small change

EDIT : changed some stuff
I recommend using these files in your plugin.


Owner of kambot TT server

kambot.freeforums.org

[Updated on: Tue, 29 May 2012 13:09]

Report message to a moderator

Previous Topic: c&c walls flying vehs get destroyed
Next Topic: a question about water.
Goto Forum:
  


Current Time: Sat Nov 30 12:35:52 MST 2024

Total time taken to generate the page: 0.00566 seconds