AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Not finding cfg (https://forums.alliedmods.net/showthread.php?t=311902)

kdinhx 11-07-2018 05:40

Not finding cfg
 
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:oldVal[], 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);
}
}

kdinhx 11-07-2018 07:10

Re: Not finding cfg
 
I got it!

iskenderkebab33 11-07-2018 07:17

Re: Not finding cfg
 
Quote:

Originally Posted by kdinhx (Post 2622976)
I got it!

how did you do it?


All times are GMT -4. The time now is 10:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.