Knife Blink Limited (versiunea 2.0)

Descarcari de pluginuri si discutii despre acestea.

Moderators: Moderatori ajutători, Scripteri TheXForce

Post Reply
User avatar
Rainq
Fost administrator
Fost administrator
Posts: 381
Joined: Mon Jan 18, 2021 7:25 am
Status: Citesc forumul TheXForce.RO...!
Detinator Steam: Da
SteamID: mrainq
Gaming experience: Nu spun..
Reputatie: Fost administrator
Nume anterior: Light
Fost detinator zm.thexforce.ro
Fost detinator dr.thexforce.ro
Location: Bucureşti
Has thanked: 2 times
Been thanked: 1 time
Contact:

Knife Blink Limited (versiunea 2.0)

Post by Rainq »

Image
Descriere: Permite jucătorilor să se deplaseze rapid spre alți jucători la o anumită distanță

Descarcare:

Code: Select all

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <chr_engine>

#define MIN_DISTANCE 50

new const g_item_name[] = { "Knife Blink(5 Limited)" }
const g_item_cost = 5
const g_iMaxDistance = 300;

new Float:g_fSpeed = 1000.0;
new Float:g_fDelay = 1.0;

new g_iMaxPlayers;
new g_iEnemy[33];
new g_iInBlink[33];
new Float:g_fLastSlash[33];
new g_iCanceled[33];
new g_iSlash[33];
new g_iBlinks[33];
new g_itemid_blink;
new g_times[33]

public plugin_init(){
	
	register_plugin("[ZP] Extra Item: Knife Blink", "2.0", "pharse fixed Rainq");
	
	g_iMaxPlayers = get_maxplayers();
	
	g_itemid_blink = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_ZOMBIE);
	
	register_forward(FM_TraceLine, "FW_TraceLine_Post", 1);
	register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
	
	register_event("HLTV", "event_new_round", "a", "1=0", "2=0") 
}

public FW_TraceLine_Post(Float:start[3], Float:end[3], conditions, id, trace)
{
	if (!CHECK_ValidPlayer(id))
		return FMRES_IGNORED;
	
	new iWeaponID = get_user_weapon(id);
	
	if ( iWeaponID != CSW_KNIFE )
	{
		
		OP_Cancel(id);
		return FMRES_IGNORED;
	}
	
	new enemy = g_iEnemy[id];
	
	if (!enemy)
	{
		enemy = get_tr2(trace, TR_pHit);
		
		if ( !CHECK_ValidPlayer(enemy) || zp_get_user_zombie(enemy) )
		{
			OP_Cancel(id);
			return FMRES_IGNORED;
		}
		g_iEnemy[id] = enemy;
	}
	return FMRES_IGNORED;
}

public FW_PlayerPreThink(id){
	
	if (!CHECK_ValidPlayer(id))
		return FMRES_IGNORED;
	
	new iWeaponID = get_user_weapon(id);
	
	if ( iWeaponID != CSW_KNIFE || !zp_get_user_zombie(id) )
	{
		
		OP_Cancel(id);
		return FMRES_IGNORED;
	}
	
	if ( g_iBlinks[id] == 0 )
		return FMRES_IGNORED;
	
	new button = pev(id,pev_button);
	
	if ( !(button & IN_ATTACK) && !(button & IN_ATTACK2) )
	{
		
		OP_Cancel(id)
		return FMRES_IGNORED;
	}
	
	if (g_iSlash[id])
		g_iSlash[id] = 0;
	
	OP_NearEnemy(id);
	
	if( g_iInBlink[id] )
	{
		
		OP_SetBlink(id);
		OP_Blink(id);
		g_iCanceled[id] = 0;
	}

	return FMRES_IGNORED;
}

public zp_extra_item_selected(player, itemid)
{
	if(!is_user_alive(player))
    return PLUGIN_HANDLED
	if (itemid == g_itemid_blink)
	{
		if(g_times[player] == 5)		// aici modifici de cate ori poate folosi abilitatea pe runda
		{
			return ZP_PLUGIN_HANDLED
		}
		g_iBlinks[player] += 1;
		g_times[player]++
	}
	return PLUGIN_HANDLED
}

public event_new_round()
{
    for(new id = 1; id <= g_iMaxPlayers; id++)
    {
		g_iBlinks[id] = 0;
		g_times[id] = 0
	}
}

public OP_NearEnemy(id){
	
	new enemy = g_iEnemy[id];
	new Float:time = get_gametime();
	
	if (!enemy || g_fLastSlash[id]+g_fDelay>time){
		
		g_iInBlink[id] = 0;
		return;
	}
	
	new origin[3], origin_enemy[3];
	
	get_user_origin(id, origin, 0);
	get_user_origin(enemy, origin_enemy, 0);
	
	new distance = get_distance(origin, origin_enemy);
	
	if ( MIN_DISTANCE<=distance<=g_iMaxDistance)
	{
		
		g_iInBlink[id] = 1;
		return;
		
	}
	else if (MIN_DISTANCE>distance && g_iInBlink[id])

	{
		OP_Slash(id);
	}

	OP_Cancel(id);
}

public OP_Blink(id)
{
	
	new Float:new_velocity[3];
	new enemy = g_iEnemy[id];
	new Float:origin_enemy[3];
	
	pev(enemy, pev_origin, origin_enemy);
	entity_set_aim(id, origin_enemy);
	
	get_speed_vector2(id, enemy, g_fSpeed, new_velocity)
	set_pev(id, pev_velocity, new_velocity);
}

public OP_Cancel(id)
{
	
	g_iInBlink[id] = 0;
	g_iEnemy[id] = 0;
	if (!g_iCanceled[id])
	{
		
		OP_SetBlink(id);
		g_iCanceled[id] = 1;
	}
}

public OP_Slash(id)
{
	
	set_pev(id, pev_velocity, {0.0,0.0,0.0});
	
	new weaponID = get_user_weapon(id, _, _);
	
	if(weaponID == CSW_KNIFE){
		
		new weapon[32]
		
		get_weaponname(weaponID,weapon,charsmax(weapon))
		
		new ent = fm_find_ent_by_owner(-1,weapon,id)
		
		if(ent){
			
			set_pdata_float(ent,46, 0.0);
			set_pdata_float(ent,47, 0.0);
			g_iSlash[id] = 1;
			g_fLastSlash[id] = get_gametime();
			g_iBlinks[id] -= 1;
			new name[32];
			get_user_name(id,name,charsmax(name))
		}
	}  
}

public OP_SetBlink(id)
{
	
	new blink = g_iInBlink[id];
	
	if (blink>1)
		return;
	
	if (blink)
		g_iInBlink[id] += 1;
}

public CHECK_ValidPlayer(id)
{
	
	if (1<=id<=g_iMaxPlayers && is_user_alive(id))
		return 1;
	
	return 0;
}

stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) 
{
	new strtype[11] = "classname", ent = index;
	switch (jghgtype) 
	{
		case 1: strtype = "target";
		case 2: strtype = "targetname";
	}

	while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}

	return ent;
}
Nume: Knife Blink
Versiune: 2.0
Link oficial: click

Instalare:
1. Fisierul zp_extra_knife_blink.sma il puneti in addons/amxmodx/scripting
2. Fisierul zp_extra_knife_blink.amxx il puneti in addons/amxmodx/plugins
3. Intrati in fisierul addons/amxmodx/configs/plugins-zplague.ini si adaugati la urma:

Code: Select all

zp_extra_knife_blink.amxx
4. Alti pasi necesari....

Cvar-uri (se adauga in fisierul amxmodx\configs\amxx.cfg): -


Imagini:
Apare in meniu.
Image
Image
User avatar
Rainq
Fost administrator
Fost administrator
Posts: 381
Joined: Mon Jan 18, 2021 7:25 am
Status: Citesc forumul TheXForce.RO...!
Detinator Steam: Da
SteamID: mrainq
Gaming experience: Nu spun..
Reputatie: Fost administrator
Nume anterior: Light
Fost detinator zm.thexforce.ro
Fost detinator dr.thexforce.ro
Location: Bucureşti
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Knife Blink Limited (versiunea 1.2)

Post by Rainq »

actualizat
acum daca cineva trece de limita impusa nu-i mai consuma ammo
link: https://www.mediafire.com/file/ltalgyho ... k.rar/file
Image
Post Reply

Return to “Pluginuri”