Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » !DisableBeacon <playername>  () 2 Votes
!DisableBeacon <playername> [message #335070] Fri, 13 June 2008 06:20 Go to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
In cnc_reborn there are some annoying places people can plant beacons. For the MP-Gaming server we have made those places "illegal" to plant, but some people either do not know about that rue, or try to d it anyway. Most people don't do it now, but some still do. For this reason I made a chat command for moderators in-game to use.
I decided to post it here because I know beacon spamming in renegade could sometimes be a problem, and sometimes people planted in tunnels which some server owners do not allow.
Also, it may shed some light to people who are struggling to get the GameObject * of another player who they are trying to get by typing there name into the chat hook (this was annoying me for an hour or two also, I thought it used 0 based indexing representing each word in the string, but I should of read the comments in the plug-in i guess).

Like "!kill ren00b" or something...

So here it is:


class DisarmBeaconChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
	if(Is_Mod(Get_Player_Name_By_ID(ID))){
		int plantercount = 0;
if (!Text[1].empty()) {


std::string player = Text[1].c_str();

GameObject *obj = Get_GameObj_By_Player_Name(player.c_str());

if(!obj){
Console_Input(StrFormat("ppage %d You typed an invalid player name (%s), try again (case sensitive)",ID,player.c_str()).c_str());
}
else{
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x){
GameObject *o = (GameObject *)x->NodeData;
if (o && As_ScriptableGameObj(o)){
if (Is_Beacon(o)) {
GameObject *planter = Get_Beacon_Planter(o);
if(planter == obj){
	plantercount +=1;
Disarm_Beacons(Get_Player_ID(obj));
Console_Input(StrFormat("ppage %d You just disarmed %s's beacon",ID,player.c_str()).c_str());
Console_Input(StrFormat("ppage %d Your beacon was just disarmed by a moderator (%s)",Get_Player_ID(obj),Get_Player_Name_By_ID(ID)).c_str());
}
	}
}
x = x->NodeNext;
}
if(plantercount == 0){
Console_Input(StrFormat("ppage %d You tried to disarm %s's beacon, but he hasn't planted one.",ID,player.c_str()).c_str());
}
}
}
plantercount = 0;
	}
	else {
Console_Input(StrFormat("ppage %d You're not a mod, GTFO.",ID).c_str());
		}
}
};
ChatCommandRegistrant<DisarmBeaconChatCommand> DisarmBeaconChatCommandReg("!DisarmBeacon",CHATTYPE_ALL,1,GAMEMODE_ALL);


the is_mod function has been posted before by Roshambo I think, but here it is if you do not have it:

bool Is_Mod(const char *Name)
{
     fstream file("mods.txt", ios::in);
     string tmp;
     while(file >> tmp)
     { 
         if(strcmp(Name, tmp.c_str()) == 0)
          {
               return 1;
         }
     }
     return 0;
}


Where any name in mods.txt placed in your server's root folder will be counted as a mod.



Re: !DisableBeacon <playername> [message #335079 is a reply to message #335070] Fri, 13 June 2008 07:10 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Thanks very much Reborn, now i know how Tokens work in C++

!Rec Reborn another nice Job Very Happy



*EDIT* about these Bad Places why not creating a ANTI beacon zone?

[Updated on: Fri, 13 June 2008 07:13]

Report message to a moderator

Re: !DisableBeacon <playername> [message #335080 is a reply to message #335070] Fri, 13 June 2008 07:18 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
nice.....
Re: !DisableBeacon <playername> [message #335094 is a reply to message #335079] Fri, 13 June 2008 08:24 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
ಥ_ಥ wrote on Fri, 13 June 2008 10:10

Thanks very much Reborn, now i know how Tokens work in C++

!Rec Reborn another nice Job Very Happy



*EDIT* about these Bad Places why not creating a ANTI beacon zone?



I can write the function for the zone pretty easily (when someone enters it I mean), but creating the zones for each map on load is a bit of a nuisance problem. I heard using the API to makes zones is bugged anyway. Not that I've tried. I might give it a go at some point.



[Updated on: Fri, 13 June 2008 08:58]

Report message to a moderator

Re: !DisableBeacon <playername> [message #335163 is a reply to message #335070] Fri, 13 June 2008 15:54 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
i like anti beacon zone...may take up some time but worth it...i mean wat if no mods are ingame and someone puts a beacon where not allowed then waht
Re: !DisableBeacon <playername> [message #335347 is a reply to message #335070] Sat, 14 June 2008 21:08 Go to previous messageGo to next message
Veyrdite is currently offline  Veyrdite
Messages: 1471
Registered: August 2006
Location: Australia, Sydney
Karma: 0
General (1 Star)
Could it be possible to make a script zone where ever the play should not be able to plant a nuke, and then just make it execute the console command disarmb *playerID/name*?

WOL: Veyrdite Previously: Dthdealer ( a long time ago )

[Updated on: Sat, 14 June 2008 21:21]

Report message to a moderator

Re: !DisableBeacon <playername> [message #335369 is a reply to message #335070] Sun, 15 June 2008 02:51 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Yes, that it possible, you can create zones on map load using the API, but I've never done it. Someone told me that is possibly bugged though, I heard that the zone works once then not again :-/
That might just be crap though. I've never tried.



Re: !DisableBeacon <playername> [message #335392 is a reply to message #335070] Sun, 15 June 2008 10:26 Go to previous message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
im sure you guys can fix it
Previous Topic: 3D models rendered as grey cubes in LE
Next Topic: Renegade Resurrection 1.1 is out!
Goto Forum:
  


Current Time: Tue Dec 24 23:37:18 MST 2024

Total time taken to generate the page: 0.01258 seconds