1. sayfa (Toplam 1 sayfa)
Spawn Koruma
Gönderilme zamanı: Pzt May 17, 2021 2:52 pm
gönderen ` White*
Oyuncu doğduğunda 5 saniye hasar alamayacak ancak 3 saniye sonra hasar verebilecek.
Bu tarz bir eklenti arıyorum yardımcı olur musunuz?
Spawn Koruma
Gönderilme zamanı: Pzt May 17, 2021 3:12 pm
gönderen heaveNN
Denemedim.
Kod: Tümünü seç
#include <amxmodx>
#include <reapi>
new bool:Koruma[MAX_PLAYERS+1],bool:SaldiriBlock[MAX_PLAYERS+1],Float:korumasuresi,Float:saldiriengelsuresi;
public plugin_init() {
register_plugin("Spawn Korumasi","1.0","heaveNN");
RegisterHookChain(RG_CBasePlayer_TakeDamage,"TakeDamagePre",.post=false);
RegisterHookChain(RG_CBasePlayer_Spawn,"PlayerSpawn",.post=true);
bind_pcvar_float(create_cvar("spawnkoruma_suresi","5",_,_,true,0.0),korumasuresi);
bind_pcvar_float(create_cvar("saldiriengel_suresi","3",_,_,true,0.0),saldiriengelsuresi);
}
public client_disconnected(id) {
if(task_exists(id)) remove_task(id);
}
public TakeDamagePre(const victim,iInflictor,attacker,Float:flDamage,bitsDamageType) {
if(!victim || !is_user_connected(attacker) || victim == attacker) return HC_CONTINUE;
if(Koruma[victim] || SaldiriBlock[attacker]) return HC_SUPERCEDE;
return HC_CONTINUE;
}
public PlayerSpawn(const id) {
if(!is_user_alive(id)) return;
if(korumasuresi) {
Koruma[id] = true;
set_task(korumasuresi,"korumakaldir",id);
}
if(korumasuresi) {
SaldiriBlock[id] = true;
set_task(saldiriengelsuresi,"saldiriengelkaldir",id);
}
}
public korumakaldir(id) {
if(Koruma[id]) Koruma[id] = false;
}
public saldiriengelkaldir(id) {
if(SaldiriBlock[id]) SaldiriBlock[id] = false;
}
Kod: Tümünü seç
amx_cvar spawnkoruma_suresi 5 ; 0 olursa spawn koruması olmaz
amx_cvar saldiriengel_suresi 3 ; 0 olursa saldiri engeli olmaz
Spawn Koruma
Gönderilme zamanı: Pzt May 17, 2021 3:16 pm
gönderen bestcore
İstersen bunu da kullanabilirsin, denemedim.
Kod: Tümünü seç
#pragma semicolon 1
#include <amxmodx>
#include <reapi>
enum (+= 1337)
{
TASK_GOD,
TASK_ATTACKBLOCK
}
enum _:boolEnum
{
blGod,
blAttackBlock
};
new g_bools[boolEnum][MAX_PLAYERS+1];
public plugin_init()
{
register_plugin("Round Start God and Attack Block", "0.1", "` BesTCore;");
RegisterHookChain(RG_CBasePlayer_Spawn, "RG_CBasePlayer_Spawn_Post", .post = true);
RegisterHookChain(RG_CSGameRules_FPlayerCanTakeDamage, "RG_CSGameRules_FPlayerCanTakeDamage_Pre", .post = false);
}
public RG_CSGameRules_FPlayerCanTakeDamage_Pre(const id, const attacker)
{
if(g_bools[attacker][blAttackBlock])
{
SetHookChainReturn(ATYPE_INTEGER, false);
return HC_SUPERCEDE;
}
return HC_CONTINUE;
}
public RG_CBasePlayer_Spawn_Post(const id)
{
if(get_member(id, m_bJustConnected))
{
return;
}
g_bools[blGod][id] = true;
set_entvar(id, var_takedamage, DAMAGE_NO);
g_bools[blAttackBlock][id] = true;
remove_task();
set_task(5.0, "GodOff", id + TASK_GOD);
set_task(3.0, "AttackBlockOff", id + TASK_ATTACKBLOCK);
}
public GodOff(Taskid)
{
new id = Taskid - TASK_GOD;
set_entvar(id, var_takedamage, DAMAGE_AIM);
}
public AttackBlockOff(Taskid)
{
new id = Taskid - TASK_ATTACKBLOCK;
g_bools[blAttackBlock][id] = false;
}
public client_disconnected(id)
{
g_bools[blGod][id] = false;
g_bools[blAttackBlock][id] = false;
remove_task();
}
Spawn Koruma
Gönderilme zamanı: Sal May 18, 2021 12:27 am
gönderen ` White*
Teşekkür ederim her 2nize de.