Discord sunucumuz açılmıştır, hepinizi bekleriz

https://discord.gg/43gGDQe6tS

Spawn Koruması Plugini Edit

Eklenti sorunlarınız ve özel eklenti istekleriniz

Moderatör: Moderatörler

Kullanıcı avatarı

Konu Sahibi
legendlord
Mesajlar: 22
Kayıt: Cum May 29, 2020 1:00 pm
Server Ip/DNS: 213.238.173.79
Clan İsmi: Secret x.T.c

Spawn Koruması Plugini Edit

Mesaj gönderen legendlord »

Arkadaşlar merhaba, bu plugini başka bir sunucuda kullanıyordum. Csdurağına yüklediğimde hata verdi fakat çalışmasında problem problem yok. Sadece glow 1-2 saniye içinde hemen kayboluyor.

Plugin'i düzeltip bir de koruma bittiğinde sarı renkte "Korumaniz kaldirilmistir." yazısı ekleyebilir misiniz?

Kod: Tümünü seç

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

#pragma semicolon 1

#define OFFSET_TEAM 114
#define fm_cs_get_user_team(%1) get_pdata_int(%1, OFFSET_TEAM)

enum _:CsTeams
{
	CS_TEAM_UNASSIGNED,
	CS_TEAM_T,
	CS_TEAM_CT,
	CS_TEAM_SPECTATOR
};

new const g_team_abrvs[CsTeams][] =
{
	"",
	"t",
	"ct",
	"spec"
};

enum
{
	TYPE_DISABLED,
	TYPE_GODMODE,
	TYPE_NODAMAGE
};

new cvar_type[CsTeams];
new cvar_glow_on[CsTeams];
new cvar_glow_color[CsTeams];
new cvar_time[CsTeams];

new g_protection_type[33];

new g_max_clients;

public plugin_init()
{
	register_plugin("Advanced Spawn Protection", "0.1", "Exolent");
	
	RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
	RegisterHam(Ham_Killed, "player", "FwdPlayerDeath", 1);
	RegisterHam(Ham_TakeDamage, "player", "FwdPlayerDamage");
	
	new cvar[32], value[16];
	for( new team = 1; team < CsTeams; team++ )
	{
		formatex(cvar, sizeof(cvar) - 1, "sp_type_%s", g_team_abrvs[team]);
		cvar_type[team] = register_cvar(cvar, "1");
		
		formatex(cvar, sizeof(cvar) - 1, "sp_glow_on_%s", g_team_abrvs[team]);
		num_to_str(TYPE_GODMODE, value, sizeof(value) - 1);
		cvar_glow_on[team] = register_cvar(cvar, value);
		
		switch( team )
		{
			case CS_TEAM_T:		formatex(value, sizeof(value) - 1, "255 0 0");
			case CS_TEAM_CT:	formatex(value, sizeof(value) - 1, "0 127 255");
			case CS_TEAM_SPECTATOR:	formatex(value, sizeof(value) - 1, "100 100 100");
		}
		formatex(cvar, sizeof(cvar) - 1, "sp_glow_color_%s", g_team_abrvs[team]);
		cvar_glow_color[team] = register_cvar(cvar, value);
		
		formatex(cvar, sizeof(cvar) - 1, "sp_time_%s", g_team_abrvs[team]);
		cvar_time[team] = register_cvar(cvar, "10");
	}
	
	g_max_clients = get_maxplayers();
}

public client_disconnect(client)
{
	RemoveProtection(client);
}

public FwdPlayerSpawn(client)
{
	if( is_user_alive(client) )
	{
		RemoveProtection(client);
		
		new team = fm_cs_get_user_team(client);
		
		new type = get_pcvar_num(cvar_type[team]);
		if( type == TYPE_GODMODE || type == TYPE_NODAMAGE )
		{
			if( get_pcvar_num(cvar_glow_on[team]) )
			{
				static color[16], piece[5], Float:glow[3];
				get_pcvar_string(cvar_glow_color[team], color, sizeof(color) - 1);
				
				strbreak(color, piece, sizeof(piece) - 1, color, sizeof(color) - 1);
				glow[0] = str_to_float(piece);
				
				strbreak(color, piece, sizeof(piece) - 1, color, sizeof(color) - 1);
				glow[1] = str_to_float(piece);
				glow[2] = str_to_float(color);
				
				set_pev(client, pev_renderfx, kRenderFxGlowShell);
				set_pev(client, pev_rendercolor, glow);
				set_pev(client, pev_rendermode, kRenderNormal);
				set_pev(client, pev_renderamt, 16.0);
			}
			
			g_protection_type[client] = type;
			set_task(get_pcvar_float(cvar_time[team]), "TaskRemoveProtection", client);
		}
	}
}

public FwdPlayerDeath(client, killer, shouldgib)
{
	RemoveProtection(client);
}

public FwdPlayerDamage(client, inflictor, attacker, Float:damage, damagebits)
{
	return ( (1 <= attacker <= g_max_clients) && g_protection_type[client] == TYPE_NODAMAGE || g_protection_type[client] == TYPE_GODMODE ) ? HAM_SUPERCEDE : HAM_IGNORED;
}

public TaskRemoveProtection(client)
{
	RemoveProtection(client, false);
}

RemoveProtection(client, bool:removetask=true)
{
	if( g_protection_type[client] )
	{
		g_protection_type[client] = TYPE_DISABLED;
		
		if( removetask )
		{
			remove_task(client);
		}
		
		set_pev(client, pev_renderfx, kRenderFxNone);
	}
}

Link:
Linklerini gizle
Linki Kopyala