AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   cvar rcon_password & use (https://forums.alliedmods.net/showthread.php?t=189420)

hyphen 07-07-2012 01:05

cvar rcon_password & use
 
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, "")
}


hornet 07-07-2012 01:22

Re: cvar rcon_password & use
 
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() ?

hyphen 07-07-2012 01:36

Re: cvar rcon_password & use
 
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

hornet 07-07-2012 01:42

Re: cvar rcon_password & use
 
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 (Post 1745172)
Why not just use server_cmd() ?


fysiks 07-07-2012 11:19

Re: cvar rcon_password & use
 
You don't need to use the rcon protocol when using AMX Mod X. Just use server_cmd().

hyphen 07-08-2012 01:40

Re: cvar rcon_password & use
 
Quote:

Originally Posted by fysiks (Post 1745374)
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.

hornet 07-08-2012 01:45

Re: cvar rcon_password & use
 
Quote:

Originally Posted by hyphen (Post 1745845)
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.

fysiks 07-08-2012 03:20

Re: cvar rcon_password & use
 
Quote:

Originally Posted by hornet (Post 1745854)
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.

hyphen 07-08-2012 06:25

Re: cvar rcon_password & use
 
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 ?

hornet 07-08-2012 06:59

Re: cvar rcon_password & use
 
Quote:

Originally Posted by fysiks (Post 1745876)
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 (Post 1745949)
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?


All times are GMT -4. The time now is 15:07.

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