Jump to content
SSForum.net is back!

Making new commands?


Recommended Posts

Guest Pigeonstriker
Posted

Here's the current code. The commands don't seem to work, e.g. ?accept does nothing.

 

I added this to the bottom of conf/groupdef.dif/default and did ?reloadconf -f and restarted the server.

 

; freq management commands

accept

decline

invite

noinvite

freqkick

 

http://paste.pocoo.org/show/270801/

 

Thanks!

Posted
your groupdef policy needs to have "cmd_accept" instead of "accept" if you want to have a pub command, and you would also need "privcmd_accept" if you also wanted to pm it

SSC Distension Owner
SSCU Trench Wars Developer


3:JabJabJab> sometimes i feel like when im in this mood im like a productive form of Cheese
Dr Brain> Pretty much everything you said was wrong. Except where you called me a lazy jerk with no time. That was true.
3:KrynetiX> do you ever open your web browser and type ?go google
5:Ceiu> Wow. My colon decided that was a good time to evacuate itself.

Guest Spidernl
Posted

Any specific reason you're using Python for this module? Sounds like freq manager would be better in C.

 

I approve of this message.

Guest Pigeonstriker
Posted

Thanks for the help, I got it working following these tips.

 

The module was requested to be written in Python.

Posted (edited)

Just browsed the asss source and freqman is intended to work in pyton but advisers are only half implemented in python. So you indeed have to use C for now.

 

Would go something like this:

static int CanChangeFreqAdv(Player *p, int new_freq, char *err_buf, int buf_len)
{
if (/*allowed to change freq*/)
{
	return 1;
}
else
{
	if (err_buf)
	{
		snprintf(err_buff, buf_len, "You do not own freq %d", new_freq);
		err_buf[buf_len-1] = 0; // not need for GCC
	}
	
	return 0;
}
}

static Aenforcer enforceradv = 
{
ADVISER_HEAD_INIT(A_ENFORCER)

NULL,
CanChangeFreqAdv
};


EXPORT int MM_mymodule(int action, Imodman *mm_, Arena *arena)
{

// ...
else if (action == MM_ATTACH)
       {
       	mm->RegAdviser(&enforceradv, arena);
       	return MM_OK;
       }
       else if (action == MM_DETACH)
       {
       	mm->UnregAdviser(&enforceradv, arena);
       	return MM_OK;
       }
}

Edited by JoWie
  • 2 months later...
Posted
Programming is no fun in Python anyway - if there are no pointers to cock up, there's nowhere to waste 10 hours a week hunting that missing dereference.

- DeadOnArrival

Never interrupt your enemy when he is making a mistake.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...