Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Code Release - !ping command
Code Release - !ping command [message #313058] Wed, 23 January 2008 04:45 Go to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
Here is the code of !ping command for scripts.dll - Add this code at the end of the file "gmmain.cpp":

class PingChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		Console_Input(StrFormat("message %s, your ping is %d.",Get_Player_Name_By_ID(ID),Get_Ping(ID)).c_str());
		
	}
};
ChatCommandRegistrant<PingChatCommand> PingChatCommandReg("!ping",CHATTYPE_ALL,0,GAMEMODE_ALL);


Thanks to jindrak2 for help.
Re: Code Release - !ping command [message #313097 is a reply to message #313058] Wed, 23 January 2008 08:58 Go to previous messageGo to next message
Cat998
Messages: 1082
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

class PingChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		char msg[256];
		sprintf(msg, "message %s, your ping is %d.", Get_Player_Name_By_ID(ID), Get_Ping(ID));
		Console_Input(msg);
		
	}
};
ChatCommandRegistrant<PingChatCommand> PingChatCommandReg("!ping",CHATTYPE_ALL,0,GAMEMODE_ALL);


When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."

[Updated on: Wed, 23 January 2008 08:58]

Report message to a moderator

Re: Code Release - !ping command [message #313110 is a reply to message #313097] Wed, 23 January 2008 10:10 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
Cat998 wrote on Wed, 23 January 2008 15:58

class PingChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		char msg[256];
		sprintf(msg, "message %s, your ping is %d.", Get_Player_Name_By_ID(ID), Get_Ping(ID));
		Console_Input(msg);
		
	}
};
ChatCommandRegistrant<PingChatCommand> PingChatCommandReg("!ping",CHATTYPE_ALL,0,GAMEMODE_ALL);




memory leak.

class PingChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		char msg[256];
		sprintf(msg, "message %S, your ping is %d.", Get_Wide_Player_Name_By_ID(ID), Get_Ping(ID));
		Console_Input(msg);
		
	}
};
ChatCommandRegistrant<PingChatCommand> PingChatCommandReg("!ping",CHATTYPE_ALL,0,GAMEMODE_ALL);

[Updated on: Wed, 23 January 2008 10:41]

Report message to a moderator

Re: Code Release - !ping command [message #313135 is a reply to message #313058] Wed, 23 January 2008 11:30 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
Not bad Eric. Smile Good work. Rocked Over

Thumbs Up

~Zack
Re: Code Release - !ping command [message #313151 is a reply to message #313110] Wed, 23 January 2008 12:48 Go to previous messageGo to next message
Cat998
Messages: 1082
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

RoShamBo wrote on Wed, 23 January 2008 18:10


memory leak.



Why are you quoting mine, I didn't code this, just corrected the stupid char <-> string converting.


When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."

[Updated on: Wed, 23 January 2008 12:49]

Report message to a moderator

Re: Code Release - !ping command [message #313155 is a reply to message #313151] Wed, 23 January 2008 12:50 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
Cat998 wrote on Wed, 23 January 2008 19:48

RoShamBo wrote on Wed, 23 January 2008 18:10


memory leak.



Why are you quoting mine, I didn't code this, just corrected the stupid char <-> string converting.


They both had errors Razz
Re: Code Release - !ping command [message #313247 is a reply to message #313058] Wed, 23 January 2008 20:06 Go to previous messageGo to next message
Cat998
Messages: 1082
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

oh really. it's his code, not mine.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: Code Release - !ping command [message #313269 is a reply to message #313058] Wed, 23 January 2008 23:14 Go to previous messageGo to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
So guys which code is better? Im confused.
Re: Code Release - !ping command [message #313286 is a reply to message #313058] Thu, 24 January 2008 02:43 Go to previous messageGo to next message
Cat998
Messages: 1082
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

Take the last one.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: Code Release - !ping command [message #316380 is a reply to message #313058] Sun, 10 February 2008 00:17 Go to previous messageGo to next message
halo2pac is currently offline  halo2pac
Messages: 659
Registered: December 2006
Location: Near Cleveland, Ohio
Karma: 0
Colonel
dont mind me saying good job on the code its useful for learning.. nothing else.

waste of time to implement it in something.

he made that for people who are yet to lasy to push f8 and type "fps".. but are complex enough to use a dll or use a !command to do something simpler.

I hop i dont offend ^^


http://img339.imageshack.us/img339/1991/nefobbygenyunoreleasere.jpg
Rene-Buddy | Renegade X
Join the fight against Obsessive-Compulsive Posting Disorder. Cancel is ur friend.
*Renegade X Dev Team Member*
Re: Code Release - !ping command [message #316427 is a reply to message #313058] Sun, 10 February 2008 11:16 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
If you're not going to say something useful, don't bother bumping a topic that's a couple weeks old and flaming the person.

Thanks,

~Zack
Re: Code Release - !ping command [message #316432 is a reply to message #313058] Sun, 10 February 2008 12:08 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

Good job being a dick, halo. Thumbs Up

-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: Code Release - !ping command [message #316523 is a reply to message #316380] Mon, 11 February 2008 08:03 Go to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3813
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
halo2pac wrote on Sun, 10 February 2008 00:17

dont mind me saying good job on the code its useful for learning.. nothing else.

waste of time to implement it in something.

he made that for people who are yet to lasy to push f8 and type "fps".. but are complex enough to use a dll or use a !command to do something simpler.

I hop i dont offend ^^

Its useful to the server owners that are going to kick people with a ping of 1000+.


Previous Topic: Serverside Co-Op
Next Topic: NEED HELP MAKING A WEAPON REPLACEMENT!
Goto Forum:
  


Current Time: Sun Dec 29 20:38:54 MST 2024

Total time taken to generate the page: 0.00934 seconds