[CSGO] AlfaLoader - Config Executor

Post Reply
User avatar
Andreeas
Hero Member
Hero Member
Posts: 601
Joined: Wed Jan 22, 2020 8:17 pm
Jucator SA:MP ?: Nu
Nick:: Andreeas
Jucator CS ?: Nu

[CSGO] AlfaLoader - Config Executor

Post by Andreeas »

Description:
Well, today i will realease a CSGO plugin to load configs that are in the folder configs/configexecutor.cfg or in configexecutor/configs.cfg!

Plugin Info:
The plugin have 2 languages:

-> English
-> Portuguese

Plugin Sourcecodes:

English Version Code:

Code: Select all

/*************************************************************************
*                                                                        *
*                      AlfaLoader - Config Executor                      * 
*                            Author: ShutUP                              *
*                             Version: 1.0                               *
*                                                                        *
**************************************************************************/

#include <sourcemod>

public Plugin myinfo = 
{
    name = "[SM] AlfaLoader",
    author = "ShutUP",
    description = "Config Executer for CSGO Servers",
    version = "1.0",
    url = "https://alfahosting.gq/plugins/csgo/configexecuter"
}

public OnPluginStart()
{
    CreateConVar("sm_executorversion", "1.0", "Show the version of the plugin", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    RegAdminCmd("sm_executeconfigs_all", CmdReExecute, ADMFLAG_GENERIC, "Execute the config files insile the folder");
    PrintToServer("Plugin maked by ShutUP with love");
}

public OnMapStart()
{
    ExecuteAllConfigs();
}

stock bool ExecuteAllConfigs()
{
    new Float:time = 0.0;
    new Handle:file = INVALID_HANDLE;    
    decl String:FileName[256], String:ConfigName[256];
    BuildPath(Path_SM, FileName, sizeof(FileName), "configexecutor/config.cfg");    
    new len;
    if(!FileExists(FileName))
    {
        LogError("Error loading the config files");
        return false;
    }
    file = OpenFile(FileName, "r");
    if(file == INVALID_HANDLE)
    {
        LogError("Error loading the config files");
        return false;
    }
    
    while(ReadFileLine(file, ConfigName, sizeof(ConfigName)))
    {
        len = strlen(ConfigName);
        if (ConfigName[len-1] == 'n')
        {
            ConfigName[--len] = '0';
        }
        if(StrEqual(ConfigName, ""))
        {
            continue;
        }
        time+=0.1;
        new Handle:pack = CreateDataPack();
        WritePackString(pack, ConfigName);
        CreateTimer(time, ExecuteConfig, pack, TIMER_FLAG_NO_MAPCHANGE);
        if(IsEndOfFile(file))
        {
            break;
        }
    }
    CloseHandle(file);
    return true;
}

public Action CmdReExecute(client, args)
{
    if(ExecuteAllConfigs())
    {
        PrintToChat(client, "[AlfaLoader] All configs are been executed!");
    }
    else
    {
        PrintToChat(client, "[AlfaLoader] An error ocurred while executing the files!");
    }
    return Plugin_Handled;
}

public Action ExecuteConfig(Handle timer, Handle pack)
{
    ResetPack(pack);
    decl String:config[256];
    ReadPackString(pack, config, sizeof(config));
    ServerCommand("exec sourcemod/%s", config);
} 
// THIS CONFIG IS FOR CSGO NOSPREAD SERVER!
sv_cheats 1
weapon_accuracy_nospread "1"
weapon_debug_spread_gap "1"
weapon_recoil_cooldown "0"
weapon_recoil_decay1_exp "99999"
weapon_recoil_decay2_exp "99999"
weapon_recoil_decay2_lin "99999"
weapon_recoil_scale "0"
weapon_recoil_suppression_shots "500"
weapon_recoil_view_punch_extra 0
sv_cheats 0

Download
Post Reply

Return to “Server Management”