Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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("tot plm", "plm", "parola", "plm", 0);
- 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')", "89.39.14.83");
- 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", "89.39.14.83", hasLicense);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement