Modificare Gag

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
Sounds.
Membru, skill 0
Membru, skill 0
Posts: 40
Joined: 19 Dec 2015, 11:37
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

03 Jan 2023, 17:41

Buna ziua, am si eu un plugin de gag manager, insa am o problema. Cand cineva ia gag pe server iar acela iese, urmatoru player care se conecteaza ii ia gagu si numele. Mentionez ca am in plugin ca atunci cand cineva ia gag sa nu poata sa isi schimbe numele, iar daca da retry tot ramane cu gag. insa problema este ca daca iese de pe server jucatoru cu gag, urmatoru ce intra ii ia numele si gag u si nu stiu de ce.
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "GAG Manager"
#define VERSION "1.9"
#define AUTHOR "ExtreamCS"

#define amxx "AMXX"
#define server "ExtreamCS"
#define protected "*** PROTECTED ***"
#define time "5"

#define DefaultGagTime 600.0
#define GagReason 1
#define MaxPlayers 32
#define AllowOtherPlugin2Interface 1
#define MAX_WORDS 192

new g_swearsNames[MAX_WORDS][32]
new g_swearsNum
new gagtime
new bool:user_gagged[33]
new g_GagPlayers[MaxPlayers+1]
#if GagReason == 1
new gs_GagReason[MaxPlayers+1][48]
#endif
new g_listenall, g_listen1_flag, g_listen2_flag
new temp_cvar1[2], temp_cvar2[2]
new g_message[192], g_maxplayers, g_saytxt

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	register_dictionary("common.txt")

	register_concmd("amx_gag", "cmdGag", ADMIN_KICK, "<nick or #userid> - get gag player")
	register_concmd("amx_ungag", "cmdUnGag", ADMIN_KICK, "<nick or #userid> - get ungag player")
	register_concmd("amx_swearungag", "cmdSwearUnGag", ADMIN_KICK, "<name or #userid> - get ungag player")

	register_clcmd("say", "cmdSay")
	register_clcmd("say_team", "cmdSay")

	register_clcmd("say", "cmdSaySwear")
	register_clcmd("say_team", "cmdSaySwear")

	g_listenall = register_cvar("listenall", "1", FCVAR_PROTECTED)
	g_listen1_flag = register_cvar("listenall_flag", "b", FCVAR_PROTECTED)
	g_listen2_flag = register_cvar("listenprotected_flag", "z", FCVAR_PROTECTED)

	gagtime = register_cvar("mp_sweargagtime", "300", FCVAR_PROTECTED)

	g_saytxt = get_user_msgid("SayText")
	g_maxplayers = get_maxplayers()

	readList()
}

readList()
{
	new szCustomDir[64]
	new filename[64]
	get_configsdir(szCustomDir, 63)
	format(filename, 63, "%s/gag_manager.ini", szCustomDir)

	if(!file_exists(filename))
	{
		return 
	}

	new iLen

	while(g_swearsNum < MAX_WORDS && read_file(filename, g_swearsNum , g_swearsNames[g_swearsNum][1], 30, iLen))
	{
		if(g_swearsNames[g_swearsNum][0] == ';')
			continue

		g_swearsNames[g_swearsNum][0] = iLen
		++g_swearsNum
	}
}

public cmdSaySwear(id)
{
	if((get_user_flags(id) & read_flags("b")) || !id)
		return PLUGIN_CONTINUE

	if(user_gagged[id])
	{
		color_chat(id, "^x04[%s]^x01 You were gagged for not following the rules.", server)
		return PLUGIN_HANDLED
	}

	new szSaid[192]
	read_args(szSaid, 191)
	new bool:found = false
	new pos, i = 0

	while(i < g_swearsNum)
	{
		if((pos = containi(szSaid, g_swearsNames[1])) != -1)
		{
			new len = g_swearsNames[0]
			while(len--)
			szSaid[pos++] = '*'
			found = true
			continue
		}
		++i
	}

	if(found)
	{
		new cmd[32]
		read_argv(0, cmd, 31)
		ActionGag(id)
		return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

public cmdSay(id)
{
	if(!g_GagPlayers[id])
		return PLUGIN_CONTINUE

	new cmd[5]
	read_argv(0, cmd, 4)

	if(cmd[3] == '_')
	{
		if(g_GagPlayers[id] & 2)
		{
#if GagReason == 1
			color_chat(id, "^x04[%s]^x01 You were gagged for not following the rules.", server)
#else
			color_chat(id, "^x04[%s]^x01 "You were gagged for not following the rules.", server)
#endif
			return PLUGIN_HANDLED
		}
	}
	else
	if(g_GagPlayers[id] & 1)
	{
#if GagReason == 1
		color_chat(id, "^x04[%s]^x01 You were gagged for not following the rules.", server)
#else
		color_chat(id, "^x04[%s]^x01 You were gagged for not following the rules.", server)
#endif
		return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

public cmdGag(id, level, cid)
{
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED
	}

	new arg[32], VictimID

	read_argv(1, arg, 31)
	VictimID = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY)

	new s_Flags[4], VictimName[32], AdminName[32], flags, ShowFlags[32], CountFlags, s_GagTime[8], Float:f_GagTime, authid[32], authid2[32]

	get_user_name(id, AdminName, 31)
	get_user_name(VictimID, VictimName, 31)
	get_user_authid(id, authid, 31)
	get_user_authid(VictimID, authid2, 31)

	if(!VictimID)
		return PLUGIN_HANDLED

	if(g_GagPlayers[VictimID])
	{
		console_print(id, "[%s] Client ^"%s^" is already gagged", amxx, VictimName)
		return PLUGIN_HANDLED
	}

	read_argv(2, arg, 31)

	if(!arg[0])
	{
		f_GagTime = DefaultGagTime
		format(s_Flags, 7, "ab")
	}
	else
	{
		if(contain(arg, "m")!=-1 && contain(arg, "!")==-1)
		{
			copyc(s_GagTime, 7, arg, 'm')
			f_GagTime = floatstr(s_GagTime) * 60
		}
		else
		if(isdigit(arg[0]) && contain(arg, "!")==-1)
		{
			format(s_GagTime, 7, arg)
			f_GagTime = floatstr(s_GagTime)
		}

		read_argv(3, arg, 8)

		if(!arg[0])
			format(s_Flags, 7, "ab")
		else
		if(contain(arg, "!")==-1)
			format(s_Flags, 7, arg)
		else
		if(contain(arg, "!")!=-1)
			format(s_Flags, 7, "ab")

		if(f_GagTime == 0.0)
		{
			read_argv(2, arg, 8)
			if(contain(arg, "!")!=-1)
				format(s_Flags, 3, "ab")
			else
				format(s_Flags, 3, arg)
			f_GagTime = DefaultGagTime
		}
	}

	flags = read_flags(s_Flags)
	g_GagPlayers[VictimID] = flags
	new TaskParm[1]
	TaskParm[0] = VictimID
	set_task(f_GagTime, "task_UnGagPlayer", VictimID, TaskParm, 1)

	CountFlags = 0

	if(flags & 1)
	{
		format(ShowFlags, 31, "say")
		CountFlags++
	}

	if(flags & 2)
	{
		if(CountFlags)
			format(ShowFlags, 31, "%s / say_team", ShowFlags)

		if(!CountFlags)
			format(ShowFlags, 31, "say_team")
	}

	switch(get_cvar_num("amx_show_activity"))
	{
#if GagReason == 1
		case 2:   client_print(0, print_chat, "ADMIN %s: has gagged %s from speaking for %0.0f minutes, for: (%s)", AdminName, VictimName, (f_GagTime / 60), ShowFlags)
   		case 1:   client_print(0, print_chat, "ADMIN: has gagged %s from speaking for %0.0f minutes, for: (%s)", VictimName, (f_GagTime / 60), ShowFlags)
#endif
	}

	console_print(id, "[%s] Client ^"%s^" has gagged", amxx, VictimName)

	log_amx("^"%s <%d> <%s>^" has gagged ^"%s <%d> <%s>^"", AdminName, get_user_userid(id), authid, VictimName, get_user_userid(VictimID), authid2)

	return PLUGIN_HANDLED
}

public cmdUnGag(id, level, cid)
{
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED
	}

	new arg[32], VictimID
	read_argv(1, arg, 31)

	VictimID = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY)

	new AdminName[32], VictimName[32], authid[32], authid2[32]

	get_user_name(id, AdminName, 31)
	get_user_name(VictimID, VictimName, 31)
	get_user_authid(id, authid, 31)
	get_user_authid(VictimID, authid2, 31)

	if(!VictimID)
		return PLUGIN_HANDLED

	if(!g_GagPlayers[VictimID])
	{
		console_print(id, "[%s] Client ^"%s^" is already ungagged", amxx, VictimName)
		return PLUGIN_HANDLED
	}

	switch(get_cvar_num("amx_show_activity"))
	{
   		case 2:   client_print(0, print_chat, "ADMIN %s: has ungagged %s", AdminName, VictimName)
   		case 1:   client_print(0, print_chat, "ADMIN: has ungagged %s", VictimName)

  	}

	remove_task(VictimID)
	UnGagPlayer(VictimID)

	console_print(id, "[%s] Client ^"%s^" has ungagged", amxx, VictimName)

	log_amx("^"%s <%d> <%s>^" has ungagged ^"%s <%d> <%s>^"", AdminName, get_user_userid(id), authid, VictimName, get_user_userid(VictimID), authid2)

	return PLUGIN_HANDLED
}

public client_disconnected(id)
{
	if(g_GagPlayers[id] || user_gagged[id])
	{
		new Nick[32], Authid[35]
		get_user_name(id, Nick, 31)
		get_user_authid(id, Authid, 34)

		get_pcvar_string(g_listen1_flag, temp_cvar1, charsmax(temp_cvar1))
		get_pcvar_string(g_listen2_flag, temp_cvar2, charsmax(temp_cvar2))

		for(new i = 1; i <= g_maxplayers; i++)
		{
			if(get_pcvar_num(g_listenall) && get_user_flags(i) & read_flags(temp_cvar1))
			{
				formatex(g_message, charsmax(g_message), "^4[%s]^1 Gagged player has disconnected (^3%s^1 <SteamID: %s>).", server, Nick, Authid)
				send_message(g_message, id, i)
			}

			if(get_pcvar_num(g_listenall) && get_user_flags(i) & read_flags(temp_cvar2))
			{
				formatex(g_message, charsmax(g_message), "^4[%s]^1 Gagged player has disconnected (^3%s^1 <SteamID: %s>).", server, Nick, protected)
				send_message(g_message, id, i)
			}
		}
	}
}

public client_infochanged(id)
{
	if(g_GagPlayers[id] || user_gagged[id])
	{
		new newname[32], oldname[32]
		get_user_info(id, "name", newname, 31)
		get_user_name(id, oldname, 31)

		if(!equal(oldname, newname))
		{
			set_user_info(id, "name", oldname)
		}
	}
}

public task_UnGagPlayer(TaskParm[])
{
	new VictimName[32], authid2[32]
	get_user_name(TaskParm[0], VictimName, 31)
	get_user_authid(TaskParm[0], authid2, 31)

	color_chat(0, "^x04[%s]^x01 Player ^"^x03%s^x01^" is no longer gagged.", server, VictimName)

	log_amx("^"%s <%d> <%s>^" is no longer gagged", VictimName, get_user_userid(TaskParm[0]), authid2)

	UnGagPlayer(TaskParm[0])
}

stock UnGagPlayer(id)
{
	g_GagPlayers[id] = 0
#if GagReason == 1
	setc(gs_GagReason[id], 31, 0)
#endif
}

#if AllowOtherPlugin2Interface == 1
public func_AddGag(id)
{
	g_GagPlayers[id] = 7
	new TaskParm[1]
	TaskParm[0] = id
	set_task(DefaultGagTime, "task_UnGagPlayer", id, TaskParm, 1)
}

public func_RemoveGag(id)
{
	remove_task(id)
	UnGagPlayer(id)
}
#endif

stock ActionGag(id)
{
	new nGagTime = get_pcvar_num(gagtime)
	set_task(float(nGagTime), "ActionUngag", id)

	user_gagged[id] = true

	new szUsername[32], authid2[32]
	get_user_name(id, szUsername, 31)
	get_user_authid(id, authid2, 31)

	color_chat(0, "^x04[%s]^x01 Player ^"^x03%s^x01^" has gagged for swearing for ^"^x03%s^x01^" minutes.", server, szUsername, time)
	
	log_amx("^"%s <%d> <%s>^" has gagged for not following the rules", szUsername, get_user_userid(id), authid2)

	return
}

public ActionUngag(id)
{
	new szName[32], authid2[32]
	get_user_name(id, szName, 31)
	get_user_authid(id, authid2, 31)

	if(user_gagged[id])
	{
		color_chat(0, "^x04[%s]^x01 Player ^"^x03%s^x01^" is no longer gagged.", server, szName)
		user_gagged[id] = false
	}

	log_amx("^"%s <%d> <%s>^" is no longer gagged", szName, get_user_userid(id), authid2)

	return
}

public cmdSwearUnGag(id, level, cid)
{
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED
	}

	new target[32], szAdmin[32], szName[32], authid[32], authid2[32]
	read_argv(1, target, 31)
	new iTarget = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY)

	get_user_name(id, szAdmin, 31)
	get_user_name(iTarget, szName, 31)
	get_user_authid(id, authid, 31)
	get_user_authid(iTarget, authid2, 31)

	if(!iTarget)
		return PLUGIN_HANDLED

	if(!user_gagged[iTarget])
	{
		console_print(id, "[%s] Client ^"%s^" is already ungagged", amxx, szName)
		return PLUGIN_HANDLED
	}

	user_gagged[iTarget] = false

	client_print(0, print_chat, "ADMIN %s: has ungagged %s", szAdmin, szName)

	console_print(id, "[%s] Client ^"%s^" has ungagged", amxx, szName)

	log_amx("^"%s <%d> <%s>^" has ungagged ^"%s <%d> <%s>^"", szAdmin, get_user_userid(id), authid, szName, get_user_userid(iTarget), authid2)

	return 1
}

send_message(const message[], const id, const i)
{
	message_begin(MSG_ONE, g_saytxt, {0, 0, 0}, i)
	write_byte(id)
	write_string(message)
	message_end()
}

stock color_chat(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)

	replace_all(msg, 190, "^x01", "^1")
	replace_all(msg, 190, "^x03", "^3")
	replace_all(msg, 190, "^x04", "^4")

	if(id) players[0] = id; else get_players(players, count, "ch")
	{
		for(new i = 0; i < count; i++)
		{
			if(is_user_connected(players))
			{
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
				write_byte(players)
				write_string(msg)
				message_end()
			}
		}
	}
}
RoyalServer
lexz
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 917
Joined: 02 Nov 2020, 01:57
Detinator Steam: Da
Fond eXtream: 0
Discord: lexzor#0630
Has thanked: 71 times
Been thanked: 136 times

04 Jan 2023, 17:03

porcarie de plugin, nu stiu daca merge, incearca:

Code: Select all

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <nvault>

#define PLUGIN "GAG Manager"
#define VERSION "1.9"
#define AUTHOR "ExtreamCS"

#define amxx "AMXX"
#define server "ExtreamCS"
#define protected "*** PROTECTED ***"
#define time "5"

#define DefaultGagTime 600.0
#define GagReason 1
#define MaxPlayers 32
#define AllowOtherPlugin2Interface 1
#define MAX_WORDS 192

new g_swearsNames[MAX_WORDS][32]
new g_swearsNum
new gagtime
new bool:user_gagged[33]
new g_GagPlayers[MaxPlayers+1]
#if GagReason == 1
new gs_GagReason[MaxPlayers+1][48]
#endif
new g_listenall, g_listen1_flag, g_listen2_flag
new temp_cvar1[2], temp_cvar2[2]
new g_message[192], g_maxplayers, g_saytxt

new g_nVault;
new const g_sznVaultName[] = "gag_manager";

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_dictionary("common.txt")

    register_concmd("amx_gag", "cmdGag", ADMIN_KICK, "<nick or #userid> - get gag player")
    register_concmd("amx_ungag", "cmdUnGag", ADMIN_KICK, "<nick or #userid> - get ungag player")
    register_concmd("amx_swearungag", "cmdSwearUnGag", ADMIN_KICK, "<name or #userid> - get ungag player")

    register_clcmd("say", "cmdSay")
    register_clcmd("say_team", "cmdSay")

    register_clcmd("say", "cmdSaySwear")
    register_clcmd("say_team", "cmdSaySwear")

    g_listenall = register_cvar("listenall", "1", FCVAR_PROTECTED)
    g_listen1_flag = register_cvar("listenall_flag", "b", FCVAR_PROTECTED)
    g_listen2_flag = register_cvar("listenprotected_flag", "z", FCVAR_PROTECTED)

    gagtime = register_cvar("mp_sweargagtime", "300", FCVAR_PROTECTED)

    g_saytxt = get_user_msgid("SayText")
    g_maxplayers = get_maxplayers()

    g_nVault = nvault_open(g_sznVaultName);

    if(g_nVault == INVALID_HANDLE)
    {
        set_fail_state("Couldn't open ^"%s^" vault file", g_sznVaultName);
    }

    readList()
}

public plugin_end()
{
    nvault_close(g_nVault)
}

readList()
{
	new szCustomDir[64]
	new filename[64]
	get_configsdir(szCustomDir, 63)
	format(filename, 63, "%s/gag_manager.ini", szCustomDir)

	if(!file_exists(filename))
	{
		return 
	}

	new iLen

	while(g_swearsNum < MAX_WORDS && read_file(filename, g_swearsNum , g_swearsNames[g_swearsNum][1], 30, iLen))
	{
		if(g_swearsNames[g_swearsNum][0] == ';')
			continue

		g_swearsNames[g_swearsNum][0] = iLen
		++g_swearsNum
	}
}

public cmdSaySwear(id)
{
	if((get_user_flags(id) & read_flags("b")) || !id)
		return PLUGIN_CONTINUE

	if(user_gagged[id])
	{
		color_chat(id, "^x04[%s]^x01 You were gagged for not following the rules.", server)
		return PLUGIN_HANDLED
	}

	new szSaid[192]
	read_args(szSaid, 191)
	new bool:found = false
	new pos, i = 0

	while(i < g_swearsNum)
	{
		if((pos = containi(szSaid, g_swearsNames[1])) != -1)
		{
			new len = g_swearsNames[0][i]
			while(len--)
			szSaid[pos++] = '*'
			found = true
			continue
		}
		++i
	}

	if(found)
	{
		new cmd[32]
		read_argv(0, cmd, 31)
		ActionGag(id)
		return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

public cmdSay(id)
{
	if(!g_GagPlayers[id])
		return PLUGIN_CONTINUE

	new cmd[5]
	read_argv(0, cmd, 4)

	if(cmd[3] == '_')
	{
		if(g_GagPlayers[id] & 2)
		{
#if GagReason == 1
			color_chat(id, "^x04[%s]^x01 You were gagged for not following the rules.", server)
#endif
			return PLUGIN_HANDLED
		}
	}
	else if(g_GagPlayers[id] & 1)
	{
#if GagReason == 1
		color_chat(id, "^x04[%s]^x01 You were gagged for not following the rules.", server)
#endif
		return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

public cmdGag(id, level, cid)
{
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED
	}

	new arg[32], VictimID

	read_argv(1, arg, 31)
	VictimID = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY)

	new s_Flags[4], VictimName[32], AdminName[32], flags, ShowFlags[32], CountFlags, s_GagTime[8], Float:f_GagTime, authid[32], authid2[32]

	get_user_name(id, AdminName, 31)
	get_user_name(VictimID, VictimName, 31)
	get_user_authid(id, authid, 31)
	get_user_authid(VictimID, authid2, 31)

	if(!VictimID)
		return PLUGIN_HANDLED

	if(g_GagPlayers[VictimID])
	{
		console_print(id, "[%s] Client ^"%s^" is already gagged", amxx, VictimName)
		return PLUGIN_HANDLED
	}

	read_argv(2, arg, 31)

	if(!arg[0])
	{
		f_GagTime = DefaultGagTime
		format(s_Flags, 7, "ab")
	}
	else
	{
		if(contain(arg, "m")!=-1 && contain(arg, "!")==-1)
		{
			copyc(s_GagTime, 7, arg, 'm')
			f_GagTime = floatstr(s_GagTime) * 60
		}
		else
		if(isdigit(arg[0]) && contain(arg, "!")==-1)
		{
			format(s_GagTime, 7, arg)
			f_GagTime = floatstr(s_GagTime)
		}

		read_argv(3, arg, 8)

		if(!arg[0])
			format(s_Flags, 7, "ab")
		else
		if(contain(arg, "!")==-1)
			format(s_Flags, 7, arg)
		else
		if(contain(arg, "!")!=-1)
			format(s_Flags, 7, "ab")

		if(f_GagTime == 0.0)
		{
			read_argv(2, arg, 8)
			if(contain(arg, "!")!=-1)
				format(s_Flags, 3, "ab")
			else
				format(s_Flags, 3, arg)
			f_GagTime = DefaultGagTime
		}
	}

	flags = read_flags(s_Flags)
	g_GagPlayers[VictimID] = flags
	new TaskParm[1]
	TaskParm[0] = VictimID
	set_task(f_GagTime, "task_UnGagPlayer", VictimID, TaskParm, 1)

	CountFlags = 0

	if(flags & 1)
	{
		format(ShowFlags, 31, "say")
		CountFlags++
	}

	if(flags & 2)
	{
		if(CountFlags)
			format(ShowFlags, 31, "%s / say_team", ShowFlags)

		if(!CountFlags)
			format(ShowFlags, 31, "say_team")
	}

	switch(get_cvar_num("amx_show_activity"))
	{
#if GagReason == 1
		case 2:   client_print(0, print_chat, "ADMIN %s: has gagged %s from speaking for %0.0f minutes, for: (%s)", AdminName, VictimName, (f_GagTime / 60), ShowFlags)
   		case 1:   client_print(0, print_chat, "ADMIN: has gagged %s from speaking for %0.0f minutes, for: (%s)", VictimName, (f_GagTime / 60), ShowFlags)
#endif
	}

	console_print(id, "[%s] Client ^"%s^" has gagged", amxx, VictimName)

	log_amx("^"%s <%d> <%s>^" has gagged ^"%s <%d> <%s>^"", AdminName, get_user_userid(id), authid, VictimName, get_user_userid(VictimID), authid2)

	return PLUGIN_HANDLED
}

public cmdUnGag(id, level, cid)
{
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED
	}

	new arg[32], VictimID
	read_argv(1, arg, 31)

	VictimID = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY)

	new AdminName[32], VictimName[32], authid[32], authid2[32]

	get_user_name(id, AdminName, 31)
	get_user_name(VictimID, VictimName, 31)
	get_user_authid(id, authid, 31)
	get_user_authid(VictimID, authid2, 31)

	if(!VictimID)
		return PLUGIN_HANDLED

	if(!g_GagPlayers[VictimID])
	{
		console_print(id, "[%s] Client ^"%s^" is already ungagged", amxx, VictimName)
		return PLUGIN_HANDLED
	}

	switch(get_cvar_num("amx_show_activity"))
	{
   		case 2:   client_print(0, print_chat, "ADMIN %s: has ungagged %s", AdminName, VictimName)
   		case 1:   client_print(0, print_chat, "ADMIN: has ungagged %s", VictimName)

  	}

	remove_task(VictimID)
	UnGagPlayer(VictimID)

	console_print(id, "[%s] Client ^"%s^" has ungagged", amxx, VictimName)

	log_amx("^"%s <%d> <%s>^" has ungagged ^"%s <%d> <%s>^"", AdminName, get_user_userid(id), authid, VictimName, get_user_userid(VictimID), authid2)

	return PLUGIN_HANDLED
}

public client_disconnected(id)
{
    if(g_GagPlayers[id] || user_gagged[id])
    {
        new Nick[32], Authid[35]
        get_user_name(id, Nick, 31)
        get_user_authid(id, Authid, 34)
        save_gag(id, Authid);

        get_pcvar_string(g_listen1_flag, temp_cvar1, charsmax(temp_cvar1))
        get_pcvar_string(g_listen2_flag, temp_cvar2, charsmax(temp_cvar2))

        for(new i = 1; i <= g_maxplayers; i++)
        {
            if(get_pcvar_num(g_listenall) && get_user_flags(i) & read_flags(temp_cvar1))
            {
                formatex(g_message, charsmax(g_message), "^4[%s]^1 Gagged player has disconnected (^3%s^1 <SteamID: %s>).", server, Nick, Authid)
                send_message(g_message, id, i)
            }

            if(get_pcvar_num(g_listenall) && get_user_flags(i) & read_flags(temp_cvar2))
            {
                formatex(g_message, charsmax(g_message), "^4[%s]^1 Gagged player has disconnected (^3%s^1 <SteamID: %s>).", server, Nick, protected)
                send_message(g_message, id, i)
            }
        }
    }
}

save_gag(const id, const buffer[])
{
    g_GagPlayers[id] = 0;
    user_gagged[id] = false;
    new szGagTime[11];
    num_to_str(get_pcvar_num(gagtime), szGagTime, charsmax(szGagTime));
    nvault_set(g_nVault, buffer, szGagTime)
}

public client_authorized(id)
{
    new iTs, szAuthId[64], szData[11];
    get_user_authid(id, szAuthId, charsmax(szAuthId));

    if(nvault_lookup(g_nVault, szAuthId, szData, charsmax(szData), iTs))
    {
        g_GagPlayers[id] |= 1;
        user_gagged[id] = true;
    }
}

public client_infochanged(id)
{
	if(g_GagPlayers[id] || user_gagged[id])
	{
		new newname[32], oldname[32]
		get_user_info(id, "name", newname, 31)
		get_user_name(id, oldname, 31)

		if(!equal(oldname, newname))
		{
			set_user_info(id, "name", oldname)
		}
	}
}

public task_UnGagPlayer(TaskParm[])
{
	new VictimName[32], authid2[32]
	get_user_name(TaskParm[0], VictimName, 31)
	get_user_authid(TaskParm[0], authid2, 31)

	color_chat(0, "^x04[%s]^x01 Player ^"^x03%s^x01^" is no longer gagged.", server, VictimName)

	log_amx("^"%s <%d> <%s>^" is no longer gagged", VictimName, get_user_userid(TaskParm[0]), authid2)

	UnGagPlayer(TaskParm[0])
}

stock UnGagPlayer(id)
{
	g_GagPlayers[id] = 0
#if GagReason == 1
	setc(gs_GagReason[id], 31, 0)
#endif
    new szAuthId[64], szTemp[1], iTs;
    get_user_authid(id, szAuthId, charsmax(szAuthId));

    if(nvault_lookup(g_nVault, szAuthId, szTemp, charsmax(szTemp), iTs))
        nvault_remove(g_nVault, szAuthId)
}

#if AllowOtherPlugin2Interface == 1
public func_AddGag(id)
{
	g_GagPlayers[id] = 7
	new TaskParm[1]
	TaskParm[0] = id
	set_task(DefaultGagTime, "task_UnGagPlayer", id, TaskParm, 1)
}

public func_RemoveGag(id)
{
	remove_task(id)
	UnGagPlayer(id)
}
#endif

stock ActionGag(id)
{
	new nGagTime = get_pcvar_num(gagtime)
	set_task(float(nGagTime), "ActionUngag", id)

	user_gagged[id] = true

	new szUsername[32], authid2[32]
	get_user_name(id, szUsername, 31)
	get_user_authid(id, authid2, 31)

	color_chat(0, "^x04[%s]^x01 Player ^"^x03%s^x01^" has gagged for swearing for ^"^x03%s^x01^" minutes.", server, szUsername, time)
	
	log_amx("^"%s <%d> <%s>^" has gagged for not following the rules", szUsername, get_user_userid(id), authid2)

	return
}

public ActionUngag(id)
{
	new szName[32], authid2[32]
	get_user_name(id, szName, 31)
	get_user_authid(id, authid2, 31)

	if(user_gagged[id])
	{
		color_chat(0, "^x04[%s]^x01 Player ^"^x03%s^x01^" is no longer gagged.", server, szName)
		user_gagged[id] = false
	}

	log_amx("^"%s <%d> <%s>^" is no longer gagged", szName, get_user_userid(id), authid2)

	return
}

public cmdSwearUnGag(id, level, cid)
{
	if(!cmd_access(id, level, cid, 2))
	{
		return PLUGIN_HANDLED
	}

	new target[32], szAdmin[32], szName[32], authid[32], authid2[32]
	read_argv(1, target, 31)
	new iTarget = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY)

	get_user_name(id, szAdmin, 31)
	get_user_name(iTarget, szName, 31)
	get_user_authid(id, authid, 31)
	get_user_authid(iTarget, authid2, 31)

	if(!iTarget)
		return PLUGIN_HANDLED

	if(!user_gagged[iTarget])
	{
		console_print(id, "[%s] Client ^"%s^" is already ungagged", amxx, szName)
		return PLUGIN_HANDLED
	}

	user_gagged[iTarget] = false

	client_print(0, print_chat, "ADMIN %s: has ungagged %s", szAdmin, szName)

	console_print(id, "[%s] Client ^"%s^" has ungagged", amxx, szName)

	log_amx("^"%s <%d> <%s>^" has ungagged ^"%s <%d> <%s>^"", szAdmin, get_user_userid(id), authid, szName, get_user_userid(iTarget), authid2)

	return 1
}

send_message(const message[], const id, const i)
{
	message_begin(MSG_ONE, g_saytxt, {0, 0, 0}, i)
	write_byte(id)
	write_string(message)
	message_end()
}

stock color_chat(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)

    replace_all(msg, 190, "^x01", "^1")
    replace_all(msg, 190, "^x03", "^3")
    replace_all(msg, 190, "^x04", "^4")

    if(id) players[0] = id; else get_players(players, count, "ch")
    {
        for(new i = 0, iPlayer; i < count; i++)
        {
            iPlayer = players[i]
            if(is_user_connected(iPlayer))
            {
                message_begin(MSG_ONE_UNRELIABLE, g_saytxt, _, iPlayer)
                write_byte(iPlayer)
                write_string(msg)
                message_end()
            }
        }
    }
}
Sounds.
Membru, skill 0
Membru, skill 0
Posts: 40
Joined: 19 Dec 2015, 11:37
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

04 Jan 2023, 20:05

nu mai merge auto gagu, cand cineva injura nu ii mai da gag automat

edit: l am testat iar si nu merge, tot imi ia numele celui cu gag
User avatar
kidd0x
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 1054
Joined: 06 Oct 2018, 14:41
Detinator Steam: Da
SteamID: /id/kidd0x/
Reputatie: Utilizator neserios (tepar!)
Fond eXtream: 0
Location: Constangeles
Discord: kidd0x
Has thanked: 172 times
Been thanked: 81 times

05 Jan 2023, 00:19

Din 1001 plugine de gag toate rahaturile le folositi.. Asta e cel mai bun https://forums.alliedmods.net/showthread.php?t=101937
Sounds.
Membru, skill 0
Membru, skill 0
Posts: 40
Joined: 19 Dec 2015, 11:37
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

05 Jan 2023, 00:49

Mersi frumos, si un plugin pentru auto gag ?

edit: pluginu ce mi l ai dat tu nu merge pentru gag permanent, cand pun 0 tot 1 minut da
User avatar
kidd0x
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 1054
Joined: 06 Oct 2018, 14:41
Detinator Steam: Da
SteamID: /id/kidd0x/
Reputatie: Utilizator neserios (tepar!)
Fond eXtream: 0
Location: Constangeles
Discord: kidd0x
Has thanked: 172 times
Been thanked: 81 times

05 Jan 2023, 19:30

Sounds. wrote:
05 Jan 2023, 00:49
Mersi frumos, si un plugin pentru auto gag ?

edit: pluginu ce mi l ai dat tu nu merge pentru gag permanent, cand pun 0 tot 1 minut da
Invatati sa citit tot topic-ul pluginului O.o
Sounds.
Membru, skill 0
Membru, skill 0
Posts: 40
Joined: 19 Dec 2015, 11:37
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0

06 Jan 2023, 00:58

Invatati sa lasati figurile astea de online copiilor, ca eu v am cerut sa imi modificati ceva, nu sa aud fel si fel de pareri
User avatar
kidd0x
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 1054
Joined: 06 Oct 2018, 14:41
Detinator Steam: Da
SteamID: /id/kidd0x/
Reputatie: Utilizator neserios (tepar!)
Fond eXtream: 0
Location: Constangeles
Discord: kidd0x
Has thanked: 172 times
Been thanked: 81 times

06 Jan 2023, 01:26

"Copiii" astia va ajuta sa va faceti tentativele de servere pe care le tineti maxim o luna si dupa le inchideti. Ti-am dat un plugin care e de x100 ori mai ok decat ce ai postat tu
User avatar
Rainq
Membru, skill +2
Membru, skill +2
Posts: 681
Joined: 21 Jul 2015, 19:50
Detinator Steam: Da
CS Status: Retras
Detinator server CS: zm.extreamcs.com
SteamID: mrainq
Reputatie: Fost super moderator
Fost detinator ZM.eXtreamCS.COM
Fost Membru Club eXtreamCS (trei luni)
Fond eXtream: 0
Location: Bucharest
Discord: manuraiders
Has thanked: 29 times
Been thanked: 51 times
Contact:

06 Jan 2023, 15:25

Code: Select all

#include <amxmodx>
#include <amxmisc>

#define ACCESS 			ADMIN_IMMUNITY
#define WORDS			256
#define SWEAR_GAGMINUTES	3
#define SHOW

new const g_FileName[] = "gag_words.ini";

new 
bool:g_Gaged[ 33 ], g_GagTime[ 33 ],
bool:g_SwearGag[ 33 ], bool:g_CmdGag[ 33 ],
bool:g_NameChanged[33];

new g_reason[ 32 ], g_admin[ 32 ], g_name[ 33 ][ 32 ];

new g_WordsFile[ 128 ];
new g_Words[ WORDS ][ 32 ], g_Count, g_Len;

new point, g_msgsaytext;

public plugin_init() 
{
	register_plugin("Advance Gag", "2.2", "anakin_cstrike/ update -B1ng0-")
	
	register_concmd( "amx_gag", "gag_cmd", ACCESS,"- <nume> <minute> <motiv> - Da gag jucatorului" );
	register_concmd( "amx_ungag", "ungag_cmd", ACCESS, "- <nume> - Scoate gagul" );
	register_clcmd( "say", "check" );
	register_clcmd( "say_team", "check" );
	
	point = get_cvar_pointer( "amx_show_activity" );
	g_msgsaytext = get_user_msgid( "SayText" );
	
}

public plugin_cfg()
{
	static dir[ 64 ];
	get_localinfo( "amxx_configsdir", dir, 63 );
	formatex( g_WordsFile , 127 , "%s/%s" , dir, g_FileName );
	
	if( !file_exists( g_WordsFile ) )
		write_file( g_WordsFile, "[Gag Words]", -1 );
		
	new Len;
	
	while( g_Count < WORDS && read_file( g_WordsFile, g_Count ,g_Words[ g_Count ][ 1 ], 30, Len ) )
	{
		g_Words[ g_Count ][ 0 ] = Len;
		g_Count++;
	}
}

public client_putinserver(id)
{  	
	 g_Gaged[ id ] = false;
	 g_SwearGag[ id ] = false;	
}

public gag_cmd( id, level, cid )
{
	if( !cmd_access( id, level, cid, 4 ) )
		return PLUGIN_HANDLED;  	
		
	new arg[ 32 ], arg2[ 6 ], reason[ 32 ];
	new name[ 32 ], namet[ 32 ];
	new minutes;
	
  	read_argv(1, arg, 31)

  	new player = cmd_target(id, arg, 9)

  	if (!player) 
      	return PLUGIN_HANDLED
	
	read_argv( 1, arg, sizeof arg - 1 );
	read_argv( 2, arg2, sizeof arg2 - 1 );
	read_argv( 3, reason, sizeof reason - 1 );
		
	get_user_name( id, name, 31 );
	
	copy( g_admin, 31, name );
	copy( g_reason, 31, reason );
	remove_quotes( reason );
	
	minutes = str_to_num( arg2 );
	
	new target = cmd_target( id, arg, 10 );
	if( !target)

        target = cmd_target( id, arg, CMDTARGET_OBEY_IMMUNITY );

	if( g_Gaged[ target ] )
	{
		console_print( id, "Jucatorul are deja gag!" );
		return PLUGIN_HANDLED;
	}
	
	get_user_name( target, namet, 31 );
	copy( g_name[ target ], 31, namet );
	
	g_CmdGag[ target ] = true;
	g_Gaged[target] = true;
	g_GagTime[ target ] = minutes;
	
	print( 0, "^x04[ZM] %s:^x01 Gag jucatorul^x03 %s^x01 pentru^x03 [%d]^x01 minut(e). Motiv:^x03 %s",get_pcvar_num( point ) == 2 ? name : "", namet, minutes, reason );
	
	set_task( 60.0, "count", target + 123, _, _, "b" );
	
	return PLUGIN_HANDLED;
}

public ungag_cmd( id,level, cid )
{
	if( !cmd_access( id, level, cid, 2 ) )
		return PLUGIN_HANDLED;
		
	new arg[ 32 ], reason[ 32 ], name[ 32 ];
	read_argv( 1, arg, sizeof arg - 1 );
	read_argv( 2, reason, sizeof reason - 1 );
	get_user_name( id, name, sizeof name - 1 );
	remove_quotes( reason );
	
	new target = cmd_target( id, arg, 11 );
	if( !target )
		return PLUGIN_HANDLED;
	new namet[ 32 ];
	get_user_name( target, namet, sizeof namet - 1 );
	
	if( !g_Gaged[ target ] )
	{
		console_print( id, "Jucatorul %s nu are gag.", namet );
		return PLUGIN_HANDLED;
	}
	
	g_Gaged[ target ] = false;
	g_SwearGag[ target ] = false;
	
	if( g_NameChanged[ target ] )
		client_cmd( target, "name ^"%s^"", g_name[ target ] );
		
	g_NameChanged[ target ] = false;
	
	remove_task( target + 123 );
	
	print( 0, "^x04[ZM] %s:^x01 UnGag jucatorul^x03 %s",get_pcvar_num( point ) == 2 ? name : "", namet );
	
	return PLUGIN_HANDLED;
}
	
public count( task )
{
	new index = task - 123;
	if( !is_user_connected( index ) )
		return 0;
		
	g_GagTime[index] -= 1;
	
	if( g_GagTime[ index ] <= 0 )
	{
		remove_task( index + 123 );
		
		print( index, "^x04[ZM] Ai primit UnGag cu succes!" );
		g_Gaged[ index ] = false;
	
		if( g_NameChanged[ index ] )
			client_cmd( index, "name ^"%s^"", g_name[ index ] );
		
		return 0;
	}
	
	return 1;
}

public check( id )
{
	new said[ 192 ];
	read_args( said, sizeof said - 1 );
	
	if( !strlen( said ) )
		return PLUGIN_CONTINUE;
		
	if( g_Gaged[ id ] )
	{
		if( g_CmdGag[ id ] )
		{
			print( id,"^x04[ZM] Ai primit gag de la: %s. Au mai ramas %d minut(e)" ,g_admin, g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			print( id,"^x04[ZM] Motivul Gagului: %s", g_reason );
			
			return PLUGIN_HANDLED;
		
		} else if( g_SwearGag[ id ] ) {
          		print( id, "^x04[ZM] Ai gag pentru limbaj vulgar sau reclama.")
			print( id, "^x04[ZM] Au mai ramas %d minut(e)",  g_GagTime[ id ], g_GagTime[ id ] == 1 ? "" : "s" );
			return PLUGIN_HANDLED;
		}
	} else {
		
		new bool:g_Sweared, i, pos;
		
		for( i = 0; i < g_Count; ++i )
		{
			if( ( pos = containi( said, g_Words[ i ][ 1 ] ) ) != -1 )
			{
				g_Len = g_Words[ i ][ 0 ];
				
				while( g_Len-- )
					said[ pos++ ] = '*';
					
				g_Sweared = true;
				continue;
			}
		}
		
		if( g_Sweared && !(get_user_flags(id) & ADMIN_IMMUNITY))
		{
			new cmd[ 32 ], name[ 32 ];
			
			get_user_name( id, name, sizeof name - 1 );
			read_argv( 0, cmd, sizeof cmd - 1 );
			copy( g_name[ id ], 31, name );
			
			engclient_cmd( id, cmd, said );
			g_Gaged[ id ] = true;
			g_CmdGag[ id ] = false;
			
			g_SwearGag[ id ] = true;
			g_GagTime[ id ] = SWEAR_GAGMINUTES;
			
			print( id, "Ai gag pentru limbaj vulgar sau reclama." );
		
			set_task( 60.0, "count",id+123,_,_,"b");
			
			return PLUGIN_HANDLED;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public client_disconnect(id) 
{ 
	if(g_Gaged[id]) 
	{
	 new Nick[32],Authid[35],usrip[32]
	 get_user_name(id,Nick,31)
	 get_user_ip(id,usrip,31);
	 get_user_authid(id,Authid,34) 
	 print(0, "^x04[ZM]^x01 Jucatorul cu gag^x03 %s^x01 [Ip:^x03 %s^x01] a parasit serverul.",Nick,usrip)		
				
	}
}

print( id, const message[ ], { Float, Sql, Result, _ }:... )
{
	new Buffer[ 128 ], Buffer2[ 128 ];
	
	formatex( Buffer2, sizeof Buffer2 - 1, "%s", message );
	vformat( Buffer, sizeof Buffer - 1, Buffer2, 3 );
	
	if( id )
	{
		message_begin( MSG_ONE, g_msgsaytext, _,id );
		write_byte( id );
		write_string( Buffer) ;
		message_end();
	
	} else {
		new players[ 32 ], index, num, i;
		get_players( players, num, "ch" );
		
		for( i = 0; i < num; i++ )
		{
			index = players[ i ];
			if( !is_user_connected( index ) ) continue;
			
			message_begin( MSG_ONE, g_msgsaytext, _, index );
			write_byte( index );
			write_string( Buffer );
			message_end();
		}
	}
}
Image
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests