Home » Renegade Discussions » Mod Forum » Revive Plugin for RR Servers
Revive Plugin for RR Servers [message #352104] |
Thu, 25 September 2008 10:37 |
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 131 times)
|
|
|
|
Re: Revive Plugin for RR Servers [message #352173 is a reply to message #352104] |
Fri, 26 September 2008 05:54 |
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 |
|
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
|
|
|
|
|
Goto Forum:
Current Time: Fri Nov 08 04:34:49 MST 2024
Total time taken to generate the page: 0.00720 seconds
|