Page 1 of 1

Problema antilicenta addons csgo

Posted: 22 Jan 2019, 20:58
by Drake21
Salut, este vorba despre addons-ul CSGO Legacy (addon-uri/mod-legacy-arkxes-t359553.html), am incercat sa-i fac "antilicenta" (
| Afiseaza codul
#include amxmodx
#include sqlx

new Handle:g_SqlTuple;
new hasLicense;
new g_Error[512];

public plugin_init()
{
    register_plugin("CSGO License", "1.0", "SideWinder");
    return 0;
}

public plugin_precache()
{
    MySql_Init();
    return 0;
}

public plugin_natives()
{
    register_native("e6117f86f7fcfc7465552067c8491139", "native_e6117f86f7fcfc7465552067c8491139", 1);
    return 0;
}

public MySql_Init()
{
    g_SqlTuple = SQL_MakeDbTuple("", "", "", "");
    new ErrorCode = 0;
    new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, g_Error, 511);
    if (!SqlConnection)
    {
        set_fail_state(g_Error);
    }
    SQL_FreeHandle(SqlConnection);
    Load_MySql();
    return 0;
}

public plugin_end()
{
    SQL_FreeHandle(g_SqlTuple);
    return 0;
}

public Load_MySql()
{
    new szTemp[512];
    new Data[1];
    format(szTemp, 511, "SELECT * FROM `csgo_license` WHERE (`server_ip` = '%s')", "ip server");
    SQL_ThreadQuery(g_SqlTuple, "register_client", szTemp, Data, 1);
    return 0;
}

public register_client(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
	if (FailState == -2)
	{
		log_amx("Load - Could not connect to SQL database.  [%d] %s", Errcode, Error);
	}
	else
	{
		if (FailState == -1)
		{
			log_amx("Load Query failed. [%d] %s", Errcode, Error);
		}
	}
	if (1 > SQL_NumResults(Query))
	{
		hasLicense = 0;
	}
	else
	{
		hasLicense = 1;
	}
	return 1;
}

public IgnoreHandle(FailState, Handle:Query, String:Error[], Errcode, String:Data[], DataSize)
{
    SQL_FreeHandle(Query);
    return 1;
}

public native_e6117f86f7fcfc7465552067c8491139()
{
    return hasLicense;
}

public deb(id)
{
    client_print(id, print_chat, "%s %d", "ip server", hasLicense);
    return 0;
}
) si cand dau sa compilez plugin-ul primesc acest warning " warning 200: symbol "native_e6117f86f7fcfc7465552067" is truncated to 31 characters" la aceasta functie

public native_e6117f86f7fcfc7465552067c8491139()
{
return hasLicense;
}

Problema este urmatoarea, din cate am inteles acest warning apare din cauza ca functia respectiva depaseste 31 de caractere astefel micsoreaza acea functie ca sa nu mai dea acel warning. Din cauza acestui warning cand adaug pe server antilicenta primesc urmatoarea eroare in log-ul server-ului:

L 01/22/2019 - 19:16:29: Function "native_e6117f86f7fcfc7465552067c8491139" was not found
L 01/22/2019 - 19:16:29: [AMXX] Run time error 19 (plugin "csgo_license.amxx") - debug not enabled!
L 01/22/2019 - 19:16:29: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 01/22/2019 - 19:16:29: [AMXX] Run time error -1 (plugin "csgo_license.amxx") - debug not enabled!

Intrebarea mea este daca pot face cumva sa compilez plugin-ul respectiv fara sa mai dea acel warning (daca se poate marii cumva acea restrictie(mentionez ca am compilat pe localhost)).

Multumesc mult.

Re: Problema antilicenta addons csgo

Posted: 23 Jan 2019, 11:58
by levin

Code: Select all

#include <amxmodx>
#include <sqlx>

new Handle:g_SqlTuple;
new hasLicense;
new g_Error[512];

public plugin_init()
{
    register_plugin("CSGO License", "1.0", "SideWinder");
}

public plugin_precache()
{
    MySql_Init();
}

public plugin_natives()
{
    register_native("e6117f86f7fcfc7465552067c8491139", "native_x");
}

public MySql_Init()
{
    g_SqlTuple = SQL_MakeDbTuple("", "", "", "");
    new ErrorCode = 0;
    new Handle:SqlConnection = SQL_Connect(g_SqlTuple, ErrorCode, g_Error, 511);
    if (!SqlConnection)
    {
        set_fail_state(g_Error);
    }
    SQL_FreeHandle(SqlConnection);
    Load_MySql();
}

public plugin_end()
{
    SQL_FreeHandle(g_SqlTuple);
}

public Load_MySql()
{
    new szTemp[512];
    new Data[1];
    format(szTemp, 511, "SELECT * FROM `csgo_license` WHERE (`server_ip` = '%s')", "ip server");
    SQL_ThreadQuery(g_SqlTuple, "register_client", szTemp, Data, 1);
}

public register_client(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
	if (FailState == -2)
	{
		log_amx("Load - Could not connect to SQL database.  [%d] %s", Errcode, Error);
	}
	else
	{
		if (FailState == -1)
		{
			log_amx("Load Query failed. [%d] %s", Errcode, Error);
		}
	}
	if (1 > SQL_NumResults(Query))
	{
		hasLicense = 0;
	}
	else
	{
		hasLicense = 1;
	}
	return 1;
}

public IgnoreHandle(FailState, Handle:Query, String:Error[], Errcode, String:Data[], DataSize)
{
    SQL_FreeHandle(Query);
    return 1;
}

public native_x()
{
    return hasLicense;
}

public deb(id)
{
    client_print(id, print_chat, "%s %d", "ip server", hasLicense);
}

Re: Problema antilicenta addons csgo

Posted: 14 Aug 2019, 12:23
by Reycku
Plugin-ul ruleaza ...dar nu functioneaza meniul...
Am pus ce a dat LEVIN