Raised This Month: $32 Target: $400
 8% 

How to correctly execute a cfg file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 04-29-2017 , 12:20   How to correctly execute a cfg file
Reply With Quote #1

hi everyone,
okay i've tried a couple of ways to execute config files but sometimes they just seem not to work and sometimes it get message like server cannot execute chosen cfg file or just act like its missing ..
so here is how i did it and it's kind of wired to me cause it does work for some other plugins:
PHP Code:
char Cfgname[32];
Cfgname"cfg/files/file.cfg";
ServerCommand("exec %s"Cfgname);
PrintToServer("[SM] CFG File has been executed!"); 
so it does not work sometimes and i don't know why and i probably tried this seconds way but it seems still nothing:
PHP Code:
stock void ExecuteCfg(char[] Path)
{
    
Handle hFile OpenFile(Path"r");
    
char PathOfFile[256];
    while(!
IsEndOfFile(hFile) && ReadFileLine(hFilePathOfFilesizeof(PathOfFile)))
    {
        
ServerCommand(PathOfFile);
        
PrintToServer("[SM] Command %s Executed."PathOfFile);
    }
    
CloseHandle(hFile);

and just ExecuteCfg(Cfgname);
and i see it's not working cause it's not showing the PrintToServer Message.
what i'm saying is how to do it without such errors and 100% working, thank you.
Note: i'm pretty sure that cfg file exists.
__________________

Last edited by ambn; 04-29-2017 at 12:21.
ambn is offline
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Old 04-29-2017 , 14:22   Re: How to correctly execute a cfg file
Reply With Quote #2

Should be like this:

PHP Code:
char Cfgname[32];
Cfgname"files/file.cfg";
ServerCommand("exec %s"Cfgname);
PrintToServer("[SM] CFG File has been executed!"); 
__________________
Chaosxk is offline
Reply



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 13:06.


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