Code Release - !ping command [message #313058] |
Wed, 23 January 2008 04:45 |
|
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 |
|
Cat998
Messages: 1081 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 |
|
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 #313151 is a reply to message #313110] |
Wed, 23 January 2008 12:48 |
|
Cat998
Messages: 1081 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 #316523 is a reply to message #316380] |
Mon, 11 February 2008 08:03 |
|
Jerad2142
Messages: 3812 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+.
Visit Jerad's deer sweat shop
|
|
|