ok, I found a different way to do it, but I dont know if it will work, and I dont have anyway to test it right now. Can anyone spot anyhting bad, or can test this for me or anything.
Here is my new way. I stole loading from superhero, so it has a different while() loop.
Code:
#include <amxmodx>
#include <amxmisc>
#define MAXLINES 11
new file[128];
new readLine = 0;
new lengthRead;
new data[1024];
new MsgSayText;
new ads[MAXLINES][192]
new total_lines;
public plugin_init() {
register_plugin("Message Display", "1.0", "Rolnaaba");
register_cvar("msg_delay", "120.0"); //how long between each message (seconds)
MsgSayText = get_user_msgid("SayText");
load_message();
set_task(get_cvar_float("msg_delay"), "display_message", 0, "", 0, "b");
}
public load_message() {
get_configsdir(file, 127);
formatex(file, 127, "%s/message.ini", file);
if(!file_exists(file)) {
log_amx("Unable to find message.ini, Plugin Failed. Please place message.ini into your configs folder!");
set_fail_state("Unable to find message.ini, Plugin Failed. Please place message.ini into your configs folder!");
}
while((readLine = read_file(file, readLine, data, 1023, lengthRead)) != 0) {
if(equal(data[0], ";")) continue;
data[191] = '^0'
copy(ads[readLine], 191, data);
total_lines++;
}
}
public display_message() {
new players[32], num;
get_players(players, num);
for(new i; i <= total_lines; i++) {
message_begin(MSG_BROADCAST, MsgSayText);
write_byte(0);
write_string(ads[i]);
message_end();
}
}
__________________