AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved simple question - problem with setting pass with parm (https://forums.alliedmods.net/showthread.php?t=332639)

nacknic 05-24-2021 10:33

simple question - problem with setting pass with parm
 
Code:

        set_pcvar_string(cvar_Pass, pass) //get pass from another program
              .
              .
              .
        new spass[11]
        get_pcvar_string(cvar_Pass, spass, charsmax(spass))
        client_print(0, print_chat, "[AMX] pass = %s", spass) //print the right pass
        server_cmd("sv_password '%s'", trim(spass))

the pass not correct

jimaway 05-24-2021 10:47

Re: simple question - problem with setting pass with parm
 
set sv_password with set_pcvar_string() not with server_cmd()

nacknic 05-24-2021 12:28

Re: simple question - problem with setting pass with parm
 
thank this work for me :
Code:

#include <amxmodx>

new sv_password
public plugin_init() {
        sv_password = get_cvar_pointer("sv_password")
        register_clcmd("say !setpass", "set_pass")
}

public set_pass() {
        new sPassword[16]
        sPassword = "123"
        set_pcvar_string(sv_password, sPassword)
}



All times are GMT -4. The time now is 02:32.

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