[MODIFICARE] Plugin /who

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
Pegasus6ix
Membru, skill 0
Membru, skill 0
Posts: 39
Joined: 11 Nov 2018, 23:25
Detinator Steam: Nu
Fond eXtream: 0
Has thanked: 10 times

30 Apr 2020, 03:45

Salut, poate cineva daca va rog sa-mi modifice sursa de mai jos pentru un plugin /who astfel incat atunci cand adaug unui Admin deja existent acces VIP (flag "t") sa apara totusi in lista atunci cand un player scrie /who deoarece atunci cand este deja un Admin existent si ii adaug si acces VIP prin flagul "t" (ADMIN_LEVEL_H) pe langa celelalte accese, are VIP si Admin dar cand scriu /who in joc, nu mai apare deloc in lista, daca sterg flagul "t" din accesele respective si ii las doar accesele de admin, atunci apare cand scriu /who in joc.

Sursa :
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

#define PLUGIN			"ULTIMATE Who"
#define VERSION			"1.0"
#define AUTHOR			"P.Of.Pw"

#define CharsMax(%1)		sizeof %1 - 1
#define time_shower		1.0

#define GROUPS_NAME		9
#define GROUPS_ACCESS		9

#define RRR			255
#define GGG			255
#define BBB			255
#define time_hud		12.0

#define motd_msg		"Admin's Online"
#define who_meniu_ad_group_msg	"\yAdmini \yOnline^n"
#define who_meniu_admin_msg	"\y-=[Admin's]=- \w-=[Online]=-^n^n"
#define	who_console_top		"=========== Admini Online ==========="
#define	who_console_bottom 	"================================"

new GroupNames[GROUPS_NAME][] = {
	"-[ Fondator ]-",
	"-[ Owner ]-",
	"-[ Co-Owner ]-",
	"-[ GOD ]-",
	"-[ Moderator ]-",
	"-[ Administrator ]-",
	"-[ Helper ]-",
    "-[ Slot ]-",
    "-[ V.I.P ]-"
}

new GroupFlags[GROUPS_ACCESS][] = {
	"abcdefghijklmnopqrstu",
	"abcdegfhijmnopqrs",
	"bcdefgijmnopqrs",
	"bcdefijmnopqrs",
	"bcdefijmnopq",
	"bcdefijmnop",
    "bcehi",
	"b",
	"bct"
}

new GroupFlagsValue[GROUPS_NAME]

new who_type, who_typemeniu

public plugin_init() {
   
	register_plugin(PLUGIN, VERSION, AUTHOR)
   
	for(new p_of_pw = 0 ; p_of_pw < GROUPS_NAME ; p_of_pw++)
		GroupFlagsValue[p_of_pw] = read_flags(GroupFlags[p_of_pw])
   
	register_clcmd("say", "cmdSay")
	register_clcmd("say_team", "cmdSay")
	
	who_type = register_cvar("cmd_who","1")
	who_typemeniu = register_cvar("who_typemeniu","1")
}

public cmdSay(id)
{
	new say[192]
	read_args(say,192)
	if(( containi(say, "who") != -1 || containi(say, "admin") != -1 || containi(say, "admins") != -1  || contain(say, "/who") != -1 || contain(say, "/admin") != -1 || contain(say, "/admins") != -1))
		set_task(time_shower,"cmdULTMWho",id)
	return PLUGIN_CONTINUE
}

public cmdULTMWho(id)
{
	switch(get_pcvar_num(who_type))
	{
		case 1: who_meniu(id)
		
		case 2: who_motd(id)
		
		case 3: who_table(id)
		
		case 4: who_hud(id)
		
		case 5: who_console(id)
		
	}
	return 0
}

who_meniu(id)
{
	switch(get_pcvar_num(who_typemeniu))
	{
		case 1: who_meniu_admin_groups(id)
		
		case 2: who_meniu_admin(id)
	}
	return 0
}
who_meniu_admin_groups(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32]
	new szMenu[256], nLen, keys
	
	nLen = format(szMenu[nLen], 255, who_meniu_ad_group_msg)
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{   
		nLen += format(szMenu[nLen], 255-nLen,"\r%s^n", GroupNames[p_of_pw])
     
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				nLen += format(szMenu[nLen], 255-nLen,"\w%s^n", sName)
			}   
		}
	}
	nLen += format(szMenu[nLen], 255-nLen,"^n\wPentru a iesi apasa \y0 \w sau \y5" )
	keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)
	show_menu(id,keys,szMenu,-1)
	return 0
}

who_meniu_admin(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32]
	new szMenu[256], nLen, keys
   
	nLen = format(szMenu[nLen], 255, who_meniu_admin_msg)
  
	get_players(sPlayers, iNum, "ch")
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				nLen += format(szMenu[nLen], 255-nLen,"\r%s^n", sName)
			}   
		}
	}
	nLen += format(szMenu[nLen], 255-nLen,"^n\wPentru a iesi apasa \y0 \w sau \y5" )
	keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)
	show_menu(id,keys,szMenu,-1)
	return 0
}

who_motd(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32], sBuffer[1024]
	new iLen
	
	iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")
   
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{   
		iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h5><font color=^"red^">%s^n</font></h5></center>", GroupNames[p_of_pw])
     
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center>%s^n</center>", sName)
			}
		}		
	}
	show_motd(id, sBuffer, motd_msg)
	return 0

}

who_table(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32], sBuffer[1024]
	new iLen
	
	iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")
	iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h3><b><font color=^"red^">NUME			-	ACCES</font></h3></b></center>")
	
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
		
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h4><font color=^"white^">%s		%s^n</font></h4></center>", sName, GroupNames[p_of_pw])
			}
		}		
	}
	show_motd(id, sBuffer, motd_msg)
	return 0
}

who_hud(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32], sBuffer[1024]
	new iLen
	
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{   
		iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "=== %s ===^n", GroupNames[p_of_pw])
     
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "%s^n", sName)
			}
		}		
	}
	set_hudmessage(RRR, GGG, BBB, 0.02, 0.24, 0, 6.0, time_hud)
	show_hudmessage(id, sBuffer)
	return 0
}

who_console(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32]

	get_players(sPlayers, iNum)
	console_print(id, who_console_top)
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME; p_of_pw++) 
	{
		for(new a = 0; a < iNum ; a++)
		{
			
			iPlayer = sPlayers[a]
			get_user_name(iPlayer, sName, sizeof sName - 1)
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw]) 
				console_print(id, "= %d = %s : %s", p_of_pw+1, GroupNames[p_of_pw], sName)
			
			
		}
	}
	console_print(id, who_console_bottom)
	return 0
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Multumesc anticipat.
ZM.PUBZONE.RO
#2020 ZombiePlague
RoyalServer 2
User avatar
vld.mihai
Membru, skill 0
Membru, skill 0
Posts: 28
Joined: 17 Jan 2015, 12:33
Detinator Steam: Da
CS Status: ASL.BLACKGAMES.RO
Detinator server CS: ASL.BLACKGAMES.RO
SteamID: vlad2795
Fond eXtream: 0
Location: Bacau
Has thanked: 3 times

01 May 2020, 04:38

Pegasus6ix wrote:
01 May 2020, 01:06
UP.
aSTA INSEAMNA CA LA FIECARE GRAD AR MAI TREBUI ADAUGAT FLAGT
ADICA :

FONDATOR
FONDATOR+VIP
OWNER
OWNER+VIP

SI MODIFICATE FLAGURILE IN ASA MOD CAND VEI ADAUGA ADMINUL IL ADAUGI IN CATEGORIA RESPECTIVA , IN ACEST CAZ TREBUIE MODIFICAT SI USER.INI ! DACA DORESTI ASA CONTACTEAZA-MA
Image
Pegasus6ix
Membru, skill 0
Membru, skill 0
Posts: 39
Joined: 11 Nov 2018, 23:25
Detinator Steam: Nu
Fond eXtream: 0
Has thanked: 10 times

01 May 2020, 16:58

vld.mihai wrote:
01 May 2020, 04:38
Pegasus6ix wrote:
01 May 2020, 01:06
UP.
aSTA INSEAMNA CA LA FIECARE GRAD AR MAI TREBUI ADAUGAT FLAGT
ADICA :

FONDATOR
FONDATOR+VIP
OWNER
OWNER+VIP

SI MODIFICATE FLAGURILE IN ASA MOD CAND VEI ADAUGA ADMINUL IL ADAUGI IN CATEGORIA RESPECTIVA , IN ACEST CAZ TREBUIE MODIFICAT SI USER.INI ! DACA DORESTI ASA CONTACTEAZA-MA
Deci ma gandesc ca apoi cand voi da /who in chat va aparea lista asa:
Fondator
Fondator+VIP
Owner
Owner+VIP

Nu ?
ZM.PUBZONE.RO
#2020 ZombiePlague
User avatar
ABobeanu
Membru, skill 0
Membru, skill 0
Posts: 8
Joined: 04 Jun 2020, 01:12
Detinator Steam: Da
CS Status: omw to hell
Detinator server CS: cs.s3if.ro
SteamID: abobeanu
Fond eXtream: 0
Has thanked: 3 times

05 Jun 2020, 00:20

Pegasus6ix wrote:
01 May 2020, 16:58
vld.mihai wrote:
01 May 2020, 04:38
Pegasus6ix wrote:
01 May 2020, 01:06
UP.
aSTA INSEAMNA CA LA FIECARE GRAD AR MAI TREBUI ADAUGAT FLAGT
ADICA :

FONDATOR
FONDATOR+VIP
OWNER
OWNER+VIP

SI MODIFICATE FLAGURILE IN ASA MOD CAND VEI ADAUGA ADMINUL IL ADAUGI IN CATEGORIA RESPECTIVA , IN ACEST CAZ TREBUIE MODIFICAT SI USER.INI ! DACA DORESTI ASA CONTACTEAZA-MA
Deci ma gandesc ca apoi cand voi da /who in chat va aparea lista asa:
Fondator
Fondator+VIP
Owner
Owner+VIP

Nu ?
Da, asa e
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2811
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 244 times
Been thanked: 129 times
Contact:

11 Jun 2020, 19:45

Ce tip folosesti?
Am modificat pe MOTD in asa fel incat atunci cand pui in plus "T" sa-l recunoasca automat.
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>

#define PLUGIN			"ULTIMATE Who"
#define VERSION			"1.0"
#define AUTHOR			"P.Of.Pw"

#define CharsMax(%1)		sizeof %1 - 1
#define time_shower		1.0

#define GROUPS_NAME		9
#define GROUPS_ACCESS		9

#define RRR			255
#define GGG			255
#define BBB			255
#define time_hud		12.0

#define motd_msg		"Admin's Online"
#define who_meniu_ad_group_msg	"\yAdmini \yOnline^n"
#define who_meniu_admin_msg	"\y-=[Admin's]=- \w-=[Online]=-^n^n"
#define	who_console_top		"=========== Admini Online ==========="
#define	who_console_bottom 	"================================"

new GroupNames[GROUPS_NAME][] = {
	"-[ Fondator ]-",
	"-[ Owner ]-",
	"-[ Co-Owner ]-",
	"-[ GOD ]-",
	"-[ Moderator ]-",
	"-[ Administrator ]-",
	"-[ Helper ]-",
    "-[ Slot ]-",
    "-[ V.I.P ]-"
}

new GroupFlags[GROUPS_ACCESS][] = {
	"abcdefghijklmnopqrstu",
	"abcdegfhijmnopqrs",
	"bcdefgijmnopqrs",
	"bcdefijmnopqrs",
	"bcdefijmnopq",
	"bcdefijmnop",
    "bcehi",
	"b",
	"bct"
}

new GroupFlagsValue[GROUPS_NAME]

new who_type, who_typemeniu

public plugin_init() {
   
	register_plugin(PLUGIN, VERSION, AUTHOR)
   
	for(new p_of_pw = 0 ; p_of_pw < GROUPS_NAME ; p_of_pw++)
		GroupFlagsValue[p_of_pw] = read_flags(GroupFlags[p_of_pw])
   
	register_clcmd("say", "cmdSay")
	register_clcmd("say_team", "cmdSay")
	
	who_type = register_cvar("cmd_who","1")
	who_typemeniu = register_cvar("who_typemeniu","1")
}

public cmdSay(id)
{
	new say[192]
	read_args(say,192)
	if(( containi(say, "who") != -1 || containi(say, "admin") != -1 || containi(say, "admins") != -1  || contain(say, "/who") != -1 || contain(say, "/admin") != -1 || contain(say, "/admins") != -1))
		set_task(time_shower,"cmdULTMWho",id)
	return PLUGIN_CONTINUE
}

public cmdULTMWho(id)
{
	switch(get_pcvar_num(who_type))
	{
		case 1: who_meniu(id)
		
		case 2: who_motd(id)
		
		case 3: who_table(id)
		
		case 4: who_hud(id)
		
		case 5: who_console(id)
		
	}
	return 0
}

who_meniu(id)
{
	switch(get_pcvar_num(who_typemeniu))
	{
		case 1: who_meniu_admin_groups(id)
		
		case 2: who_meniu_admin(id)
	}
	return 0
}
who_meniu_admin_groups(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32]
	new szMenu[256], nLen, keys
	
	nLen = format(szMenu[nLen], 255, who_meniu_ad_group_msg)
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{   
		nLen += format(szMenu[nLen], 255-nLen,"\r%s^n", GroupNames[p_of_pw])
     
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				nLen += format(szMenu[nLen], 255-nLen,"\w%s^n", sName)
			}   
		}
	}
	nLen += format(szMenu[nLen], 255-nLen,"^n\wPentru a iesi apasa \y0 \w sau \y5" )
	keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)
	show_menu(id,keys,szMenu,-1)
	return 0
}

who_meniu_admin(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32]
	new szMenu[256], nLen, keys
   
	nLen = format(szMenu[nLen], 255, who_meniu_admin_msg)
  
	get_players(sPlayers, iNum, "ch")
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				nLen += format(szMenu[nLen], 255-nLen,"\r%s^n", sName)
			}   
		}
	}
	nLen += format(szMenu[nLen], 255-nLen,"^n\wPentru a iesi apasa \y0 \w sau \y5" )
	keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)
	show_menu(id,keys,szMenu,-1)
	return 0
}

who_motd(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32], sBuffer[1024]
	new iLen
	
	iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")
   
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{   
		iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h5><font color=^"red^">%s^n</font></h5></center>", GroupNames[p_of_pw])
     
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw] || get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw] + (get_user_flags(iPlayer) & ADMIN_LEVEL_H))
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center>%s%s^n</center>", sName, (get_user_flags(iPlayer) & ADMIN_LEVEL_H ? " - VIP" : ""))
			}
		}		
	}
	show_motd(id, sBuffer, motd_msg)
	return 0

}

who_table(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32], sBuffer[1024]
	new iLen
	
	iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")
	iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h3><b><font color=^"red^">NUME			-	ACCES</font></h3></b></center>")
	
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
		
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h4><font color=^"white^">%s		%s^n</font></h4></center>", sName, GroupNames[p_of_pw])
			}
		}		
	}
	show_motd(id, sBuffer, motd_msg)
	return 0
}

who_hud(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32], sBuffer[1024]
	new iLen
	
	get_players(sPlayers, iNum, "ch")
   
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
	{   
		iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "=== %s ===^n", GroupNames[p_of_pw])
     
		for(new a = 0; a < iNum ; a++)
		{   
			iPlayer = sPlayers[a]
         
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
			{
				get_user_name(iPlayer, sName, sizeof sName - 1)
				iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "%s^n", sName)
			}
		}		
	}
	set_hudmessage(RRR, GGG, BBB, 0.02, 0.24, 0, 6.0, time_hud)
	show_hudmessage(id, sBuffer)
	return 0
}

who_console(id)
{
	new sPlayers[32], iNum, iPlayer
	new sName[32]

	get_players(sPlayers, iNum)
	console_print(id, who_console_top)
	for(new p_of_pw = 0; p_of_pw < GROUPS_NAME; p_of_pw++) 
	{
		for(new a = 0; a < iNum ; a++)
		{
			
			iPlayer = sPlayers[a]
			get_user_name(iPlayer, sName, sizeof sName - 1)
			if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw]) 
				console_print(id, "= %d = %s : %s", p_of_pw+1, GroupNames[p_of_pw], sName)
			
			
		}
	}
	console_print(id, who_console_bottom)
	return 0
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests