Jump to content

[Plugin-RF] Plugin Platforma DROP


LondoN eXtream

Recommended Posts

Descriere: Acest plugin trimite jucatori catre o lista de servere, luata din SQL.

M-am decis sa fac public versiunea 1.0, deoarece findca vreau.

Apasati 'Like This' daca va place.

 

Nume: [AMXX] Random Drop

Autor: dK^aLeX

Versiune : 1.0

 

Instalare:

AMX_DROP_PLATFORM.sma -> scripting

AMX_DROP_PLATFORM.amxx -> plugins

Mergem in plugins.ini si adaugam:

AMX_DROP_PLATFORM.amxx

 

Download:

#include <amxmodx>
#include <amxmisc>
#include <sqlx>

new const iHost[] = "localhost"
new const iUser[] = "drop_platform"
new const iPass[] = "drop_platform"
new const iDb[] = "drop_platform_drop"

#define BOOSTED_SERVERS     10

new Handle:szSQLTuple
new iCount = 0, iServer = 0, iDrops = 0
new ServerList[bOOSTED_SERVERS][32]

public plugin_init()
{
    register_plugin("[AMXX] Drop Platform", "1.0", "dK^aLeX")
    
    szSQLTuple = SQL_MakeDbTuple(iHost, iUser, iPass, iDb, 10)
    
    set_task(1.0 * 60, "RefreshList", .flags="b")
    
    register_concmd("_boosted", "ShowBoostedServers")
}

public ShowBoostedServers(id)
{
    for(new i = 0, n = 0; i < BOOSTED_SERVERS; i++)
    {
        if(strlen(ServerList) > 0)
        {
            server_print("[AMXX] NAME | IP")
            server_print("%d | %s", n + 1, ServerList)
            n++
        }
    }
    return PLUGIN_HANDLED;
}

public plugin_cfg()
{
    InitServers();
}

public InitServers()
{
    static SQL[256]
    
    formatex(SQL, charsmax(SQL), "SELECT `server` FROM `server_list` ORDER BY `id` DESC LIMIT %d", BOOSTED_SERVERS)
    SQL_ThreadQuery(szSQLTuple, "SQLInit", SQL)
}

public SQLInit(FailState, Handle:Query, szError[], Errcode)
{
    if(iCount)
    {
        iCount = 0
    }
    
    static Data[32]
    get_time("%d/%m/%y - %H:%M:%S", Data, 31)
    
    server_print("[%s] - Getting server list.", Data)
    
    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(ServerList, 31, "%s", Server)
        SQL_NextRow(Query)
        i++
        iCount++
    }
    
    SQL_FreeHandle(Query)
}

public client_connect(id)
{
    if(is_user_bot(id) && is_user_hltv(id))
    {
        server_cmd("kick #%d", id)
        return PLUGIN_HANDLED;
    }
    
    RedirectUsers(id)
    return PLUGIN_HANDLED;
}

public  client_putinserver(id)
{
if(is_user_bot(id) && is_user_hltv(id))
{
server_cmd("kick #%d", id)
return PLUGIN_HANDLED;
}

set_task(3.0, "RedirectUsers", id)
return PLUGIN_CONTINUE;
}

public RedirectUsers(id)
{
iDrops++

static szServer[32], szName[32]

formatex(szServer, 31, "%s", ServerList[iServer]);
get_user_name(id, szName, charsmax(szName))

if(strlen(szServer) == 0)
{
client_cmd(id, "wait;wait;wait;disconnect")
return PLUGIN_HANDLED;
}

client_cmd(id, "wait;wait;wait; connect %s", szServer)
server_print("[AMXX] Client %s redirected to %s", szName, szServer)

iServer = (iServer >= iCount - 1 ? 0 : (iServer + 1));
return PLUGIN_HANDLED;
}

public QueryStatus(FailState, szError[], Errcode)
{
if(FailState == TQUERY_CONNECT_FAILED)
{
write_file("addons/amxmodx/szLogsDrop/Errors.log", "[AMXX] A aparut o eroare! Inchidem sistemul!")
}

if(FailState == TQUERY_QUERY_FAILED)
{
write_file("addons/amxmodx/szLogsDrop/Errors.log", "[AMXX] A aparut o erroare [2]! Abordare!")
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

 

  • Like 3
Link to comment
Share on other sites

  • 1 month later...

Dc nu poti pune intr-un RAR ? Si pui linkul de download, asa e mai greu, nici nu stiu ce sa fac..

Deschizi un Notepad poate sa fie si ++ si Copiezi din Spoiler Acesta. 

#include <amxmodx>

#include <amxmisc>
#include <sqlx>
 
new const iHost[] = "localhost"
new const iUser[] = "drop_platform"
new const iPass[] = "drop_platform"
new const iDb[] = "drop_platform_drop"
 
#define BOOSTED_SERVERS     10
 
new Handle:szSQLTuple
new iCount = 0, iServer = 0, iDrops = 0
new ServerList[bOOSTED_SERVERS][32]
 
public plugin_init()
{
    register_plugin("[AMXX] Drop Platform", "1.0", "dK^aLeX")
    
    szSQLTuple = SQL_MakeDbTuple(iHost, iUser, iPass, iDb, 10)
    
    set_task(1.0 * 60, "RefreshList", .flags="b")
    
    register_concmd("_boosted", "ShowBoostedServers")
}
 
public ShowBoostedServers(id)
{
    for(new i = 0, n = 0; i < BOOSTED_SERVERS; i++)
    {
        if(strlen(ServerList) > 0)
        {
            server_print("[AMXX] NAME | IP")
            server_print("%d | %s", n + 1, ServerList)
            n++
        }
    }
    return PLUGIN_HANDLED;
}
 
public plugin_cfg()
{
    InitServers();
}
 
public InitServers()
{
    static SQL[256]
    
    formatex(SQL, charsmax(SQL), "SELECT `server` FROM `server_list` ORDER BY `id` DESC LIMIT %d", BOOSTED_SERVERS)
    SQL_ThreadQuery(szSQLTuple, "SQLInit", SQL)
}
 
public SQLInit(FailState, Handle:Query, szError[], Errcode)
{
    if(iCount)
    {
        iCount = 0
    }
    
    static Data[32]
    get_time("%d/%m/%y - %H:%M:%S", Data, 31)
    
    server_print("[%s] - Getting server list.", Data)
    
    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(ServerList, 31, "%s", Server)
        SQL_NextRow(Query)
        i++
        iCount++
    }
    
    SQL_FreeHandle(Query)
}
 
public client_connect(id)
{
    if(is_user_bot(id) && is_user_hltv(id))
    {
        server_cmd("kick #%d", id)
        return PLUGIN_HANDLED;
    }
    
    RedirectUsers(id)
    return PLUGIN_HANDLED;
}
 
public  client_putinserver(id)
{
if(is_user_bot(id) && is_user_hltv(id))
{
server_cmd("kick #%d", id)
return PLUGIN_HANDLED;
}
 
set_task(3.0, "RedirectUsers", id)
return PLUGIN_CONTINUE;
}
 
public RedirectUsers(id)
{
iDrops++
 
static szServer[32], szName[32]
 
formatex(szServer, 31, "%s", ServerList[iServer]);
get_user_name(id, szName, charsmax(szName))
 
if(strlen(szServer) == 0)
{
client_cmd(id, "wait;wait;wait;disconnect")
return PLUGIN_HANDLED;
}
 
client_cmd(id, "wait;wait;wait; connect %s", szServer)
server_print("[AMXX] Client %s redirected to %s", szName, szServer)
 
iServer = (iServer >= iCount - 1 ? 0 : (iServer + 1));
return PLUGIN_HANDLED;
}
 
public QueryStatus(FailState, szError[], Errcode)
{
if(FailState == TQUERY_CONNECT_FAILED)
{
write_file("addons/amxmodx/szLogsDrop/Errors.log", "[AMXX] A aparut o eroare! Inchidem sistemul!")
}
 
if(FailState == TQUERY_QUERY_FAILED)
{
write_file("addons/amxmodx/szLogsDrop/Errors.log", "[AMXX] A aparut o erroare [2]! Abordare!")
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

Si dai Paste dupa dai Save As ->> si il pui in .sma cu o denumire. 

Ex: platform-drop.sma. Dupa Copilezi toate pluginurile, si cauti tot in .sma Un folder Numit "Compiled" dai click pe el, mai jos ai Pluginuri .amxx.

De acolo trb sa scoti Ex care ti l-am dat eu: platform-drop.sma doarca acolo se afla .amxx, si scoti fisierul ala si te duci in Fisierul "Plugin". dai paste, Si iar te duci in Configs -> plugins.ini si pune mai jos exemplu meu: platform-drop.amxx . Dai Restart la Server si gata ai Pluginu.

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...