Raised This Month: $ Target: $400
 0% 

cvar rcon_password & use


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hyphen
Senior Member
Join Date: Aug 2011
Old 07-07-2012 , 01:05   cvar rcon_password & use
Reply With Quote #1

with the following code Im tryin to unban user from admin console so that upon fail/success admin can have the proper output. But the code seems to be say bad_rcon

Code:
//global
new g_rcon[20]

//plugin_init()
get_cvar_string("rcon_password", g_rcon, 19)    

//admin cmd public function
new szCommand[20]
read_argv(0, szCommand, 19)

if(equal(szCommand, "amx_unbanid"))
{
	if(!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED
			
	new szArg[25]
	read_argv(1, szArg, 24)
	client_cmd(id, "rcon_password ^"%s^";rcon removeid ^"%s^";rcon_password ^"%s^"", g_rcon, szArg, "")
}
hyphen is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-07-2012 , 01:22   Re: cvar rcon_password & use
Reply With Quote #2

Of course it says bad_rcon . Your making the player enter the incorrect rcon password.
Are you trying to change the rcon password there or deliberately force an inccorect password so the player can no longer use rcon ( in which case I do not understand why your asking )? I wouldn't recommend this - I'm not certain about it, but an admin could get banned from the server by inputting the incorrect rcon password multiple times.

Why not just use server_cmd() ?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
hyphen
Senior Member
Join Date: Aug 2011
Old 07-07-2012 , 01:36   Re: cvar rcon_password & use
Reply With Quote #3

My requirement is only allow the admin to unban users through rcon. then set the admin rcon_password to null.

rcon_password "RCON_PASS" //setting server rcon for one time use
rcon removeid / removeip //process necessary rcon commands from admin console
rcon_password ""//make rcon_password null, so admin cant get the rcon

Last edited by hyphen; 07-07-2012 at 01:38.
hyphen is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-07-2012 , 01:42   Re: cvar rcon_password & use
Reply With Quote #4

When rcon_password <pass> is executed alone by a client, it is used to allow that player to use rcon, not change to change it ( as oppose to server console ). Perhaps you could try rcon rcon_password <pass> ( not sure if that would work ).

Quote:
Originally Posted by hornet View Post
Why not just use server_cmd() ?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 07-07-2012 at 01:42.
hornet is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-07-2012 , 11:19   Re: cvar rcon_password & use
Reply With Quote #5

You don't need to use the rcon protocol when using AMX Mod X. Just use server_cmd().
__________________
fysiks is offline
hyphen
Senior Member
Join Date: Aug 2011
Old 07-08-2012 , 01:40   Re: cvar rcon_password & use
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
You don't need to use the rcon protocol when using AMX Mod X. Just use server_cmd().
Yes I can, but my aim is notify admin whether he successfully unbanned id/ip. using server_cmd(removeid <id>) admin will not get any messages on his console until I hardcode some success/failure message.

Im using rcon removeid so that admins can get an acknowledgement.
hyphen is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-08-2012 , 01:45   Re: cvar rcon_password & use
Reply With Quote #7

Quote:
Originally Posted by hyphen View Post
Yes I can, but my aim is notify admin whether he successfully unbanned id/ip. using server_cmd(removeid <id>) admin will not get any messages on his console until I hardcode some success/failure message.

Im using rcon removeid so that admins can get an acknowledgement.
Then make your own function to remove the ban from the file.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-08-2012 , 03:20   Re: cvar rcon_password & use
Reply With Quote #8

Quote:
Originally Posted by hornet View Post
Then make your own function to remove the ban from the file.
That's trickier than you think because when the server shuts down or changes the map it will write all the IPs and IDs to the ban files from memory and thus will undo what you did to the file while the server was running.
__________________
fysiks is offline
hyphen
Senior Member
Join Date: Aug 2011
Old 07-08-2012 , 06:25   Re: cvar rcon_password & use
Reply With Quote #9

I cant understand why this command is failing

client_cmd(id, "rcon_password ^"%s^";rcon removeid ^"%s^";rcon_password ^"%s^"", g_rcon, szArg, "")

it does set rcon_password first, then use some rcon commands, then set rcon_password to blank. whats the flaw ?
hyphen is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 07-08-2012 , 06:59   Re: cvar rcon_password & use
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
That's trickier than you think because when the server shuts down or changes the map it will write all the IPs and IDs to the ban files from memory and thus will undo what you did to the file while the server was running.
Interesting, I didn't know that.

Quote:
Originally Posted by hyphen View Post
I cant understand why this command is failing

client_cmd(id, "rcon_password ^"%s^";rcon removeid ^"%s^";rcon_password ^"%s^"", g_rcon, szArg, "")

it does set rcon_password first, then use some rcon commands, then set rcon_password to blank. whats the flaw ?
It doesn't "set" the rcon at all. Did you not read my post?
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet 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 15:07.


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