Страница 1 от 1

Gungame Stats Fix?

Публикувано на: 04 Яну 2019, 13:01
от Infamous2018
Hello, can anyone fix this problem ?

Код за потвърждение: Избери целия код

L 01/04/2019 - 11:59:56: Invalid CVAR pointer
L 01/04/2019 - 11:59:56: [AMXX] Displaying debug trace (plugin "gungamestats.amxx", version "2.0")
L 01/04/2019 - 11:59:56: [AMXX] Run time error 10: native error (native "get_pcvar_string")
L 01/04/2019 - 11:59:56: [AMXX]    [0] gungamestats.sma::sql_init (line 34)
Sma:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <sqlx>

#define PLUGIN "GunGame Stats"
#define VERSION "2.0"
#define AUTHOR "GmStaff"

new gg_sql_host, gg_sql_user, gg_sql_pass, gg_sql_db, gg_sql_table
new gg_stats_invalid_steam

new Handle:tuple, Handle:db

new g_query[512]
new g_sqlTable[32]

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	gg_sql_host = get_cvar_pointer("37.59.43.196")
	gg_sql_user = get_cvar_pointer("gungame")
	gg_sql_pass = get_cvar_pointer("")
	gg_sql_db = get_cvar_pointer("gungame")
	gg_sql_table = get_cvar_pointer("gg_sql_table")
	
	gg_stats_invalid_steam = register_cvar("gg_stats_invalid_steam", "'STEAM_ID_LAN', 'STEAM_ID_PENDING', 'VALVE_ID_LAN', 'VALVE_ID_PENDING'")
	
	set_task(1.5, "sql_init")
}

public sql_init()
{
	new host[32], user[32], pass[32], dbname[32]
	get_pcvar_string(gg_sql_host,host,31)
	get_pcvar_string(gg_sql_user,user,31)
	get_pcvar_string(gg_sql_pass,pass,31)
	get_pcvar_string(gg_sql_db,dbname,31)

	new sqlErrorCode, sqlError[1024]
	
	
	tuple = SQL_MakeDbTuple(host,user,pass,dbname)
	
	if(tuple == Empty_Handle)
	{
		log_amx("Could not create database tuple. Error #%i: %s",sqlErrorCode,sqlError)
		return
	}
	
	db = SQL_Connect(tuple,sqlErrorCode,sqlError,1023)

	if(db == Empty_Handle)
	{
		log_amx("Could not connect to database. Error #%i: %s",sqlErrorCode,sqlError)
		return
	}
	
	SQL_FreeHandle(db)
	
	get_pcvar_string(gg_sql_table,g_sqlTable,31)
	
	formatex(g_query, charsmax(g_query), "ALTER TABLE  `%s` ADD  `rank` INT NOT NULL DEFAULT  '0'", g_sqlTable)
	SQL_ThreadQuery(tuple, "threadQueryHandler", g_query, "1", 2)
}

public threadQueryHandler(failstate,Handle:query,error[],errnum,data[],size,Float:queuetime)
{
	static status
	if (!status)
	{
		status = 1
		new invalid_steam[256]
		get_pcvar_string(gg_stats_invalid_steam, invalid_steam, charsmax(invalid_steam))
		formatex(g_query, charsmax(g_query), "SET @r = 0;UPDATE `%s` SET `rank` = (@r := @r + 1) WHERE `authid` NOT IN (%s) ORDER BY `wins` DESC, `points` DESC", g_sqlTable, invalid_steam)
		SQL_ThreadQuery(tuple, "threadQueryHandler", g_query)
	}
	else
	{
		SQL_FreeHandle(tuple)
	}
}

Gungame Stats Fix?

Публикувано на: 04 Яну 2019, 16:19
от OciXCrom
What are these things?

Код за потвърждение: Избери целия код

gg_sql_host = get_cvar_pointer("37.59.43.196")
gg_sql_user = get_cvar_pointer("gungame")
gg_sql_pass = get_cvar_pointer("")
gg_sql_db = get_cvar_pointer("gungame")
The things in quotes should be actual cvar names - this is totally incorrect and I don't know which cvars need to be put there.

Gungame Stats Fix?

Публикувано на: 04 Яну 2019, 17:03
от Infamous2018
Okay, no problem :)

Gungame Stats Fix?

Публикувано на: 04 Яну 2019, 17:11
от OciXCrom
The cvar names are probably in the main GunGame file. If you can find them, I can fix it.

Gungame Stats Fix?

Публикувано на: 04 Яну 2019, 18:41
от Infamous2018

Gungame Stats Fix?

Публикувано на: 05 Яну 2019, 15:57
от OciXCrom
There are no cvars in that plugin. It uses an .ini file.