Raised This Month: $32 Target: $400
 8% 

[REQ] Set server password


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-12-2018 , 08:33   [REQ] Set server password
Reply With Quote #1

Hello. I am looking for a simple plugin.

Type in the chat /passw 09121 and sv_password changes to 09121

Type /passoff and server password delete

I don't want use console command sv_password because players are asking for a more comfortable one

Can anybody help me?
LithuanianJack is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 01-12-2018 , 08:52   Re: [REQ] Set server password
Reply With Quote #2

Code:
#include <amxmodx>
#include <amxmisc>

new g_SvPassword;

public plugin_init()
{
	register_plugin("AMX Password","0.1","SmileY");

	register_clcmd("/password","_Password",ADMIN_CVAR,"Set server password");
	register_clcmd("say","_SayHandle");

	g_SvPassword = get_cvar_pointer("sv_password");
}

public _SayHandle(id)
{
	new Args[192];
	read_args(Args,charsmax(Args));
	remove_quotes(Args);
	
	if(equali(Args,"/password"))
	{
		client_cmd(id,Args,charsmax(Args));
		return PLUGIN_HANDLED;
	}
	
	return PLUGIN_CONTINUE;
}

public _Password(id,level,cid)
{
	if(!cmd_access(id,level,cid,1))
	{
		return PLUGIN_HANDLED;
	}

	new Password[32];
	read_argv(1,Password,charsmax(Password));
	
	set_pcvar_string(g_SvPassword,strlen(Password) ? Password : "");
	
	client_print(id,print_chat,"Server Password changed.");

	return PLUGIN_HANDLED;
}
Not tested
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 01-12-2018 at 10:47.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-12-2018 , 09:01   Re: [REQ] Set server password
Reply With Quote #3

Quote:
Originally Posted by ^SmileY View Post
Code:
#include <amxmodx>
#include <amxmisc>

new g_SvPassword;

public plugin_init()
{
	register_plugin("AMX Password","0.1","SmileY");

	register_clcmd("say /password","_Password",ADMIN_CVAR,"Set server password");

	g_SvPassword = get_cvar_pointer("sv_password");
}

public _Password(id,level,cid)
{
	if(!cmd_access(id,level,cid,1))
	{
		return PLUGIN_HANDLED;
	}

	new Password[32];
	read_argv(1,Password,charsmax(Password));
	
	set_pcvar_string(g_SvPassword,strlen(Password) ? Password : "");
	
	client_print(id,print_chat,"Server Password changed.");

	return PLUGIN_HANDLED;
}
Not tested
"/password pw123" do nothing. "/password" changes password to the unknown
LithuanianJack is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 01-12-2018 , 10:47   Re: [REQ] Set server password
Reply With Quote #4

Update first post.
Try it xD
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-12-2018 , 11:27   Re: [REQ] Set server password
Reply With Quote #5

Quote:
Originally Posted by ^SmileY View Post
Update first post.
Try it xD
Same prob
LithuanianJack is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-23-2018 , 01:54   Re: [REQ] Set server password
Reply With Quote #6

Quote:
Originally Posted by ^SmileY View Post
Update first post.
Try it xD
I can't use your plugin. Can you fix it?
LithuanianJack is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 03:00   Re: [REQ] Set server password
Reply With Quote #7

not tested. It gives loose indentation warning, but the code is properly indented.
Spoiler
__________________
retired chump

Last edited by DjSoftero; 01-23-2018 at 05:17.
DjSoftero is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-23-2018 , 03:10   Re: [REQ] Set server password
Reply With Quote #8

Quote:
Originally Posted by DjSoftero View Post
not tested. It gives loose indentation warning, but the code is properly indented.
Spoiler
I have no warnings when compiling but commands don't work (no answer)
LithuanianJack is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 05:18   Re: [REQ] Set server password
Reply With Quote #9

edited original post with the code. Now it should work
__________________
retired chump
DjSoftero is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 01-23-2018 , 06:10   Re: [REQ] Set server password
Reply With Quote #10

Quote:
Originally Posted by DjSoftero View Post
edited original post with the code. Now it should work
Works perfectly. Thank you. ;) and what do you think about this? Is it very difficult? https://forums.alliedmods.net/showthread.php?t=304401
LithuanianJack 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 22:10.


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