Modificare Plugin

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

01 Nov 2022, 17:39

Salut, am un plugin de teamflash punish insa imi pica serveru, merge totu perfect apoi dupa 2 3 minute pica serveu
| Afiseaza codul
#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "TeamFlash Punish"
#define VERSION "1.9"
#define AUTHOR "reclama"

#define server "CStrikeArena"

#define MAX_PLAYERS	32
#define OFFSET_TEAM	114
#define W_FLASH_MODEL_STRLEN		22
#define FLASH_XPLODE_SOUND_STRLEN	23

const XTRA_OFS_PLAYER = 5

new g_iMaxClients
new g_iHasJustBeenFlashed[MAX_PLAYERS+1]
new g_iFlashTeamCount[MAX_PLAYERS+1]
new g_pcvarTeamFlash, g_pcvarMax, g_pcvarSlap, g_pcvarPunish
new TeamFlashCount[33]
new g_iTextMsg

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

	g_pcvarTeamFlash = register_cvar("tfp_count", "2")
	g_pcvarMax = register_cvar("tfp_max_count", "10")
	g_pcvarPunish = register_cvar("tfp_slap", "2")
	g_pcvarSlap = register_cvar("tfp_slap_amount", "5")

	register_event("ScreenFade", "Event_ScreenFade", "be", "4=255", "5=255", "6=255", "7=200", "7=255")
	register_forward(FM_SetModel, "Forward_SetModel")
	register_forward(FM_EmitSound, "Forward_EmitSound")

	register_clcmd("menuselect 3", "ClientCommand_MenuSelect_3")

	g_iTextMsg = get_user_msgid("TextMsg")
}

public plugin_cfg()
{
	g_iMaxClients = global_get(glb_maxClients)
}

public Forward_SetModel(iEntity, const szModel[])
{
	if(strlen(szModel) != W_FLASH_MODEL_STRLEN)
	{
		return FMRES_IGNORED
	}

	if(szModel[7] != 'w' || szModel[9] != 'f' || szModel[14] != 'b')
	{
		return FMRES_IGNORED
	}

	if(!pev_valid(iEntity))
	{
		return FMRES_IGNORED
	}

	static Float:fVelocity[3]
	pev(iEntity, pev_velocity, fVelocity)

	if(!fVelocity[0] && !fVelocity[1] && !fVelocity[2])
	{
		return FMRES_IGNORED
	}

	static iOwner, iMax
	iOwner = pev(iEntity, pev_owner)
	iMax = get_pcvar_num(g_pcvarMax)

	if(iMax && g_iFlashTeamCount[iOwner] >= iMax)
	{
		engfunc(EngFunc_RemoveEntity, iEntity)
		client_print(iOwner, print_center, "This weapon is not available to you!")
		return FMRES_SUPERCEDE
	}

	set_pev(iEntity, pev_iuser4, iOwner)

	return FMRES_HANDLED
}

public Forward_EmitSound(iEntity, iChannel, const szSample[])
{
	if(strlen(szSample) != FLASH_XPLODE_SOUND_STRLEN)
	{
		return FMRES_IGNORED
	}

	if(szSample[0] != 'w' || szSample[8] != 'f' || szSample[9] != 'l')
	{
		return FMRES_IGNORED
	}

	if(!pev_valid(iEntity))
	{
		return FMRES_IGNORED
	}

	static iFlasher
	iFlasher = pev(iEntity, pev_iuser4)

	if(pev_valid(iFlasher) != 2)
	return FMRES_IGNORED

	static iCount, iPunish
	iCount = get_pcvar_num(g_pcvarTeamFlash)
	iPunish = get_pcvar_num(g_pcvarPunish)

	if(!iCount && !iPunish)
	{
		return FMRES_HANDLED
	}

	static iTeam, id, iFlashed
	iTeam = get_pdata_int(iFlasher, OFFSET_TEAM)
	new iFlasherName[32]
	get_user_name(iFlasher, iFlasherName, 31)

	for(id=1; id<=g_iMaxClients; id++)
	{
		iFlashed = g_iHasJustBeenFlashed[id]

		if(!iFlashed)
			continue

		g_iHasJustBeenFlashed[id] = 0

		if(pev_valid(id) != 2)
			continue

		if(id != iFlasher && get_pdata_int(id, OFFSET_TEAM) == iTeam)
		{
			if(iCount && (iCount==2 || iFlashed==255))
			{
				new iFlashedName[32]
				get_user_name(id, iFlashedName, 31)
				new players[32], num

				if(cs_get_user_team(id) == CS_TEAM_CT)
				{
					get_players(players, num, "ae", "CT")
				}
				else
				if(cs_get_user_team(id) == CS_TEAM_T)
				{
					get_players(players, num, "ae", "TERRORIST")
				}

				color_chat(id, "^x04[%s]^x01 You are team flashed by^x03 %s", server, iFlasherName)
				g_iFlashTeamCount[iFlasher]++
				TeamFlashCount[id]=(TeamFlashCount[id]+1)
				color_chat(iFlasher, "^x04[%s]^x01 You fully flashbanged your teammate. You will be restricted (^3%i ^1of ^3%i^1)", server, TeamFlashCount[id], get_cvar_num("tfp_max_count"))
			}

			if(iPunish && (iPunish==2 || iFlashed==255))
			{
				user_slap(iFlasher, get_pcvar_num(g_pcvarSlap), 0)
			}
		}
	}

	return FMRES_HANDLED
}

public Event_ScreenFade(id)
{
	g_iHasJustBeenFlashed[id] = read_data(7)
}

CantBuyFlashBang(id)
{
	if(CantHaveFlashbangsAnymore(id) && cs_get_user_buyzone(id))
	{
		message_begin(MSG_ONE, g_iTextMsg, .player=id)
		{
			write_byte(4)
			write_string("#Weapon_Not_Available")
		}

		message_end()
		return PLUGIN_HANDLED
	}

	return PLUGIN_CONTINUE
}

CantHaveFlashbangsAnymore(id)
{
	new iMax = get_pcvar_num(g_pcvarMax)
	return (iMax && g_iFlashTeamCount[id] >= iMax)
}

public ClientCommand_MenuSelect_3(id)
{
	const m_iMenuIndex = 205
	const EQUIP_MENU = 10

	if(is_user_alive(id) && get_pdata_int(id, m_iMenuIndex, XTRA_OFS_PLAYER) == EQUIP_MENU && cs_get_user_buyzone(id) && cs_get_user_money(id) >= 200)
	{
		return CantBuyFlashBang(id)
	}

	return PLUGIN_CONTINUE
}

public client_command(id)
{
	new szCommand[7]
	const FLASH_BUYALIAS_STRLEN = 5

	if(read_argv(0, szCommand, charsmax(szCommand)) == FLASH_BUYALIAS_STRLEN && equal(szCommand, "flash"))
	{
		return CantBuyFlashBang(id)
	}

	return PLUGIN_CONTINUE
}

public Cs_InternalCommand( id, szCommand[])
{
	if(equal(szCommand, "flash"))
	{
		return CantBuyFlashBang(id)
	}

	return PLUGIN_CONTINUE
}

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()
			}
		}
	}
}
Last edited by The Kalu on 01 Nov 2022, 20:38, edited 3 times in total.
Reason: Editat si sters reclama din plugin plus raspunsul dublu.
RoyalServer 2
User avatar
d e a l e r -
Membru eXtream
Membru eXtream
Posts: 2463
Joined: 13 Feb 2016, 16:52
Detinator Steam: Da
CS Status: Connection lost
Reputatie: Fost eXtream Mod
Fost Membru Club eXtreamCS (1 luna)
Fond eXtream: 0
Location: Mediaş, Sibiu, România
Discord: dealer1945
Has thanked: 33 times
Been thanked: 79 times
Contact:

06 Nov 2022, 15:36

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

15 Dec 2022, 18:45

up !
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests