Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Revive Plugin for RR Servers
Revive Plugin for RR Servers [message #352104] Thu, 25 September 2008 10:37 Go to next message
MacKinsey is currently offline  MacKinsey
Messages: 83
Registered: March 2008
Karma: 0
Recruit
Hey i want present you a SSGM Plugin.
It is usefull for RR (Ressurection) Servers.

Everything what you need is @ the README.TXT

Credits:
- RoShamBo === Writing YaRR which provides me a Example for C++ File I/O; Helping me with C++ File I/O
- Yrr === Writing RR (Renegade Ressurection), without it, this Plugin wouldnt work.
- StealthEye === Who helps me sometimes.
- WestWood === For creating that awesome Game!


I AM CURRENTLY NOT GOING TO RELEASE THE SOURCE! I need to clean it up first
  • Attachment: RREVIVE.rar
    (Size: 55.49KB, Downloaded 125 times)
Re: Revive Plugin for RR Servers [message #352170 is a reply to message #352104] Fri, 26 September 2008 01:52 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)
No offence, and not you put you down or anything. It's not worth holding onto the source for 1 simple chat command. It's not even worth releasing the full source. Just do what Reborn does and release the code you have added Big Ups

Never the less, it's good people are releasing plugins. You're always welcome to help at n00bless/n00bstories IRC at #yarr.
Re: Revive Plugin for RR Servers [message #352173 is a reply to message #352104] Fri, 26 September 2008 05:54 Go to previous messageGo to next message
MacKinsey is currently offline  MacKinsey
Messages: 83
Registered: March 2008
Karma: 0
Recruit
The code is not really cleaned up.
For example it does the same when u type in hon or bar, the same code
but here is it
class reviveChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		char buffer[128];
		GetCurrentDirectory(50, buffer);
		strcat(buffer, "\\rrevive.ini");
		INIClass *ini = Get_INI(buffer);
		if(!ini)
		{
			Console_Input(StrFormat("msg Unable to load RRevive.ini !").c_str());
			return;
		}
		bool allow = ini->Get_Bool("Main", "Allow_Revive", 0);
		float cost = ini->Get_Float("Main", "Cost", 0.0);
		bool allowb = ini->Get_Bool("Settings", "Allow_Revive_Soldier_Factories", 0);
		bool allowp = ini->Get_Bool("Settings", "Allow_Revive_Power_Plants", 0);
		bool allowr = ini->Get_Bool("Settings", "Allow_Revive_Refineries", 0);
		bool allowv = ini->Get_Bool("Settings", "Allow_Revive_Vehicle_Factories", 0);
		bool allowd = ini->Get_Bool("Settings", "Allow_Revive_Primary_Base_Defences", 0);
		GameObject *obj = Get_GameObj(ID);
		float Credits = Commands->Get_Money(obj);
		int Team = Get_Object_Type(obj);
		int BARID = Commands->Get_ID(Find_Soldier_Factory(Team));
		GameObject *bar= Commands->Find_Object(BARID);
		int PPID = Commands->Get_ID(Find_Power_Plant(Team));
		GameObject *pp = Commands->Find_Object(PPID);
		int REFID = Commands->Get_ID(Find_Refinery(Team));
		GameObject *ref = Commands->Find_Object(REFID);
		int WFID = Commands->Get_ID(Find_Vehicle_Factory(Team));
		GameObject *wf = Commands->Find_Object(WFID);
		int OBID = Commands->Get_ID(Find_Base_Defense(Team));
		GameObject *ob = Commands->Find_Object(OBID);
		if(allow == 1){
			if (strcmp(Text[1].c_str(),"help")==0){
				if (Team == 1) {
					Console_Input(StrFormat("ppage %d [Revive_System]: The price you have to pay is %.0f",ID,cost).c_str());
					Console_Input(StrFormat("ppage %d [Revive_System]: You need to say the building name: bar; pp; ref; wf; agt",ID).c_str());
				}
				else{
					Console_Input(StrFormat("ppage %d [Revive_System]: The price you have to pay is %.0f",ID,cost).c_str());
					Console_Input(StrFormat("ppage %d [Revive_System]: You need to say the building name: hon; pp; ref; air; ob",ID).c_str());
				}
				return;
			}
			if (strcmp(Text[1].c_str(),"bar")==0){
				if(allowb == 1){
					if(Is_Building_Dead(bar)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Barracks",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(bar, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Barracks.",Get_Player_ID(obj)).c_str());	
							}
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Hand of Nod",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(bar, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Hand of Nod.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The Barracks is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The Hand of Nod is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are NOT allowed to revive the Barracks.",Get_Player_ID(obj)).c_str());
				}
			}
			if (strcmp(Text[1].c_str(),"hon")==0){
				if(allowb == 1){
					if(Is_Building_Dead(bar)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Barracks",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(bar, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Barracks.",Get_Player_ID(obj)).c_str());	
							}
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Hand of Nod",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(bar, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Hand of Nod.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The Barracks is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The Hand of Nod is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are not allowed to revive the Hand of Nod",Get_Player_ID(obj)).c_str());
				}
			}
			if (strcmp(Text[1].c_str(),"pp")==0){
				if(allowp == 1){
					if(Is_Building_Dead(pp)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the PowerPlant",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(pp, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the PowerPlant.",Get_Player_ID(obj)).c_str());	
							}
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the PowerPlant",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(pp, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the PowerPlant.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The PowerPlant is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The PowerPlant is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are not allowed to revive the PowerPlant",Get_Player_ID(obj)).c_str());
				}	
			}
			if (strcmp(Text[1].c_str(),"ref")==0){
				if(allowr == 1){
					if(Is_Building_Dead(ref)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Refinery",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(ref, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Refinery.",Get_Player_ID(obj)).c_str());	
							}
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Refinery",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(ref, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Refinery.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The Refinery is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The Refinery is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are not allowed to revive the Refinery",Get_Player_ID(obj)).c_str());
				}
			}
			if (strcmp(Text[1].c_str(),"wf")==0){
				if(allowv == 1){
					if(Is_Building_Dead(wf)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the WeaponsFactory",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(wf, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the WeaponsFactory.",Get_Player_ID(obj)).c_str());	
							}	
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the AirStrip",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(wf, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the AirStrip.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The WeaponsFactory is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The AirStrip is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are not allowed to revive the WeaponsFactory",Get_Player_ID(obj)).c_str());
				}
			}
			if (strcmp(Text[1].c_str(),"air")==0){
				if(allowv == 1){
					if(Is_Building_Dead(wf)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the WeaponsFactory",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(wf, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the WeaponsFactory",Get_Player_ID(obj)).c_str());	
							}
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the AirStrip",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(wf, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the AirStrip.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The WeaponsFactory is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The AirStrip is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are not allowed to revive the AirStrip",Get_Player_ID(obj)).c_str());
				}
			}
			if (strcmp(Text[1].c_str(),"agt")==0){
				if(allowd == 1){
					if(Is_Building_Dead(ob)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the AGT",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(ob, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the AGT.",Get_Player_ID(obj)).c_str());	
							}
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Obelisk",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(ob, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Obelisk.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The AGT is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The Obelisk is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are not allowed to revive the AdvancedGuardTower",Get_Player_ID(obj)).c_str());
				}
			}
			if (strcmp(Text[1].c_str(),"ob")==0){
				if(allowd == 1){
					if(Is_Building_Dead(ob)) {
						if (Team == 1) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the AGT",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(ob, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the AGT",Get_Player_ID(obj)).c_str());	
							}
						}
						if (Team == 0) {
							if(Credits >= cost){
								Commands->Give_Money(obj,cost * -1,false);
								Console_Input(StrFormat("msg %d Has just revived the Obelisk",Get_Wide_Player_Name(obj)).c_str());
								Commands->Attach_Script(ob, "RR_ReviveBuilding", "");
							}
							else{
								Console_Input(StrFormat("ppage %d You do not have enough credits to revive the Obelisk.",Get_Player_ID(obj)).c_str());	
							}
						}
					}
					else {
						if (Team == 1) {
							Console_Input(StrFormat("ppage %d The AGT is not dead.",Get_Player_ID(obj)).c_str());	
						}
						else{
							Console_Input(StrFormat("ppage %d The Obelisk is not dead.",Get_Player_ID(obj)).c_str());
						}				
					}
				}
				else{
					Console_Input(StrFormat("ppage %d You are not allowed to revive the Obelisk",Get_Player_ID(obj)).c_str());
				}
			}
		}
		else{
			Console_Input(StrFormat("ppage %d Revive is currently disabled.",Get_Player_ID(obj)).c_str());
		}
	}
};
ChatCommandRegistrant<reviveChatCommand> reviveChatCommandReg("!r;!revive",CHATTYPE_ALL,1,GAMEMODE_AOW);


Re: Revive Plugin for RR Servers [message #352177 is a reply to message #352104] Fri, 26 September 2008 06:59 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)
With that; we can suggest improvements for you.

I'd do it like this:

int Team = Get_Team(ID);
GameObject *Building = 0;
if(Text[1] == "pp")
{
   if(!ini->Get_Bool("Settings", "Allow_Revive_Power_Plants", 0))
   {
       //not allowed
       return;
   }

   Building = Find_Power_Plant(Team));
}
else if(...)
{

}
else
{
   //invalid selection
   return;
}

if(!Building || !Commands->Get_ID(Building))
{
   //error
   return;
}

float Cost = /*Get cost */;


if(!Purchase_Item(Get_GameObj(ID), Cost))
{
   //not enough money
   return
}

Attach_Script_Once(Building, "RR
Commands->Attach_Script(bar, "RR_ReviveBuilding", "");
char msg[256];
sprintf(msg, "msg %S has revived the %s", Get_Wide_Player_Name_By_ID(ID), Translate_Preset(Building));
Console_Input(msg);

[Updated on: Fri, 26 September 2008 07:00]

Report message to a moderator

Re: Revive Plugin for RR Servers [message #352338 is a reply to message #352104] Sat, 27 September 2008 17:14 Go to previous messageGo to next message
Xpert is currently offline  Xpert
Messages: 1588
Registered: December 2005
Location: New York City
Karma: 0
General (1 Star)
This needs RR in order for it to work or what?

http://i32.photobucket.com/albums/d42/XpertMaverick/xpertyankee.jpg

Creator of NetGuard, an IRC network regulator.
Developer of the CloudyServ 0.982-X project.
Developer of the CloudyServ Ren-X bot.

Part time streamer - https://twitch.tv/gg_wonder
Re: Revive Plugin for RR Servers [message #352392 is a reply to message #352338] Sun, 28 September 2008 05:56 Go to previous message
MacKinsey is currently offline  MacKinsey
Messages: 83
Registered: March 2008
Karma: 0
Recruit
Xpert wrote on Sat, 27 September 2008 19:14

This needs RR in order for it to work or what?

Yes
Previous Topic: Harvester won't work
Next Topic: Glacier_Flying spawners
Goto Forum:
  


Current Time: Sat Oct 05 16:14:19 MST 2024

Total time taken to generate the page: 0.00802 seconds