Jump to content
SubSpace Forum Network

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!

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...