AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change server pass... (https://forums.alliedmods.net/showthread.php?t=57777)

Qlim4X 07-11-2007 00:20

Change server pass...
 
hi again

i want to make a script that can change the server password adn only other admins can see the pass and not the users

my admins dont have rcon access so they use amx_cvar sv_password and all the players can see the pass

so i need to creat a script that can change the pass just typing in the console pro_pass mypass
any ideas????

thx

this is my try but have problem when press to time the same password
Quote:

/* AMXMOD X script.
*
* (c) Copyright 2007 Qlim4X
* This file is provided as is (no warranties).
*
* For #Pro.Gather in GrNet. Internal use only.
*
*/
#include <amxmod>
#include <amxmisc>

public plugin_init()
{
register_plugin("pro.gather ChangePass","1.0","qlim4x")
register_concmd("pro_pass","set_password",ADM IN_BAN,"<password>")
register_cvar("sm_password","scrim",FCVAR_ARC HIVE|FCVAR_PROTECTED)
return PLUGIN_CONTINUE
}


public set_password(id, level, cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new set_pass[32]
read_argv ( id, set_pass, 31 )
set_cvar_string ( "sv_password", set_pass )
return PLUGIN_HANDLED
}

Qlim4X 07-11-2007 04:09

Re: Change server pass...
 
i thing that i have fineshed


no how can i send a msg with the pass to all the admins in the server

[X]-RayCat 07-11-2007 07:42

Re: Change server pass...
 
is_user_admin
client_print or amx_chat (team_say @)
get_cvar_string

Qlim4X 07-11-2007 13:08

Re: Change server pass...
 
Quote:

Originally Posted by [X]-RayCat (Post 502004)
is_user_admin
client_print or amx_chat (team_say @)
get_cvar_string


help me pliz where and how i can put this code...

stupok 07-11-2007 16:34

Re: Change server pass...
 
This should do it:

Code:

/* AMXMOD X script.
*
* (c) Copyright 2007 Qlim4X
* This file is provided as is (no warranties).
*
* For #Pro.Gather in GrNet. Internal use only.
*
*/

#include <amxmod>
#include <amxmisc>

#define MAX_PLAYERS 32

public plugin_init()
{
        register_plugin("pro.gather ChangePass", "1.0", "qlim4x")
       
        register_concmd("pro_pass", "set_password", ADMIN_BAN, "<password>")
       
        register_cvar("sm_password", "scrim", FCVAR_ARCHIVE|FCVAR_PROTECTED)
}


public set_password(id, level, cid)
{
        if(!cmd_access(id, level, cid, 2))
                return PLUGIN_HANDLED
       
        new set_pass[32]
        read_argv(1, set_pass, 31)
       
        set_cvar_string("sv_password", set_pass )
        server_exec()
       
        for(new i = 1; i <= MAX_PLAYERS; i++)
        {
                if(is_user_admin(id))
                {
                        client_print(id, print_chat, "* sv_password changed to ^"%s^"", set_pass)
                }
        }
       
        return PLUGIN_HANDLED
}


Qlim4X 07-11-2007 17:31

Re: Change server pass...
 
thx for the help

but if i can use the client_print with team_say @ new pass is + set_pass

it would be more easy.....

what u thing??? it is possible???


ps1)client_print(id, print_chat, "* sv_password changed to ^"%s^"", set_pass)
print_chat to team_say @

ps2)how can i check if the set_pass is not null??? if it is null i want to change the pass to progather else the given in the args

Qlim4X 07-11-2007 22:08

Re: Change server pass...
 
again h change the code....


i can understand.... in the first 5-10 tries the script is working perfectly but after while the scripot doesnt work...

why??? what i do wrong???

Quote:

/* AMXMOD X script.
*
* (c) Copyright 2007 Qlim4X
* This file is provided as is (no warranties).
*
* For #Pro.Gather in GrNet. Internal use only.
*
*/
#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
register_plugin("pro.gather ChangePass","1.0","qlim4x")
register_concmd("pro_pass","set_password",ADM IN_BAN,"<password>")
return PLUGIN_CONTINUE
}


public set_password(id, level, cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new set_pass[32]
read_argv ( id, set_pass, 31 )
set_cvar_string ( "sv_password", set_pass )
return PLUGIN_HANDLED
}



|PJ| Shorty 07-11-2007 22:39

Re: Change server pass...
 
you should set
Code:

server_exec()
after
Code:


set_cvar_string("sv_password", set_pass)

wrong:
Code:

read_argv ( id, set_pass, 31 )
should be
Code:

read_argv ( 1, set_pass, 31 )
1 means: read the first argument after your command (0 would return your command)

Quote:

Originally Posted by Qlim4X
but if i can use the client_print with team_say @ new pass is + set_pass

not really understand...
you want to use the command with team_say? maybe with "say /pro_pass password"?

stupok 07-12-2007 00:14

Re: Change server pass...
 
It doesn't seem like you looked at what I wrote for you.

This does exactly what you want:

http://forums.alliedmods.net/showpos...68&postcount=5


There is no difference between team_say and print_chat. print_chat just sends a message to the chat instead of sending a message to the console or to the hud.

Qlim4X 07-12-2007 02:12

Re: Change server pass...
 
Quote:

/* AMXMOD X script.
*
* (c) Copyright 2007 Qlim4X
* This file is provided as is (no warranties).
*
* For #Pro.Gather in GrNet. Internal use only.
*
*/
#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
register_plugin("pro.gather ChangePass","1.0","qlim4x")
register_concmd("pro_pass","set_password",ADM IN_BAN,"<password>")
return PLUGIN_CONTINUE
}


public set_password(id, level, cid)
{
if(!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new set_pass[32]
read_argv ( 1, set_pass, 31 )
server_exec()
set_cvar_string ( "sv_password", set_pass )
client_print(id, print_chat, "Sv_Password Change To ^"%s^"", set_pass)
return PLUGIN_HANDLED
}
is this correct??? now

how can i check if the arg 1 is null or "" so the pass to be "progather" elshe the given in the argument...

and i want team say for the admin say command


All times are GMT -4. The time now is 21:27.

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