Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » brenbot plugin needed
Re: brenbot plugin needed [message #418937 is a reply to message #418863] Sun, 31 January 2010 06:17 Go to previous messageGo to previous message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma:
General (3 Stars)
The auth_script adds their playerID to a vector, this makes it possible to check whether or not the player is in that vector when they use a chat command. For example:


bool AuthCheck(int ID) {
		for (unsigned int i = 0; i < AuthedPlayers.size(); i++) {
			if (AuthedPlayers[i].AuthedPlayerName == Get_Player_Name_By_ID(ID)) {
				return true;
			}
		}
	return false;
}



class setmapChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		if(AuthCheck(ID) != false){
			if (!Text[1].empty()) {
				int number = 0;
				std::string mapname2 = Text[1].c_str();
				int numberofmaps = 0;
				for(;*The_Game()->MapList[numberofmaps] != 0; numberofmaps++);
				int z = 0;
				for (int i = 0; i < numberofmaps; i++) {
					if ((stristr(The_Game()->MapList[i],mapname2.c_str()))){
						number++;
						z = i;
					}
				}
				if (number == 1){
					The_Game()->MapNumber = z-1;
					mapname = The_Game()->MapList[z];
					mapnameannounce();
					Console_Input(StrFormat("msg Moderator %s has changed the next map!",Get_Player_Name_By_ID(ID)).c_str());
				}
				else if(number < 1){
					Console_Input(StrFormat("ppage %d Nothing was found at all, are you sure that map is even in rotation?",ID).c_str());
				}
				else if(number > 1){
					for (int i = 0; i < numberofmaps; i++) {
						if ((strcmp(The_Game()->MapList[i],mapname2.c_str()))==0) {
							The_Game()->MapNumber = i-1;
							mapname = The_Game()->MapList[i];
							mapnameannounce();
							Console_Input(StrFormat("msg Moderator %s has changed the next map!",Get_Player_Name_By_ID(ID)).c_str());
							break;
						}
					}
				}
			}
		}
		else {
			Console_Input(StrFormat("ppage %d You're not a mod, you need to authenticate to use this command.",ID).c_str());
		}
	}
};
ChatCommandRegistrant<setmapChatCommand> setmapChatCommandReg("!setnextmap;!SETNEXTMAP;!Setnextmap;!SetNextMap;!snm;!SNM;!set;!SET;!SETNEXT;!setnext;!SetNext",CHATTYPE_ALL,1,GAMEMODE_ALL);



It just allows people to write chat commands for moderators safely, without relying solely on the nick name being the same (easily spoofed if the server allows direct connect).



 
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: muzzleflash
Next Topic: Nod Arty sfx skew
Goto Forum:
  


Current Time: Tue Jul 22 04:25:39 MST 2025

Total time taken to generate the page: 0.01012 seconds