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

https://discord.gg/43gGDQe6tS

Şapka Eklenti İsteği

Eklenti sorunlarınız ve özel eklenti istekleriniz

Moderatör: Moderatörler


Konu Sahibi
xtrice20
Mesajlar: 20
Kayıt: Çrş Eki 14, 2020 1:54 am

Şapka Eklenti İsteği

Mesaj gönderen xtrice20 »

CT ve T ayrı olacak şekilde şapka eklenecek ve RCON yetkisine kayıtlı olacak. Şimdiden teşekkürler.

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

bestcore
Mesajlar: 1625
Kayıt: Cmt Eyl 30, 2017 12:44 pm
Konum: Samsun

Şapka Eklenti İsteği

Mesaj gönderen bestcore »

Satır 6'dan hangi yetkide şapka olmasını istiyorsanız ayarlayabilirsiniz, ayriyetten satır 10 ve 11'den şapka modellerini de ayarlayabilirsiniz. Denemedim, deneyip dönüş yapabilirsiniz.

Kod: Tümünü seç

#pragma semicolon 1

#include <amxmodx>
#include <reapi>

#define ADMIN_HAT     ADMIN_RCON

new const g_szModel[][] =
{
	"models/hat1.mdl",     // Terrorist Hat.
	"models/hat2.mdl"      // Counter-Terrorst Hat.
};

new g_iEnt[MAX_PLAYERS+1],
	g_iModelIndex[sizeof(g_szModel)];

public client_putinserver(id)
{
	RemoveTheHat(id);
	if(get_user_flags(id) & ADMIN_HAT)
	{
		set_task(1.0, "CreateHat", id);
	}
}
public client_disconnected(id)
{
	RemoveTheHat(id);
	g_iEnt[id] = 0;
}
public CreateHat(const id)
{
	g_iEnt[id] = rg_create_entity("info_target");

	new TeamName:iTeam = get_member(id, m_iTeam);

	if(!is_nullent(g_iEnt[id]))
	{
		switch(iTeam)
		{
			case TEAM_TERRORIST:
			{
				set_entvar(g_iEnt[id], var_model, g_szModel[0]);
				set_entvar(g_iEnt[id], var_modelindex, g_iModelIndex[0]);
			}
			case TEAM_CT:
			{
				set_entvar(g_iEnt[id], var_model, g_szModel[1]);
				set_entvar(g_iEnt[id], var_modelindex, g_iModelIndex[1]);
			}
		}
		set_entvar(g_iEnt[id], var_movetype, MOVETYPE_FOLLOW);
		set_entvar(g_iEnt[id], var_aiment, id);
	}
}
RemoveTheHat(const id)
{
	if(!is_nullent(g_iEnt[id]))
	{
		set_entvar(g_iEnt[id], var_flags, FL_KILLME);
		g_iEnt[id] = 0;
	}
}
public plugin_precache()
{
	for(new i = 0; i < sizeof(g_szModel); i++)
	{
		g_iModelIndex[i] = precache_model(fmt("%s", g_szModel[i]));
	}
}

Link:
Linklerini gizle
Linki Kopyala

Konu Sahibi
xtrice20
Mesajlar: 20
Kayıt: Çrş Eki 14, 2020 1:54 am

Şapka Eklenti İsteği

Mesaj gönderen xtrice20 »

Değişmedi CT ve T aynı şapkaya sahip

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

bestcore
Mesajlar: 1625
Kayıt: Cmt Eyl 30, 2017 12:44 pm
Konum: Samsun

Şapka Eklenti İsteği

Mesaj gönderen bestcore »

xtrice20 yazdı: Pzr May 16, 2021 1:17 am Değişmedi CT ve T aynı şapkaya sahip
Diğerini denememiştim, bunu kullanın çalışıyor.

Kod: Tümünü seç

#pragma semicolon 1

#include <amxmodx>
#include <reapi>

#define ADMIN_HAT     ADMIN_RCON

new const g_szModel[][] =
{
	"models/hat1.mdl",     // Terrorist Hat.
	"models/hat2.mdl"      // Counter-Terrorst Hat.
};

new g_iEnt[MAX_PLAYERS+1],
	g_iModelIndex[sizeof(g_szModel)];

public plugin_init()
{
	register_plugin("Hat for Authorization", "0.1", "` BesTCore;");
	
	RegisterHookChain(RG_CBasePlayer_Spawn, "RG_CBasePlayer_Spawn_Post", .post = true);
}
public RG_CBasePlayer_Spawn_Post(id)
{
	if(get_member(id, m_bJustConnected))
	{
		return;
	}
	
	if(get_user_flags(id) & ADMIN_HAT)
	{
		CreateModel(id);
	}
}
public CreateHat(const id)
{
	g_iEnt[id] = rg_create_entity("info_target");

	CreateModel(id);
}
public CreateModel(id)
{
	new TeamName:iTeam = get_member(id, m_iTeam);

	switch(iTeam)
	{
		case TEAM_TERRORIST:
		{
			set_entvar(g_iEnt[id], var_modelindex, g_iModelIndex[0]);
		}
		case TEAM_CT:
		{
			set_entvar(g_iEnt[id], var_modelindex, g_iModelIndex[1]);
		}
	}
	set_entvar(g_iEnt[id], var_movetype, MOVETYPE_FOLLOW);
	set_entvar(g_iEnt[id], var_aiment, id);
}
RemoveTheHat(const id)
{
	if(!is_nullent(g_iEnt[id]))
	{
		set_entvar(g_iEnt[id], var_flags, FL_KILLME);
		g_iEnt[id] = 0;
	}
}
public client_putinserver(id)
{
	if(get_user_flags(id) & ADMIN_HAT)
	{
		CreateHat(id);
	}
}
public client_disconnected(id)
{
	RemoveTheHat(id);
}
public plugin_precache()
{
	for(new i = 0; i < sizeof(g_szModel); i++)
	{
		g_iModelIndex[i] = precache_model(fmt("%s", g_szModel[i]));
	}
}
/code]

Link:
Linklerini gizle
Linki Kopyala
Cevapla