AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_authid doesnt return steamid (https://forums.alliedmods.net/showthread.php?t=45674)

mrcoffee 10-08-2006 17:33

get_user_authid doesnt return steamid
 
I'm trying to make a plugin that will add players steamid's to a sql DB. The problem I'm having is that get_user_authid will only return "83" instead of "STEAM_X:X:XXXXXX". I know that the players steamid's arn't pending as other plugins that grab their id's are working fine. The code (below) is pretty simple so does anyone have any solutions or ideas as to why the function isn't working properly?

Code:

#include <amxmodx>
#include <amxmisc>
#include <dbi>

#define PLUGIN "Regs register"
#define VERSION "1.0"
#define AUTHOR "mrcoffee"

#define    REG_PLAYER    ADMIN_LEVEL_G
new Sql:dbc
new config_dir[256]
new connect_detail[4][32]
new userid[32]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    // DB parameters
    register_srvcmd("amx_regsregister_connect", "get_login")
   
    get_configsdir(config_dir, 255)
    server_cmd("exec %s/regsregister.cfg", config_dir)
    set_task(0.1,"connect_db")
}


public get_login()
{
    if (read_argc() != 5)
    {
        log_amx("Invalid amx_regsregister_connect format")
        return 0
    }
    read_argv(1, connect_detail[0], 31)
    read_argv(2, connect_detail[1], 31)
    read_argv(3, connect_detail[2], 31)
    read_argv(4, connect_detail[3], 31)
    return 1
}


public connect_db()
{   
    dbc = dbi_connect(connect_detail[0],connect_detail[1],connect_detail[2],connect_detail[3])
    if (dbc < SQL_OK)
    {
        new error[255]
        new error_num = dbi_error(dbc,error,254)
        server_print("Connection to regs register DB failed: (%d) %s", error_num, error)
        log_amx("connection to regs register DB failed: (%d) %s", error_num, error)
    }
    else
    {
        server_print("Connected to regs register DB ")
        log_amx("Connected to regs register DB")
    }
}


public client_putinserver(id)
{
    if (access(id, REG_PLAYER))
    {
        if (get_cvar_num("sv_regsonly") == 1 || get_cvar_num("sv_regsonly") == 2)
        {
            set_task(15.0, "get_steamid", id)
        }
    }
}

public client_disconnect(id)
{
    remove_task(id)
}

public get_steamid(id)
{
    get_user_authid(id, userid,31)
    dbi_query(dbc,"INSERT INTO regs_register VALUES ('',NOW(),'%d')",userid)
    client_print(0,print_chat,"authid %d and id %i inserted into DB",userid,id)
}


jRaven 10-08-2006 17:54

Re: get_user_authid doesnt return steamid
 
Try changing get_steamid()'s:

Code:
client_print(0,print_chat,"authid %d and id %i inserted into DB",userid,id)

to

Code:
client_print(0,print_chat,"authid %s and id %i inserted into DB",userid,id)

Change was %d to %s.
Do the same for other format() like things. Ex: the SQL line.

Edit: More info in funcwiki about format().

mrcoffee 10-08-2006 19:14

Re: get_user_authid doesnt return steamid
 
That seems to have done the job, thanks a lot!


All times are GMT -4. The time now is 04:53.

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