Raised This Month: $64 Target: $400
 16% 

Not finding cfg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kdinhx
Junior Member
Join Date: Jul 2018
Old 11-07-2018 , 06:40   Not finding cfg
Reply With Quote #1

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 StringldVal[], 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);
}
}

Last edited by kdinhx; 11-07-2018 at 07:56.
kdinhx is offline
kdinhx
Junior Member
Join Date: Jul 2018
Old 11-07-2018 , 08:10   Re: Not finding cfg
Reply With Quote #2

I got it!
kdinhx is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Location: de_alliedmods
Old 11-07-2018 , 08:17   Re: Not finding cfg
Reply With Quote #3

Quote:
Originally Posted by kdinhx View Post
I got it!
how did you do it?
iskenderkebab33 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:28.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode