 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Thu Jan 06, 2005 2:04 pm Post subject: freqowners with feedback |
 |
|
|
|
Here's a modules that will (hopefully) replace the current freqowners one.
It's almost identical except it provides feedback whenever you use the commands, so you know why player x isn't being kicked off your freq. There's also a ?getowner command that will print the current owners of your freq, or make you an owner if there aren't any (should the case ever arise).
EDIT: fixed a bug with ?getowner _________________ SubSpace Discretion: A Third Generation SubSpace Client
Freqowners with feedback
freq_owners.c - 8.16 KB
File downloaded or viewed 26 time(s)
Last edited by Bak on Thu May 19, 2005 6:40 am, edited 1 time in total |
|
Back to top |
|
 |
Chambahs Guest
Offline
|
Posted: Mon Jan 17, 2005 3:36 am Post subject: |
 |
|
|
|
awww, i dont know how to compile C o well..
|
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:38 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Mon Jan 17, 2005 7:05 am Post subject: |
 |
|
|
|
I haven't looked much into the ASSS documentation on ASSS Wiki, but I think the last time I checked it Smong wrote some article on compiling C modules.
My guide is currently offline, otherwise I'd give you that too.
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Jan 17, 2005 7:34 am Post subject: |
 |
|
|
|
For chambah's sake, the doctor recommend that he not compile anything writen in c that deals with asss. lol _________________ Performance is often the art of cheating carefully. - James Gosling
|
|
Back to top |
|
 |
i88gerbils Oldbie Server Help

Gender: Joined: Dec 13 2002 Posts: 423 Location: OH Offline
|
Posted: Mon Jan 17, 2005 10:35 am Post subject: |
 |
|
|
|
Could you produce a diff output? Hmm, maybe I'll just do that myself...
Here it is:
--- src/freqowners-old.c 2005-01-08 20:09:11.000000000 -0500
+++ src/freqowners.c 2005-01-17 10:37:51.000000000 -0500
@@ -1,7 +1,7 @@
/* dist: public */
-#include "asss.h"
+#include "../../asss.h"
/* the delay (in ticks) between a ?freqkick and its effect */
@@ -10,7 +10,8 @@
/* commands */
local void Cgiveowner(const char *, const char *, Player *, const Target *);
local void Cfreqkick(const char *, const char *, Player *, const Target *);
-local helptext_t giveowner_help, freqkick_help;
+local void Cgetowner(const char *tc, const char *params, Player *p, const Target *target);
+local helptext_t giveowner_help, freqkick_help, getowner_help;
/* callbacks */
local void MyPA(Player *p, int action, Arena *arena);
@@ -54,6 +55,7 @@
cmd->AddCommand("giveowner", Cgiveowner, ALLARENAS, giveowner_help);
cmd->AddCommand("freqkick", Cfreqkick, ALLARENAS, freqkick_help);
+ cmd->AddCommand("getowner", Cgetowner, ALLARENAS, getowner_help);
return MM_OK;
}
@@ -61,6 +63,8 @@
{
cmd->RemoveCommand("giveowner", Cgiveowner, ALLARENAS);
cmd->RemoveCommand("freqkick", Cfreqkick, ALLARENAS);
+ cmd->RemoveCommand("getowner", Cgetowner, ALLARENAS);
+
mm->UnregCallback(CB_PLAYERACTION, MyPA, ALLARENAS);
mm->UnregCallback(CB_FREQCHANGE, MyFreqCh, ALLARENAS);
mm->UnregCallback(CB_SHIPCHANGE, MyShipCh, ALLARENAS);
@@ -120,12 +124,92 @@
void Cgiveowner(const char *tc, const char *params, Player *p, const Target *target)
{
if (target->type != T_PLAYER)
- return;
+ {
+ chat->SendMessage(p, "You must send this command to a player.");
+ }
+ else if (!OWNSFREQ(p))
+ {
+ chat->SendMessage(p, "You are not the owner of your freq.");
+ }
+ else if (!(p->arena == target->u.p->arena && p->p_freq == target->u.p->p_freq))
+ {
+ chat->SendMessage(p, "That player is not on your freq.");
+ }
+ else if (OWNSFREQ(target->u.p))
+ {
+ chat->SendMessage(p, "That player is already an owner of your freq.");
+ }
+ else
+ {
+ Player *t = target->u.p;
+ OWNSFREQ(t) = 1;
+ chat->SendMessage(p, "You have granted ownership to %s",t->name);
+ chat->SendMessage(t, "%s has granted you ownership of your freq.",p->name);
+ }
+}
+
+local helptext_t getowner_help =
+"Module: freqowners\n"
+"Targets: none\n"
+"Args: none\n"
+"Makes you become owner of your freq, if your freq doesn't have an owner already.\n";
+
- if (OWNSFREQ(p) &&
- p->arena == target->u.p->arena &&
- p->p_freq == target->u.p->p_freq)
- OWNSFREQ(target->u.p) = 1;
+void Cgetowner(const char *tc, const char *params, Player *p, const Target *target)
+{
+ Player *t = target->u.p;
+ ConfigHandle ch = p->arena->cfg;
+
+ if (cfg->GetInt(ch, "Team", "AllowFreqOwners", 1) &&
+ p->p_freq >= cfg->GetInt(ch, "Team", "PrivFreqStart", 100) &&
+ p->p_freq != p->arena->specfreq)
+ {
+ Player *pl;
+ Link *link;
+ int found = 0;
+
+ pd->Lock();
+
+ FOR_EACH_PLAYER(pl)
+ {
+ if (pl->arena == p->arena && p->p_freq == pl->p_freq) // same team
+ {
+ if (OWNSFREQ(pl))
+ {
+ found = 1;
+ break;
+ }
+ }
+ }
+ pd->Unlock();
+
+ if (found == 0)
+ {
+ OWNSFREQ(pl) = 1;
+
+ chat->SendMessage(p,"You are now the owner of your freq.");
+ }
+ else
+ {
+ chat->SendMessage(p, "The owner(s) are:");
+
+ pd->Lock();
+
+ FOR_EACH_PLAYER(pl)
+ {
+ if (pl->arena == p->arena && p->p_freq == pl->p_freq) // same team
+ {
+ if (OWNSFREQ(pl))
+ {
+ chat->SendMessage(p, "%s",pl->name);
+ }
+ }
+ }
+ pd->Unlock();
+ }
+ }
+ else
+ chat->SendMessage(p,"Your freq can not have an owner.");
}
@@ -140,14 +224,69 @@
void Cfreqkick(const char *tc, const char *params, Player *p, const Target *target)
{
Player *t = target->u.p;
+ ConfigHandle ch = p->arena->cfg;
- if (target->type != T_PLAYER)
- return;
+ if (cfg->GetInt(ch, "Team", "AllowFreqOwners", 1) &&
+ p->p_freq >= cfg->GetInt(ch, "Team", "PrivFreqStart", 100) &&
+ p->p_freq != p->arena->specfreq)
+ {
- if (OWNSFREQ(p) && !OWNSFREQ(t) &&
- p->arena == t->arena &&
- p->p_freq == t->p_freq)
- ml->SetTimer(kick_timer, KICKDELAY, 0, t, t);
+ if (target->type != T_PLAYER)
+ {
+ chat->SendMessage(p, "You must message the command to a player on your freq.");
+ }
+ else if (OWNSFREQ(p))
+ {
+ if (p->arena == t->arena && p->p_freq == t->p_freq)
+ {
+ if(!OWNSFREQ(t))
+ {
+ chat->SendMessage(p, "%s will be kicked off in a moment.",t->name);
+ ml->SetTimer(kick_timer, KICKDELAY, 0, t, t);
+ }
+ else
+ chat->SendMessage(p, "You can not kick other freq owners off your freq.");
+ }
+ else
+ {
+ chat->SendMessage(p, "That player is not on your freq.");
+ }
+ }
+ else
+ {
+ Player *pl;
+ Link *link;
+ int found = 0;
+
+ chat->SendMessage(p, "You are not the owner of your freq. The owner(s) are:");
+
+ pd->Lock();
+
+ FOR_EACH_PLAYER(pl)
+ {
+ if (pl->arena == p->arena && p->p_freq == pl->p_freq) // same team
+ {
+ if (OWNSFREQ(pl))
+ {
+ chat->SendMessage(p, "%s",pl->name);
+ found = 1;
+ }
+ }
+ }
+ pd->Unlock();
+
+ if (found == 0)
+ {
+ chat->SendMessage(p,"nobody");
+ chat->SendMessage(p,"To become the owner of your freq use ?getowner");
+ }
+
+ }
+ }
+ else
+ {
+ chat->SendMessage(p,"Your freq can not have an owner.");
+ }
}
@@ -188,7 +327,7 @@
}
else if (hasowner)
chat->SendMessage(p, "This freq has an owner. You should be aware "
- "that you can be kicked off any time.");
+ "that you can be kicked off any time. If the owner leaves you can use ?getowner to become the new owner.");
}
}
|
_________________ Oldbie Server Help
Last edited by i88gerbils on Mon Jan 17, 2005 10:39 am, edited 1 time in total |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Mon Jan 17, 2005 10:39 am Post subject: |
 |
|
|
|
I just use the Dev-C++ project to compile _________________
|
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:38 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Mon Jan 17, 2005 12:23 pm Post subject: |
 |
|
|
|
What kind of "format" (or whatever it is) is that, and what is it for?
|
|
Back to top |
|
 |
i88gerbils Oldbie Server Help

Gender: Joined: Dec 13 2002 Posts: 423 Location: OH Offline
|
Posted: Mon Jan 17, 2005 12:50 pm Post subject: |
 |
|
|
|
diff?
|
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:38 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Mon Jan 17, 2005 2:04 pm Post subject: |
 |
|
|
|
Ah, thanks.
Hm, why are you putting two links together in one word? I'd miss one of them easily.
|
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:42 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Mon Jan 17, 2005 2:07 pm Post subject: |
 |
|
|
|
If you are using Windows, I'd recommend installing UnxUtils. Saves you a lot of hassle over installing Cygwin just for good command line programs. Plus, pclip and gclip are kickass extras.
|
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 20 page(s) served in previous 5 minutes.
|