Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [Plug-in] SSGM2.02 Ping Plugin  () 1 Vote
Re: [Plug-in] SSGM2.02 Ping Plugin [message #439451 is a reply to message #439290] Sat, 13 November 2010 23:59 Go to previous messageGo to previous message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma:
Colonel
Xpert wrote on Fri, 12 November 2010 08:41

This is an old bump, I know, but I was browsing the forums to see if there's anything I can make use for myself and I came across this. So I decided to show mine, I'll paste it. Maybe if Exeric still browse these forums, you can make use of it too? You don't have to put the whole player's name.


class ConnectionChatCommand : public ChatCommandClass {
 	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		if (!Text[1].empty()) {
			GameObject *obj;
			std::string name = Text[1].c_str();
			std::string sender = Get_Player_Name_By_ID(ID);
			int amount = 0;
			amount = Get_Part_Names(name.c_str());
			if (amount == 1) {
				obj = Get_Part_Name(name.c_str());
				int PID = Get_Player_ID(obj);
				name = Get_Player_Name(obj);
				if (ID != PID) {
					Console_Input(StrFormat("ppage %d Connection for %s -> Ping: %d; Kbits: %d; Used bandwidth: %d;",ID,name.c_str(),Get_Ping(PID),Get_Kbits(PID),Get_Bandwidth(PID)).c_str());
				}
				else {
					Console_Input(StrFormat("ppage %d Your connection -> Ping: %d; Kbits: %d; Used bandwidth: %d;",ID,Get_Ping(ID),Get_Kbits(ID),Get_Bandwidth(ID)).c_str());
				}
			}
			else if (amount == 0) {
				Console_Input(StrFormat("ppage %d Player not found.",ID).c_str());
				return;
			}
			else if (amount > 1) {
				obj = Get_GameObj_By_Player_Name(name.c_str());
				if (!obj) {
					Console_Input(StrFormat("ppage %d There are %i players with that substring, please make the name more unique.",ID,amount).c_str());
					return;
				}
			}
		}
		else {
			Console_Input(StrFormat("ppage %d Your connection -> Ping: %d; Kbits: %d; Used bandwidth: %d;",ID, Get_Ping(ID), Get_Kbits(ID), Get_Bandwidth(ID)).c_str());
		}
	}
};
ChatCommandRegistrant<ConnectionChatCommand> ConnectionChatCommandReg("!ping;!lag",CHATTYPE_ALL,0,GAMEMODE_ALL);



Thanks for your code. For you all works? Because when I use in game !ping partname FDS crash with this:

Exception occurred at 0x38D1B717 (No Owner)
The Renegade FDS tried to write to address 0x38d1b717 (No Owner)


Yeah I updated engine_player.cpp which you posted here.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [skin] Skittles Stealth Effect
Next Topic: [Skins] Duke 3D doors
Goto Forum:
  


Current Time: Wed Aug 21 17:44:59 MST 2024

Total time taken to generate the page: 0.00840 seconds