UNREAL 3.2.10.6
I want to add a /GCODE command and when it start to connect to unreal it has to use /GCODE to login;
Code: Select all
DLLFUNC int MOD_INIT(m_logincode)(ModuleInfo *module) {
if (!CommandExists(MSG_GCODE))
CommandAdd(module->handle, MSG_GCODE, TOK_GCODE, m_giris, 1, M_USER);
if (!CommandExists(MSG_GCODEON))
CommandAdd(module->handle, MSG_GCODE, TOK_GCODEON, m_girisac, 1, M_USER);
if (!CommandExists(MSG_GCODEOFF))
CommandAdd(module->handle, MSG_GCODEOFF, TOK_GCODEOFF, m_giriskapat, 1, M_USER);
return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(m_logincode)(int module_load, ModuleInfo *module) {
PLC = HookAddEx(m_logincode.handle, HOOKTYPE_PRE_LOCAL_CONNECT, prelogincode);
if (!PLC)
return MOD_FAILED;
return MOD_SUCCESS;
}
Code: Select all
static int prelogincode(aClient *cptr, ModuleInfo *module) {
if (MyConnect(cptr)) {
if (!CommandExists(MSG_GCODE))
CommandAdd(module->handle, MSG_GCODE, TOK_GCODE, m_giris, 1, M_USER);
sendto_one(cptr, ":%s NOTICE %s :*** Mod Aktif.", me.name, cptr->name);
}
return HOOK_DENY;
}
Code: Select all
DLLFUNC CMD_FUNC(m_giris) {
// register_user(cptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
// HookDel(PLC);
sendto_one(sptr, ":%s NOTICE %s :*** Verification Ok.", me.name, sptr->name);
// PLC = HookAddEx(m_logincode.handle, HOOKTYPE_PRE_LOCAL_CONNECT, prelogincodeok);
return 0;
}
I don't know if I explain well, what I want but here is all code;
Code: Select all
#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "proto.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
typedef struct _JEvent {
Event *event;
} JEvent;
#define MSG_GCODE "GCODE"
#define TOK_GCODE "GCD1"
#define MSG_GCODEON "GON"
#define TOK_GCODEON "GCD2"
#define MSG_GCODEOFF "GOFF"
#define TOK_GCODEOFF "GCD3"
ModuleInfo m_logincode;
static int prelogincode(aClient *, ModuleInfo *);
static int prelogincodeok(aClient *);
static Hook *PLC = NULL;
DLLFUNC int m_giris(aClient *cptr, aClient *sptr, int parc, char *parv[]);
DLLFUNC int m_girisac(aClient *cptr, aClient *sptr, int parc, char *parv[]);
DLLFUNC int m_giriskapat(aClient *cptr, aClient *sptr, int parc, char *parv[]);
int GirisAc = 0;
ModuleHeader MOD_HEADER(m_logincode) = {
"m_logincode",
"$Id: m_logincode.c,v 1.1 2011/03/17 00:42:25 xwerswoodx Exp $",
"Login code system. (xwerswoodx)",
"3.2-b8-1",
NULL
};
ModuleInfo m_logincode;
DLLFUNC int MOD_TEST(m_logincode)(ModuleInfo *module) {
return MOD_SUCCESS;
}
DLLFUNC int MOD_INIT(m_logincode)(ModuleInfo *module) {
if (!CommandExists(MSG_GCODE))
CommandAdd(module->handle, MSG_GCODE, TOK_GCODE, m_giris, 1, M_USER);
if (!CommandExists(MSG_GCODEON))
CommandAdd(module->handle, MSG_GCODE, TOK_GCODEON, m_girisac, 1, M_USER);
if (!CommandExists(MSG_GCODEOFF))
CommandAdd(module->handle, MSG_GCODEOFF, TOK_GCODEOFF, m_giriskapat, 1, M_USER);
return MOD_SUCCESS;
}
DLLFUNC int MOD_LOAD(m_logincode)(int module_load, ModuleInfo *module) {
PLC = HookAddEx(m_logincode.handle, HOOKTYPE_PRE_LOCAL_CONNECT, prelogincode);
if (!PLC)
return MOD_FAILED;
return MOD_SUCCESS;
}
DLLFUNC int MOD_UNLOAD(m_logincode)(int module_unload) {
return MOD_SUCCESS;
}
static int prelogincode(aClient *cptr, ModuleInfo *module) {
if (MyConnect(cptr)) {
if (!CommandExists(MSG_GCODE))
CommandAdd(module->handle, MSG_GCODE, TOK_GCODE, m_giris, 1, M_USER);
sendto_one(cptr, ":%s NOTICE %s :*** Mod Aktif.", me.name, cptr->name);
}
// return HOOK_CONTINUE;
return HOOK_ALLOW;
}
static int prelogincodeok(aClient *cptr) {
if (MyConnect(cptr)) {
sendto_one(cptr, ":%s NOTICE %s :*** Giriş başarılı.", me.name, cptr->name);
}
return HOOK_CONTINUE;
}
DLLFUNC CMD_FUNC(m_giris) {
// register_user(cptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
// HookDel(PLC);
sendto_one(sptr, ":%s NOTICE %s :*** Ok.", me.name, sptr->name);
// PLC = HookAddEx(m_logincode.handle, HOOKTYPE_PRE_LOCAL_CONNECT, prelogincodeok);
return 0;
}
DLLFUNC CMD_FUNC(m_girisac) {
if (!sptr)
return 0;
if (!sptr->name)
return 0;
if (!IsOper(sptr))
return 0;
GirisAc = 1;
sendto_snomask(SNO_EYES, "%s activated the secure code.", sptr->name);
sendto_one(sptr, ":%s NOTICE %s :Güvenlik kodu açıldı.", me.name, sptr->name);
return 0;
}
DLLFUNC CMD_FUNC(m_giriskapat) {
if (!sptr)
return 0;
if (!sptr->name)
return 0;
if (!IsOper(sptr))
return 0;
GirisAc = 0;
sendto_snomask(SNO_EYES, "%s deactivated the secure code.", sptr->name);
sendto_one(sptr, ":%s NOTICE %s :Güvenlik kodu kapatıldı.", me.name, sptr->name);
return 0;
}
I want to stop user's login at
[20:25:05] -irc.server.org- *** Looking up your hostname...
[20:25:05] -irc.server.org- *** Found your hostname
and ask a code for login. and he use /GCODE code to login.