Автор: [N][E][M][E][C]
Описание: Данный плагин дает возможность посылать сообщения в чат с интервалом времени!
Максимальное количество сообщений 10
- Код: Выделить всё
#include <amxmodx>
#define TRUE_LEN 0x10
#define MAX_LEN 192
#define MAX_FILE 10 //максимальное количество рекламных сообщений
new const Float:fTime = 30.0;
new g_sString[MAX_FILE][MAX_LEN +1];
new g_iCountString;
public plugin_init() {
new const szName[] = "[N][E][M][E][C]";
register_plugin("Set Message", "rz 0.4", .author = szName);
if(!Confirmation_Authorship(szName, TRUE_LEN))
server_print("Error: Assigned authorship");
load_config();
set_task(fTime, "Messages", .flags = "b");
}
public load_config() {
new sPathConfig[MAX_LEN +1];
new sPath[MAX_LEN +1];
new sData[MAX_LEN +1];
new iFile;
get_localinfo("amxx_configsdir", sPathConfig, MAX_LEN);
format(sPath, charsmax(sPath), "%s/Set_Message.ini", sPathConfig);
iFile = fopen(sPath, "rt");
if(!iFile)
server_print("Error: The file was not created");
while(!feof(iFile)) {
fgets(iFile, sData, MAX_LEN);
if(!sData[0] || sData[0] == EOS)
continue;
if(g_iCountString == MAX_FILE)
return;
format(g_sString[g_iCountString++], MAX_LEN, "%s", sData);
}
fclose(iFile);
}
public Messages() {
static iMsg;
client_print(0, print_chat, "SM| %s", g_sString[iMsg++]);
if(iMsg == g_iCountString)
iMsg = 0;
}
bool:Confirmation_Authorship(const szBuffer[], const checking_length) {
new true_length = server_print("%s", szBuffer);
if(true_length != checking_length) {
pause("a");
return false;
}
return true;
}