Unreal !sure Bağlantı süresi gösterme

Aytac

nicktag
Yönetici
Developer
Katılım
4 Şub 2020
Mesajlar
395
Tepkime puanı
144
Puanları
43
Konum
ircland
Web sitesi
www.ircalem.net
* Bağlantı süresi modülü - Yazan : SaW (Nebiliymben)
* __________________________________________________ ___
* Kullanim: !sure <nick> (kanalda)
* Belirtilen nickin sunucuya giris ya da çıkış zamanını
* ve ne kadar süredir bagli olduğunu gosterir.
* Verilen nickin en son ne zaman sunucuda bulunduğunu
* göstermesi yönüyle "seen" özelliği de taşımaktadır.
* nick belirtilmemişse sorgulamayı yapan kişinin
* nickini esas alır.
* Unreal3.2.7 ve Unreal3.2.6'da test edilmiştir.
* Bu beta sürümdur. Herhangi bir hatayla
* karşılaşırsaniz bildiriniz.

---------------------------------------------------------------

Sadece Network ve Root adminlere göre !sure komutu nasıl ayarlıyabiliriz?

Kod:
/* remote ve diger serverlar etkilenmesin */
if (!MyClient(sptr))
return text;

ALTINA,
Kod:
    
if (!IsNetAdmin(sptr) && !IsRootAdmin(sptr)) {
sendto_channel_butone(NULL, &me, chptr, ":%s PRIVMSG %s :%s, '%s' komutunu kullanmaya yetkiniz yok.",
mesajci, chptr->chname, sptr->name, sure);
return text;
}
EKLE, komutu kullanmaya çalışan herhangi bir kullanıcıya iletilecek olan mesajda, aşağıdaki gibi olacaktır.

<Aytac> !sure
<süre.bilgisi> Aytac, '!sure' komutunu kullanmaya yetkiniz yok.

Kod:
/*
 *   =====================================================
 *   Bağlantı süresi modülü - Yazan : SaW (Nebiliymben)
 *   _____________________________________________________
 *   Kullanim: !sure <nick> (kanalda)
 *   Belirtilen nickin sunucuya giris ya da çıkış zamanını
 *   ve ne kadar süredir bagli olduğunu gosterir.
 *   Verilen nickin en son ne zaman sunucuda bulunduğunu
 *   göstermesi yönüyle "seen" özelliği de taşımaktadır.
 *   nick belirtilmemişse sorgulamayı yapan kişinin
 *   nickini esas alır.
 *   Unreal3.2.7 ve Unreal3.2.6'da test edilmiştir.
 *   Bu beta sürümdur. Herhangi bir hatayla
 *   karşılaşırsaniz bildiriniz.
 *   e-mail: [email protected]
 *   =====================================================
 */

#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
 /* Komut adı */
#define sure "!sure"
/*
* Kanala bilgi mesajı gönderecek nick. 
* Şuanki hali renkli bir nicktir.
* Dilerseniz renksiz bir nick yapabilirsiniz.
*/
#define mesajci "6süre.bilgisi" 
DLLFUNC char *sure_chanmsg(aClient *, aClient *, aChannel *, char *, int);
extern MODVAR aWhowas *WHOWASHASH[WW_MAX];

ModuleHeader MOD_HEADER(m_sure)
  = {
	"m_sure - kisilerin baglanti sureleri hakkinda bilgiler",	
	"v1-beta 18/02/2010",
	"SaW",
	"3.2-b8-1",
	NULL 
    };


DLLFUNC int MOD_INIT(m_sure)(ModuleInfo *modinfo)
{
	HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, sure_chanmsg);
	return MOD_SUCCESS;
}

DLLFUNC int MOD_LOAD(m_sure)(int module_load) 
{
     return MOD_SUCCESS; 
} 
 
DLLFUNC int MOD_UNLOAD(m_sure)(int module_unload) 
{
    return MOD_SUCCESS; 
}


DLLFUNC char *sure_chanmsg(aClient *cptr, aClient *sptr, aChannel *chptr, char *text, int notice)
{
	/* remote ve diger serverlar etkilenmesin */
	if (!MyClient(sptr))
		return text;
	aWhowas *temp;
	aClient *rumuz;
	char tekst[1024];
	ircsprintf(tekst, "%s", text);
	char saat[1024];
	char *komut = strtok(tekst, " "); /* Kanala gönderilen mesajdaki ilk kelime */
	char *nick = strtok(NULL, " "); /* Kanala gönderilen mesajdaki ikinci kelime */
	char *nick2 = strtok(NULL, " "); /* Kanala gönderilen mesajdaki üçüncü kelime */
	/* Boş mesajsa */
	if (!komut)
		return text;
	/* Mesajdaki ilk kelime sure komutu değilse */
	if (strcmp(komut, sure) != 0)
		return text;
	/* Birden fazla nick belirtilmişse */
	if (nick2)
	{
		sendto_channel_butone(NULL, &me, chptr,
                ":%s PRIVMSG %s :%s, Bir defada bir nick için sorgulama yapabilirsiniz!",
					mesajci, chptr->chname, sptr->name);
		return text;
	}
	/* Bir nick belirtilmiş ve o nick sunucuda bulunmuyorsa */
	if (nick && !find_person(nick, NULL))
	{
		temp = WHOWASHASH[hash_whowas_name(nick)];
		int found = 0;
		found = 0;
		for (; temp; temp = temp->next)
		{
			if (!mycmp(nick, temp->name))
			{
			found++;
			break;
			}
		}
		/* Sunucuda hiç bulunmadıysa */
		if (!found)
		{
			sendto_channel_butone(NULL, &me, chptr,
                ":%s PRIVMSG %s :Belirttiğiniz nick sunucuda bulunmuyor.",
                mesajci, chptr->chname);
			return text;
		}
		/* Son çıkış zamanını bulup şuanki zamandan çıkarıyoruz,
		çıkan sonucu gün/sa/dk/sn cinsine çeviriyoruz */
		if ((TStime() - temp->logoff) > 86400)
			ircsprintf(saat, "%d gün %d sa %d dk %d sn önce buradaydı.",
				((TStime() - temp->logoff) / 86400),
				(((TStime() - temp->logoff) % 86400) / 3600),
				((((TStime() - temp->logoff) % 86400) % 3600) / 60),
				(((((TStime() - temp->logoff) % 86400) % 3600) % 60) % 60));
		else if ((TStime() - temp->logoff) > 3600)
			ircsprintf(saat, "%d sa %d dk %d sn önce buradaydı.",
				(((TStime() - temp->logoff) / 3600)),
				(((TStime() - temp->logoff) % 3600) / 60),
				((((TStime() - temp->logoff) % 3600) % 60) % 60));
		else if ((TStime() - temp->logoff) > 60)
			ircsprintf(saat, "%d dk %d sn önce buradaydı.",
				((TStime() - temp->logoff) / 60),
				(((TStime() - temp->logoff) % 60) % 60));
		else
			ircsprintf(saat, "sunucudan daha yeni çıktı.");		
			sendto_channel_butone(NULL, &me, chptr,
                ":%s PRIVMSG %s :%s, %s",
                mesajci, chptr->chname, nick, saat);
	}
	/* Bir nick belirtilmiş ve o nick şuan sunucudaysa */
	else if (nick && find_person(nick, NULL) && MyClient(find_person(nick, NULL)))
	{
			rumuz =  find_person(nick, NULL);
			if ((TStime() - rumuz->firsttime) > 86400)
				ircsprintf(saat, "%s, %d gün %d sa %d dk %d saniyedir sunucuda bulunuyor.",
					nick, ((TStime() - rumuz->firsttime) / 86400),
					(((TStime() - rumuz->firsttime) % 86400) / 3600),
					((((TStime() - rumuz->firsttime) % 86400) % 3600) / 60),
					(((((TStime() - rumuz->firsttime) % 86400) % 3600) % 60) % 60));
			else if ((TStime() - rumuz->firsttime) > 3600)
				ircsprintf(saat, "%s, %d sa %d dk %d saniyedir sunucuda bulunuyor.",
					nick, (((TStime() - rumuz->firsttime) / 3600)),
					(((TStime() - rumuz->firsttime) % 3600) / 60),
					((((TStime() - rumuz->firsttime) % 3600) % 60) % 60));
			else if ((TStime() - rumuz->firsttime) > 60)
				ircsprintf(saat, "%s, %d dk %d saniyedir sunucuda bulunuyor.",
					nick, ((TStime() - rumuz->firsttime) / 60),
					(((TStime() - rumuz->firsttime) % 60) % 60));
			else
				ircsprintf(saat, "%s sunucuya daha yeni girdi.", nick);
			sendto_channel_butone(NULL, &me, chptr,
                ":%s PRIVMSG %s :%s",
                mesajci, chptr->chname, saat);
	}
	/* Bir nick belirtilmemişse sorgulamayı yapan kişinin nickini esas al */
	else if (!nick)
	{
			if ((TStime() - sptr->firsttime) > 86400)
				ircsprintf(saat, "%s, %d gün %d sa %d dk %d saniyedir sunucuda bulunuyorsunuz.",
					sptr->name, ((TStime() - sptr->firsttime) / 86400),
					(((TStime() - sptr->firsttime) % 86400) / 3600),
					((((TStime() - sptr->firsttime) % 86400) % 3600) / 60),
					(((((TStime() - sptr->firsttime) % 86400) % 3600) % 60) % 60));
			else if ((TStime() - sptr->firsttime) > 3600)
				ircsprintf(saat, "%s, %d sa %d dk %d saniyedir sunucuda bulunuyorsunuz.",
					sptr->name, (((TStime() - sptr->firsttime) / 3600)),
					(((TStime() - sptr->firsttime) % 3600) / 60),
					((((TStime() - sptr->firsttime) % 3600) % 60) % 60));
			else if ((TStime() - sptr->firsttime) > 60)
				ircsprintf(saat, "%s, %d dk %d saniyedir sunucuda bulunuyorsunuz.",
					sptr->name, ((TStime() - sptr->firsttime) / 60),
					(((TStime() - sptr->firsttime) % 60) % 60));
			else
				ircsprintf(saat, "%s, sunucuya daha yeni girdiniz.", sptr->name);
					sendto_channel_butone(NULL, &me, chptr,
					":%s PRIVMSG %s :%s",
					mesajci, chptr->chname, saat);
	}
	return text;
}
 
Geri
Üst