OPERS Modulu

admin

New member
Kullanıcı
Katılım
15 Nis 2013
Mesajlar
63
Tepkime puanı
7
Puanları
0
Cinsiyet
Erkek
Modul /ircops modulu gibi ama .txt deki metni alip RPL_OPERS İLE Kullaniciya veren basit bir modul..

#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#include "proto.h"
#ifdef STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif
#define RPL_OPERS 337
#define MSG_opers "opers"
#define TOK_opersx "lr"
#define tox "#Opers"
#define MSG_opersmotd "opersmotd"
#define TOK_opersmotdx "omx"
aClient *sptr;
aChannel *chptr;
char *text;
DLLFUNC int m_opersmotd(aClient *sptr);
DLLFUNC int m_opers(aClient *cptr, aClient *sptr, int parc, char *parv[]);
#define aciklama "m_opers Operler Bilgileri gosterme Modulu (toXic)"
#define aciklama2 "Operler Bilgileri gosterme Modulu (toXic)"
#define aciklama3 "Opers"
#define versiyon "3.2-b8-1"
ModuleHeader MOD_HEADER(m_opers)
= {
aciklama,
aciklama2,
aciklama3,
versiyon,
NULL
};
DLLFUNC int MOD_INIT(m_opers)(ModuleInfo *modinfo)
{
add_CommandX(MSG_opers, TOK_opersx, m_opers, 1, M_UNREGISTERED|M_USER|M_VIRUS);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}

DLLFUNC int MOD_LOAD(m_opers)(int module_load)
{
return MOD_SUCCESS;
}

DLLFUNC int MOD_UNLOAD(m_opers)(int module_unload)
{
if (del_Command(MSG_opers, TOK_opersx, m_opers) < 0)
{
sendto_realops("Bir hata Olustu.. %s",
MOD_HEADER(m_opers).name);
}
return MOD_SUCCESS;
}

DLLFUNC int m_opers(aClient *cptr, aClient *sptr, int parc, char *parv[])
{

/*
if (!sptr || !sptr || !chptr || !text) {
return text;
}
if (!strcmp(text, "!opers")) {
*/
// dosya islemleri.
#define OKU "opers.txt"
int i;
FILE *dosya;
char buf[BUFSIZE];
dosya = fopen(OKU, "r");
if (dosya != NULL) {
while (fgets(buf, sizeof(buf), dosya)) {
buf[strlen(buf)-1] = 0;
if ((chptr = find_channel(tox, NullChn)) != NullChn)
sendto_channel_butone(&me, &me, chptr, ":OPERS PRIVMSG %s %s Kullanicisi, \2OPERS\2 Komutunu Kullandi.", tox, sptr->name);
sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_OPERS, sptr->name, buf);

}
// Dosyaya Yazdirma..
time_t irc_time;
struct tm tdate;
irc_time = time(NULL);
tdate = *localtime(&irc_time);
FILE * pFile;
pFile = fopen ("operskullananlar.txt", "a");
fprintf (pFile, "Tarih: %02d-%02d-%02d Saat: %02d:%02d Nick: %s IP: %s \n", tdate.tm_mday, tdate.tm_mon + 1,
tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, sptr->name, sptr->user->realhost);
fclose (pFile);

// HATADA Operlere Bildirim..
} else {
sendto_realops("Opers: %s !opers Komutunu Kullandi, fakat, Bir hata ile karsilasti..",
sptr->name);
// Kullaniciya bildirim.
sendto_one(cptr, ":%s NOTICE %s HATA Olustu.\n", me.name, sptr->name);
return 0;
}
}


ircops yerine bu modul ile daha genis bilgiler verebilirsiniz kullanicilara.
Öncelikle opers.txt olusturmalisiniz Unreal3.2* dizini icine.

Nick : RhomaNtiC  ISIM :2 YUSUF S SEHIR :  Sanliurfa YETKI : Network Administrator GOREVI :  Yazilim
Nick : X  ISIM :  Y SEHIR :  Istanbul YETKI : Service Admin GOREVI :  Global Kanallar Sorumlusu

Bu sekil..
Dosya olusturulmadi ise komut kullaniminda kisiye ve operslere uyari verecektir.

Böyle bir sonuc verecektir..
Ayrica Komut kullananlar, operskullananlar.txt de üzerinde kayit edilmektedir.

İyi calismalar.
 
Üst
Alt