AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_info does not work... (https://forums.alliedmods.net/showthread.php?t=29977)

Opik 06-19-2006 18:58

get_user_info does not work...
 
Code:

public cmdip(id, level, cid)
{
        if (!cmd_access(id, level, cid, 2))
                return PLUGIN_HANDLED
       
        new arg[32], name[32], ip[40], name2[32]
       
        read_argv(1, arg, 31)
       
        new player = cmd_target(id, arg, 5)
       
        if (!player)
                return PLUGIN_HANDLED

        get_user_name(player, name, 31)       
        get_user_info(player, "net_address", ip, 40)  // it not working
        get_user_info(player, "name", name2, 40)  // it works

        console_print(id, "%s net_address is: %s", name, ip)
        return PLUGIN_HANDLED
}

Result is:
Quote:

Opik net_address is:
Dont offer me use get_user_ip.

teame06 06-19-2006 20:45

get_user_info will only display certain things. It will not work for net_address. I believe net_address is only a serverside setting. Your only way is get_user_ip but you don't want that option.

If you do a setinfo on your client cs console. Then those are the are one you can get

Opik 06-20-2006 04:27

How I can see, net_address in client console return local IP address. How I can get this?
client_cmd does not return a value.

Any opinions?

VEN 06-20-2006 04:35

Quote:

I believe net_address is only a serverside setting. Your only way is get_user_ip
Also you can probably get client "ip" CVAR value using query_client_cvar native (more info: http://www.amxmodx.org/funcwiki.php)

Opik 06-20-2006 05:00

Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    register_plugin("new ban system 2", "0.1", "Opik");
    register_concmd("amx_ip2", "cmdip", ADMIN_BAN, "<name or #userid>")
}


public cmdip(id, level, cid)
{
        if (!cmd_access(id, level, cid, 2))
                return PLUGIN_HANDLED

        new arg[32]

        read_argv(1, arg, 31)

        new player = cmd_target(id, arg, 5)

        if (!player)
                return PLUGIN_HANDLED

        if (!is_user_bot(player)) query_client_cvar(player, "net_address", "cvar_result_func", id);
        return PLUGIN_HANDLED
}

public cvar_result_func(id, const cvar[], const value[], test)
{
    new name[32];
    get_user_name(id, name, 31);

    console_print(test, "%s local ip is: %s", name, value)
}

hlds crashes:
Quote:

./hlds_run: line 342: 16157 Segmentation fault (core dumped) $HL_CMD
gdb: Symbol `emacs_ctlx_keymap' has different size in shared object, consider re-linking
"/home/tpyn/opik/CWSERVER/core.16157" is not a core dump: File truncated
debug.cmds:1: Error in sourced command file:
No stack.
debug.log:
Quote:

CRASH: Tue Jun 20 11:53:04 EEST 2006
Start Line: ./hlds_i686 -game cstrike -debug +sv_lan 1 +map de_dust2 +maxplayers 18 +port 27020 -pingboost 2 + mapchangecfgfile server.cfg -nomaster -pidfil$
Using host libthread_db library "/lib/tls/libthread_db.so.1".
End of crash report


Opik 06-20-2006 12:08

Where is problem?

PM 06-20-2006 13:26

Is your HLDS up-to-date?


All times are GMT -4. The time now is 08:03.

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