Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Generic event handler?

 
Post new topic   Reply to topic Printable version
 View previous topic  Compiling a module in MSVC Post :: Post Random values from PDATA  View next topic  
Author Message
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Mon Jan 17, 2011 10:35 pm    Post subject: Generic event handler? Reply to topic Reply with quote

Did anyone ever make some kind of module that handles the sequence of an event being hosted? I'm talking about something generic... Most events require x to y players, a fixed number of teams, etc. And the whole 'player x lagged out, wait y time, get substitute, cancel game if everyone leaves' part.
I'll need something like this for an event I have, and probably many more after, so I'd do something that can be used in almost any case, using a set of rules and whatnot. If someone else already did it, or if someone started such a module, I'd like to know tongue.gif
Also, if you have suggestions for the approach to accomplish this, you're welcome.




Also, completely unrelated bonus question:
Initrd.gz wrote:
You could modify cmdman to have a function that gets the list of commands, but perhaps it could be a security breach (not to mention a pain to use on existing servers), and use their helptext.
^ This was posted almost 2 years ago here, no one really replied to it... but would this be possible? Is it done already? Did someone do it somewhere? Listing commands like on a bot would be nice to have.
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Tue Jan 18, 2011 1:48 am    Post subject: Reply to topic Reply with quote

http://forums.minegoboom.com/viewtopic.php?p=79745#79745
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Jan 18, 2011 7:49 am    Post subject: Reply to topic Reply with quote

I gave that exact link in my post.... "it doesn't look like it's possible" doesn't answer my question much. ?commands are registered, and has to be a way to get the list of them, even if it involves adding a new interface function to cmdman
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Jan 18, 2011 8:29 am    Post subject: Reply to topic Reply with quote

D1st0rt made this: https://bitbucket.org/d1st0rt/asss_hostedgame

I'm not very familiar with it, so I'm not sure if it'll do what you need.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Tue Jan 18, 2011 10:03 am    Post subject: Reply to topic Reply with quote

Samapico wrote:
I gave that exact link in my post.... "it doesn't look like it's possible" doesn't answer my question much. ?commands are registered, and has to be a way to get the list of them, even if it involves adding a new interface function to cmdman


It's possible to do this without modifying cmdman / asss core.

Code: Show/Hide

static Icmdman *cmd;

static void (*AddCommandOriginal)(const char *cmdname, CommandFunc func, Arena *arena, helptext_t ht);
static void (*RemoveCommandOriginal)(const char *cmdname, CommandFunc func, Arena *arena);

static void AddCommandInt(const char *cmdname, CommandFunc func, Arena *arena, helptext_t ht)
{
        // ...
        AddCommandOriginal(cmdname, func, arena, ht);
}
       
static void RemoveCommandInt(const char *cmdname, CommandFunc func, Arena *arena)
{
        // ...
        RemoveCommandOriginal(cmdnam, func, arena);
}

static void ReleaseInterfaces()
{
        mm->ReleaseInterface(cmd);
}

EXPORT int MM_cmdlist(int action, Imodman *mm_, Arena *arena)
{
        if (action == MM_LOAD)
        {
                mm = mm_;
                cmd = mm->GetInterface(I_CMDMAN, ALLARENAS);
               
                if (!cmd)
                {
                        ReleaseInterfaces();
                        return MM_FAIL;
                }
               
                AddCommandOriginal = cmd->AddCommand;
                RemoveCommandOriginal = cmd->RemoveCommand;
                cmd->AddCommand = AddCommandInt;
                cmd->RemoveCommand = RemoveCommandInt;
        }
        else if (action == MM_UNLOAD)
        {
                if (cmd->AddCommand != AddCommandInt || cmd->RemoveCommand != RemoveCommandInt)
                        return MM_FAIL;
       
                cmd->AddCommand = AddCommandOriginal;
                cmd->RemoveCommand = RemoveCommandOriginal;

                ReleaseInterfaces();
        }
}


Last edited by JoWie on Sun Jan 30, 2011 12:31 pm, edited 3 times in total
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Jan 18, 2011 10:44 am    Post subject: Reply to topic Reply with quote

If I understand what you're doing there, you'd need to add:
cmd->AddCommand = AddCommandOriginal;
cmd->RemoveCommand = RemoveCommandOriginal;

just before releasing the cmd interface

?

Also, you'd need to load that thing right after cmdman... but then, you wouldn't be able to use this to list the core commands? Unless it's another module that adds commands to communicate with the core module??
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Jan 18, 2011 10:45 am    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
D1st0rt made this: https://bitbucket.org/d1st0rt/asss_hostedgame

I'm not very familiar with it, so I'm not sure if it'll do what you need.

Ahh... I think that's what I was looking for.... Pretty sure I had heard of something like this before. I'll see what it can do, thanks icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Tue Jan 18, 2011 3:29 pm    Post subject: Reply to topic Reply with quote

Samapico wrote:
If I understand what you're doing there, you'd need to add:
cmd->AddCommand = AddCommandOriginal;
cmd->RemoveCommand = RemoveCommandOriginal;

just before releasing the cmd interface

?

Also, you'd need to load that thing right after cmdman... but then, you wouldn't be able to use this to list the core commands? Unless it's another module that adds commands to communicate with the core module??


I accidently forgot those.

You need to load it right after cmdman (later is fine to, but you would miss out on commands). You would get every command that exists even the core ones. (cmdman does not register any command of its own.)
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Jan 18, 2011 4:22 pm    Post subject: Reply to topic Reply with quote

Can 2 modules add the same command?

If this cmdlist module was to add a ?man or ?help command, so that if someone types ?man or ?help with no arguments, a list of commands is shown, would it mess up the "original" man/help command? Or would both modules receive the function call?
Back to top
View users profile Send private message Add User to Ignore List
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Tue Jan 18, 2011 5:14 pm    Post subject: Reply to topic Reply with quote

If a command is added multiple times, cmdman fires all of the functions (even if the same command, function pair is added multiple times).

You could register a command in MM_POSTLOAD for ?man or ?help and simply add one line if no arguments are used that gives the arena message "Type ?cmdlist for a list of commands"


Oh and if you use that code snippit, remember that you would need to use mutex locks.
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Jan 18, 2011 5:35 pm    Post subject: Reply to topic Reply with quote

And is there a way to know if a player has access to a particular command? I'm guessing that's handled by another module :/
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Tue Jan 18, 2011 6:21 pm    Post subject: Reply to topic Reply with quote

capman

cmd_blah
privcmd_bleh
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Jan 18, 2011 6:37 pm    Post subject: Reply to topic Reply with quote

oooh, CAPability? Was wondering what the hell 'cap' was for... cool.

There will be a nice cmdlist module soon...

"soon" being relative.
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Tue Jan 18, 2011 10:13 pm    Post subject: Reply to topic Reply with quote

its been on my to do list, but i havnt gotten around to it

but its very important you check they have permisson to use the command before you tell them that it exists
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Jan 30, 2011 2:07 pm    Post subject: Reply to topic Reply with quote

With Jowie's wisdom, I got this cmdlist thing to work, see here for attachments
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 658 page(s) served in previous 5 minutes.

phpBB Created this page in 0.554562 seconds : 40 queries executed (82.7%): GZIP compression disabled