15 November 2008, 23:12
|
Senior Member
|
|
Kayıt Tarihi: 21 September 2008
Mesajlar: 15,180
Konular:
|
|
Modül - Helpers
PHP- Kodu:
*---------------------------- m_helpers.c modülü Yazan: Salazar(tt`) ------------------------------*/
#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" #ifdef STRIPBADWORDS #include "badwords.h" #endif #ifdef _WIN32 #include "version.h" #endif
#define RPL_HELPERS 357 #define RPL_ENDOFHELPERS 358 #define MSG_HELPERS "HELPERS" #define TOK_HELPERS "HP" #define MyMod ModHelpers->handle #define IsAway(x) (x)->user->away #define IsHelper(sptr) IsHelpOp(sptr) #define DelCommand(x) if (x) CommandDel(x); x = NULL
static Command *AddCommand(char *msg, char *token, int (*func)()); DLLFUNC int m_helpers(aClient *cptr, aClient *sptr, int parc, char *parv[]);
ModuleInfo *ModHelpers; Command *CmdHelpers;
#ifndef DYNAMIC_LINKING ModuleHeader m_helpers_Header #else #define m_helpers_Header Mod_Header ModuleHeader Mod_Header #endif = { "helpers", "$Id: m_helpers.c, oluþum tarihi 30 Kasým 2004.Yazan Salazar Exp $", "/helpers komutu", "3.2-b8-1", NULL };
#ifdef DYNAMIC_LINKING DLLFUNC int Mod_Init(ModuleInfo *modinfo) #else int m_helpers_Init(ModuleInfo *modinfo) #endif { ModHelpers = modinfo; CmdHelpers = AddCommand(MSG_HELPERS, TOK_HELPERS, m_helpers);
if (!CmdHelpers) return MOD_FAILED;
return MOD_SUCCESS; }
#ifdef DYNAMIC_LINKING DLLFUNC int Mod_Load(int module_load) #else int m_helpers_Load(int module_load) #endif { return MOD_SUCCESS; }
#ifdef DYNAMIC_LINKING DLLFUNC int Mod_Unload(int module_unload) #else int m_helpers_Unload(int module_unload) #endif { DelCommand(CmdHelpers);
return MOD_SUCCESS; }
typedef struct { unsigned long *umode; char *text; } hmode;
static hmode otypes[] = { { &UMODE_HELPOP, "Yardým Yetkilisi" }, { NULL, NULL } };
static char *find_otype(unsigned long umodes) { unsigned int i;
for (i = 0; otypes[i].umode; i++) if (*otypes[i].umode & umodes) return otypes[i].text;
return "bilinmeyen yetkili"; }
static Command *AddCommand(char *msg, char *token, int (*func)()) { Command *cmd;
if (CommandExists(msg)) { config_error(" %s komutu zaten mevcut", msg); return NULL; } if (CommandExists(token)) { config_error(" %s komutu zaten mevcut", token); return NULL; }
cmd = CommandAdd(MyMod, msg, token, func, MAXPARA, 0);
#ifndef _WIN32 if (ModuleGetError(MyMod) != MODERR_NOERROR || !cmd) #else if (!cmd) #endif { #ifndef _WIN32 config_error("Komut eklenirken hata--> %s: %s", msg, ModuleGetErrorStr(MyMod)); #else config_error("Komut eklenirken hata--> %s", msg); #endif return NULL; }
return cmd; }
int m_helpers(aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char buf[BUFSIZE]; int yetkililer = 0, mesgul = 0, toplam = 0;
sendto_one(sptr, ":%s 339 %s :+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+", me.name, sptr->name); sendto_one(sptr, ":%s 339 %s : Sunucuda Online olan Yardimci Listesi ", me.name, sptr->name); sendto_one(sptr, ":%s 339 %s :+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+", me.name, sptr->name); sendto_one(sptr, ":%s 339 %s : Listede bulunan yetkililerden #Help kanalýnda ", me.name, sptr->name); sendto_one(sptr, ":%s 339 %s : IRC/Services hakkýnda komut bilgisi isteyebilirsiniz. ", me.name, sptr->name); sendto_one(sptr, ":%s 339 %s :+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+", me.name, sptr->name); for (acptr = client; acptr; acptr = acptr->next) { if (IsULine(acptr) || !IsPerson(acptr) || !IsHelpOp(acptr)) continue;
sendto_one(sptr, ":%s %d %s : \2 %-23s \2 %-16s " "%s", me.name, RPL_HELPERS, sptr->name, acptr->name, find_otype(acptr->umodes), (IsAway(acptr) ? "-Meþgul" : ""));
if (IsAway(acptr)) mesgul++; else if (IsHelper(acptr)) yetkililer++;
}
toplam = yetkililer + mesgul;
sprintf(buf, "Toplam: %d Komut Yardým Yetkilisi Baðlý - %d Yetkili , %d Meþgul", toplam , yetkililer , mesgul); sendto_one(sptr, ":%s 339 %s :+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+", me.name, sptr->name);
sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_HELPERS, sptr->name, buf); sendto_one(sptr, ":%s %d %s :Komut Yardým Yetkilisi listesi sonu", me.name, RPL_ENDOFHELPERS, sptr->name);
return 0; }
m_helpers.c oLarak Kaydet edin Unreal3.2/src/modules e atın
|