Hello, I am trying to make another plugin that I write in the command, but it is not finding the cfg of the "!unloadpevent" command, help me ;-;
#define PLUGIN_AUTHOR "Ricardo"
#define PLUGIN_VERSION "1.0"
#include <sourcemod>
#include <sdktools>
new String:EventCvarPluON[32];
new String:EventCvarPluOFF[32];
new Handle:g_EventCvarPluON;
new Handle:g_EventCvarPluOFF;
public Plugin myinfo =
{
name = "Comandos Server'",
author = PLUGIN_AUTHOR,
description = "Comandos para servidores'",
version = PLUGIN_VERSION,
url = "sourcemod.net"
};
public OnPluginStart()
{
CreateConVar("comandos_versao", PLUGIN_VERSION, "Versao do Plugin");
g_EventCvarPluON = CreateConVar("event_on_cfg", "cvarplugin/loadpevent.cfg", "Load Plugins Eventscript");
g_EventCvarPluOFF = CreateConVar("event_off_cfg", "cvarplugin/unloadpevent.cfg", "Unload Plugins Eventscript");
GetConVarString(g_EventCvarPluON, EventCvarPluON, sizeof(EventCvarPluON));
GetConVarString(g_EventCvarPluOFF, EventCvarPluOFF, sizeof(EventCvarPluOFF));
HookConVarChange(g_EventCvarPluON, StringChange);
HookConVarChange(g_EventCvarPluOFF, StringChange);
decl String:folder[128] = "";
AutoExecConfig(true, "cvarplugin/cvarsconfig", folder);
RegAdminCmd("sm_loadpevent", Comando_LoadPEvent, ADMFLAG_SLAY);
RegAdminCmd("sm_unloadpevent", Comando_UnloadPEvent, ADMFLAG_SLAY);
}
public StringChange(Handle:cvar, const String
ldVal[], const String:newVal[])
{
GetConVarString(g_EventCvarPluON, EventCvarPluON, sizeof(EventCvarPluON));
GetConVarString(g_EventCvarPluOFF, EventCvarPluOFF, sizeof(EventCvarPluOFF));
}
public Action:Comando_LoadPEvent(client, args)
{
LoadCfg(EventCvarPluON);
PrintToChatAll("\x04Os plugins do EventScript foram ativados!.");
return Plugin_Handled;
}
public Action:Comando_UnloadPEvent(client, args)
{
LoadCfg(EventCvarPluOFF);
PrintToChatAll("\x04Os plugins do EventScript foram desativados!.")
return Plugin_Handled;
}
LoadCfg(String:cfg[])
{
decl String:cfgexiste[32];
Format(cfgexiste, sizeof(cfgexiste), "/cfg/cvarplugin/%s", cfg);
if(FileExists(cfgexiste))
{
ServerCommand("exec %s", cfg);
PrintToServer("%s carregado com sucesso.", cfg);
}else
{
PrintToServer("ERROR: %s nao encontrado", cfg);
}
}