Raised This Month: $ Target: $400
 0% 

read from file and print in chat


Post New Thread Reply   
 
Thread Tools Display Modes
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-01-2007 , 13:58   Re: read from file and print in chat
Reply With Quote #11

Please explain to me how you believe your code will fix anything, other than give the server access to execute the command?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
|PJ| Shorty
Veteran Member
Join Date: Aug 2005
Location: Bavaria, Germany
Old 08-01-2007 , 22:29   Re: read from file and print in chat
Reply With Quote #12

not tested, please try
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"
#define MAX_LINELEN 31 //max chars per line
#define MAX_TEXTLEN 255 //max chars for output
new configsDir[128]
public plugin_init() {
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_concmd("command","print_file_to_chat",ADMIN_KICK)
 
 get_configsdir(configsDir, 127)
 format(configsDir, 127, "%s/text.txt", configsDir) //place file in /amxmodx/configs/
}
public print_file_to_chat(id) {
 if (!file_exists(configsDir)) //file is in right place?
 {
  console_print(id, "File ^"%s^" doesn't exist.", configsDir)
  return
 }
 new text[MAX_TEXTLEN+1]
 
 new line = 0, textline[MAX_LINELEN+1], len
  
 while ((line = read_file(configsDir, line, textline, MAX_LINELEN, len)))
 {
  trim(textline)
  if (textline[0]) {
   format(text,MAX_TEXTLEN,"%s %s",text,textline)
  }
 }
 client_print(id,print_chat,"* %s",text)
}
__________________
There are only 10 types of people in the world:
Those who understand binary, and those who donīt.
|PJ| Shorty is offline
Send a message via ICQ to |PJ| Shorty Send a message via AIM to |PJ| Shorty Send a message via MSN to |PJ| Shorty Send a message via Yahoo to |PJ| Shorty Send a message via Skype™ to |PJ| Shorty
Ltv
Junior Member
Join Date: Jul 2007
Old 08-02-2007 , 09:25   Re: read from file and print in chat
Reply With Quote #13

It's working!
Thanks everyone who tried to help me!
Ltv 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 04:31.


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