Raised This Month: $ Target: $400
 0% 

[SOLVED] How make a automatic enable / disable plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 05-03-2010 , 16:08   [SOLVED] How make a automatic enable / disable plugin
Reply With Quote #1

Hii guys, I try to modifique the Galileo plugin to enable and disable automatically.

I get a source part of this plugin: Show Admins Online to identify the admins.

I modified the source of Galileo and I think is correct, BUT I don't know what the correct function (or functions) I call to enable the plugin.

What I want: If have one or more ADM online, the plugin doesn't work. If don't have AMD online, the plugin work normaly

In attachments have my modified source.

Thanks guys.

PS: Sorry for may bad english...
Attached Files
File Type: sma Get Plugin or Get Source (galileo.sma - 124 views - 77.1 KB)

Last edited by GalegO; 10-26-2010 at 11:14.
GalegO is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-03-2010 , 17:41   Re: How make a automatic enable / disable plugin
Reply With Quote #2

Add this to your plugin.

Code:
#include <amxmisc> new iAdmins public client_putinserver( id ) {     if( is_user_admin( id ) )     {         iAdmins++         pause( "a" )     } } public client_disconnect( id ) {     if( is_user_admin( id ) )     {         if( --iAdmins < 1 )         {             unpause( "a" )         }     } }
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 05-03-2010 , 23:05   Re: How make a automatic enable / disable plugin
Reply With Quote #3

wrecked, I'll remove my all modifications and put only this code?

What I write in the "a" ? The plugin's name?

And about a cvar to enable and disable this function... How I can do?

Thanks for help
GalegO is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-03-2010 , 23:17   Re: How make a automatic enable / disable plugin
Reply With Quote #4

See for yourself
http://www.amxmodx.org/funcwiki.php?go=func&id=223
__________________
Bugsy is offline
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 05-04-2010 , 12:11   Re: How make a automatic enable / disable plugin
Reply With Quote #5

Thanks! I'll test now
GalegO is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-04-2010 , 13:44   Re: How make a automatic enable / disable plugin
Reply With Quote #6

The only issue I see is whether or not the plugin will be able to unpause itself while in a paused state.
__________________
Bugsy is offline
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 05-04-2010 , 14:42   Re: How make a automatic enable / disable plugin
Reply With Quote #7

Yes, I compiled and tested now...

It pause, but no unpause

This is parts of my code:

Code:
new cvar_automatic;
new iAdmins;

public plugin_init()
{
    cvar_automatic                = register_cvar("gal_automatic", "1");
}

public client_disconnect(id)
{
    if( is_user_admin( id ) && get_pcvar_num(cvar_automatic) == 1 )
        {
            if( --iAdmins < 1 )
            {
                    unpause( "a" );
            }
        }
}

public client_putinserver(id)
{
    if( is_user_admin( id ) && get_pcvar_num(cvar_automatic) == 1 )
        {
            iAdmins++;
            pause( "a" );
        }
}
In attachments, my modified source...

PS: Search for //AUTOMATIC in the source, I put this to find more quicky my modifications...

Quote:
Originally Posted by Bugsy
The only issue I see is whether or not the plugin will be able to unpause itself while in a paused state.
Hahaha... IS true!!! If stoped he doen't work more!!! hahaah... I'll make a new plugin to pause and unpause this plugin... Is the only way...

This is my second modification in a plugin, the first I only translated the KnifeDuel to Pt_Br...
Attached Files
File Type: sma Get Plugin or Get Source (galileo.sma - 551 views - 76.4 KB)

Last edited by GalegO; 05-04-2010 at 15:30.
GalegO is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-04-2010 , 15:28   Re: How make a automatic enable / disable plugin
Reply With Quote #8

Give this a shot.

Code:
#include <amxmodx> #include <amxmisc> new iAdmins public plugin_init() {     register_plugin( "Galileo Fixer", "1.0", "Wrecked" ) } public client_putinserver( id ) {     if( is_user_admin( id ) )     {         iAdmins++                 pause( "ac", "galileo.amxx" )     } } public client_disconnect( id ) {     if( is_user_admin( id ) && ( --iAdmins < 1 ) )     {         unpause( "ac", "galileo.amxx" )     } }
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
GalegO
Member
Join Date: May 2010
Location: Brazil
Old 05-04-2010 , 16:22   Re: How make a automatic enable / disable plugin
Reply With Quote #9

Thanks MAN!!! Works perfectly!!!
GalegO is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode