Raised This Month: $ Target: $400
 0% 

Load config file?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fixed
Member
Join Date: Feb 2010
Old 03-03-2010 , 13:51   Load config file?
Reply With Quote #1

I want to load a .ini file to a client_print how do I do that?
__________________
fixed is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-03-2010 , 15:43   Re: Load config file?
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?t=46218
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fixed
Member
Join Date: Feb 2010
Old 03-03-2010 , 16:00   Re: Load config file?
Reply With Quote #3

Thanks, gotta check it out
__________________
fixed is offline
fixed
Member
Join Date: Feb 2010
Old 03-03-2010 , 16:08   Re: Load config file?
Reply With Quote #4

Im new to scripting in amxx so it is hard to convert it to what I want.
I want people to write something in a .ini file and then if u example type /text the text you wrote in the .ini file should show up when u type that.
__________________
fixed is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-03-2010 , 18:23   Re: Load config file?
Reply With Quote #5

How many different lines are you looking to have in the .ini file?
__________________
fysiks is offline
fixed
Member
Join Date: Feb 2010
Old 03-04-2010 , 11:48   Re: Load config file?
Reply With Quote #6

hmm 3 lines
__________________
fixed is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 03-04-2010 , 12:17   Re: Load config file?
Reply With Quote #7

Here's something similar to what you need. You could also provide us with more info, like how often will you load the text and if the text in file can somehow be changed during the game. Your file with text should be located in amxmodx/configs/text.ini by default.
PHP Code:
#include <amxmodx>
#include <amxmisc>
 
new g_szFile[64];
 
public 
plugin_init()
{
        
get_configsdir(g_szFile63);
        
add(g_szFile63"/text.ini"); // Change "text" to whatever your file name is
}
 
public 
fnLoadText() // This is the function you'll use when you want to load the text from your file
{
        new 
pFile fopen(g_szFile"r");
 
        if (!
pFile)
                return;
 
        new 
szText[256]; // Not sure what max length should I use
 
        
while (!feof(pFile))
        {
                
fgets(pFileszText255);
                
trim(szText);
 
                if (!
strlen(szText))
                        continue;
 
                switch (
szText[0])
                {
                        case 
'/':
                                if (
szText[1] == '/')
                                        continue;
                        case 
';':
                                continue;
                }
 
                
client_print(0print_chatszText);
        }
 
        
fclose(pFile);

__________________

Last edited by hleV; 03-04-2010 at 12:23.
hleV is offline
fixed
Member
Join Date: Feb 2010
Old 03-04-2010 , 12:55   Re: Load config file?
Reply With Quote #8

THANKS man but when I type too mush it makes a new line but it isnt in color? Do u know how to fix that?
__________________
fixed is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-04-2010 , 15:09   Re: Load config file?
Reply With Quote #9

It uses client_print( ), which defaults to the yellow color and cannot change colors.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fixed
Member
Join Date: Feb 2010
Old 03-04-2010 , 15:20   Re: Load config file?
Reply With Quote #10

I know but I changed it to colorchat
__________________
fixed 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 08:43.


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