AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Password clcmd (https://forums.alliedmods.net/showthread.php?t=128977)

B1GB0Y 06-07-2010 14:08

Password clcmd
 
HI coders,

I need help with a command that set password in my server when Admin type .pass (string here) and .nopass that set no password.

thks :wink:

RedRobster 06-07-2010 16:29

Re: Password clcmd
 
Just use amx_cvar sv_password ?

Kreation 06-07-2010 16:31

Re: Password clcmd
 
Should post in the Suggestions/Request forum anyways.

HLM 06-07-2010 17:31

Re: Password clcmd
 
here, this is untested, but in theory, it should work (WARNING! my theory is probably wrong, lol)

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Easy Password Changer"
#define VERSION "1.0"
#define AUTHOR "Master"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say""Hook_Say", -1"This is how you say things!")
}

public 
Hook_Say(idlevelcid)
{
    if (!
cmd_access(id,level,cid,2)
        return 
PLUGIN_CONTINUE;
    new 
said[128];
    
read_args(saidsizeof(said)-1)
    
remove_quote(said)
    if(
equali(said".nopass"))
        
set_cvar_string("sv_password""")
    else if(
equali(said".pass",5)
    {
        
replace(saidsizeof(said)-1".pass """)
        
set_cvar_string("sv_password"said);
    }



B1GB0Y 06-07-2010 18:15

Re: Password clcmd
 
Thanks for the help HLM, in compile im taking a few errors and i have fixed the most simple ones but the code still having 2 errors that i don't know how to fix. Here is ..

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Easy Password Changer"
#define VERSION "1.0"
#define AUTHOR "Master"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say""Hook_Say", -1"This is how you say things!")
}

public 
Hook_Say(idlevelcid)
{
    if (!
cmd_access(id,level,cid,2))
        return 
PLUGIN_CONTINUE;
    new 
said[128];
    
read_args(saidsizeof(said)-1)
    
remove_quote(said)
    if(
equali(said".nopass"))
        
set_cvar_string("sv_password""")
    else if(
equali(said".pass",5))
    {
        
replace(saidsizeof(said)-1".pass """)
        
set_cvar_string("sv_password"said);
    }
return 
PLUGIN_CONTINUE;


Added 1 parenthesis in first if and other 1 in else if.
Added
return PLUGIN_CONTINUE; in the final of the code

I fixed this things but i still having in the line 13 :


warning 217: loose indentation

And in the line 24:

error 017: undefined symbol "remove_quote"



Kreation 06-07-2010 18:53

Re: Password clcmd
 
Change "remove_quote" to "remove_quotes".

B1GB0Y 06-07-2010 19:05

Re: Password clcmd
 
thanks Kreation one word to make all diference lol

Worked ! THANKS A LOT :D

HLM 06-07-2010 21:33

Re: Password clcmd
 
Human Error: I am becoming a professional at it.


All times are GMT -4. The time now is 05:23.

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