Raised This Month: $ Target: $400
 0% 

Azimov freezing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakonda001
Member
Join Date: Jul 2020
Old 08-30-2020 , 12:15   Azimov freezing
Reply With Quote #1

Hi
I have an interesting plugin, awp, which has 2 shooting modes, switched with the "E" key (critical shooting and freeze)

1) but when I kill by freezing the player remains to pack, freezing goes 4 seconds, how to do that after 4 seconds the player lay down as in a normal game?

2) sometimes the awp skin itself disappears and there is a normal skin

Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <center_msg_fix>

#define 	weapon_awp 			18
#define 	IMPULSE 			8678
#define 	ACCESS_FLAG 		ADMIN_LEVEL_H

#define m_pActiveItem 373

const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
const OFFSET_LINUX = 5;
const MsgId_ScreenFade = 98;

new AWP_V_MODEL[] =	{	"models/asimov/v_awp.mdl"	};
new AWP_P_MODEL[] =	{	"models/asimov/p_awp.mdl"	};
new AWP_W_MODEL[] =	{	"models/asimov/w_awp.mdl"	};

new AsimovSwitch[33];
new ButtonTimeReload[33];

new bool:IsUserHaveAwp[33];

public plugin_init()
{
	register_plugin("AwpAsimov", "0.6b", "@LLaPb@");
	
	register_clcmd("Asimov", "GetAsimov");
	register_clcmd("say /azimov", "GetAsimov");
	register_clcmd("drop","cmdDrop");
	
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled");
	RegisterHam(Ham_TraceAttack, "player", "Ham_TraceAttack_Player", false);
	RegisterHam(Ham_Item_Deploy, "weapon_awp", "HamHook_Item_Deploy", true);
	register_forward(FM_SetModel, "Fakemeta_SetModel");
	register_touch("weaponbox", "player", "OnWeaponboxTouch");
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}

public client_putinserver(id)
{
	IsUserHaveAwp[id] = false;
	AsimovSwitch[id] = 1;
	ButtonTimeReload[id] = 0;
}

public plugin_precache()
{
	precache_model(AWP_V_MODEL);
	precache_model(AWP_P_MODEL);
	precache_model(AWP_W_MODEL);
}

public event_round_start()
{
	for (new id; id <= 32; id++) IsUserHaveAwp[id] = false;
}

public cmdDrop(id) 
{
	if(IsUserHaveAwp[id]) 
	{
		new clip,ammo;
		new weapon = get_user_weapon(id,clip,ammo);
		if(weapon == CSW_AWP) 
		{
			IsUserHaveAwp[id] = false;
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}

public GetAsimov(id)
{
	if(get_user_flags(id) & ACCESS_FLAG)
	{
		drop_weapons(id, 1);
		IsUserHaveAwp[id] = true;
		give_item_ex2(id, "weapon_awp", 30, true, IMPULSE);
	}else client_print(id, print_center, "You don't have access to this weapon!");
}

public fw_PlayerKilled(iVictim, iAttacker, shouldgib) IsUserHaveAwp[iVictim] = false;

public Ham_TraceAttack_Player(iVictim, iAttacker, Float:fDamage, Float:fDeriction[3], iTraceHandle, iBitDamage)
{
	if(!is_user_connected(iVictim) || !is_user_connected(iAttacker))
		return HAM_IGNORED;
		
	new iEntity = get_pdata_cbase(iAttacker, m_pActiveItem, OFFSET_LINUX);
	
	if(!pev_valid(iEntity))
		return HAM_IGNORED;
	
	new Impulse = pev(iEntity, pev_impulse);
	if(Impulse != IMPULSE)
		return HAM_IGNORED;
	
	if(cs_get_user_team(iVictim) != cs_get_user_team(iAttacker))
	{
		switch(AsimovSwitch[iAttacker])
		{
			case 1:
			{
				if(get_tr2(iTraceHandle, TR_iHitgroup) == HIT_HEAD)
				{
					new Float:Damage = 5000.0;
					SetHamParamFloat(3, Damage);
					client_print(iAttacker, print_center, "Урон: %f", Damage);
					return HAM_IGNORED;
				}
				
				new Float:KritDamage = random_float(1000.0, 2000.0);
				SetHamParamFloat(3, KritDamage);
				return HAM_IGNORED;
			}
			case 2:
			{
				new Float:KritDamage = random_float(1000.0, 2000.0);
				SetHamParamFloat(3, KritDamage);
				FreezePlayer(iVictim);
			}
		}
	}
	return HAM_IGNORED;
}

public client_PreThink(id)
{ 
    if(entity_get_int(id, EV_INT_button) & IN_USE) 
    { 
		new iEntity = get_pdata_cbase(id, m_pActiveItem, OFFSET_LINUX);
		if(pev_valid(iEntity) && pev(iEntity, pev_impulse) == IMPULSE && ButtonTimeReload[id] == 0)
		{
			switch(AsimovSwitch[id])
			{
				case 1:
				{
					AsimovSwitch[id] = 2;
					ButtonTimeReload[id] = 1;
					set_task(2.0, "ButtonReset", id + IMPULSE);
					client_print(id, print_center, "You switched to freeze mode!");
				}
				case 2:
				{
					AsimovSwitch[id] = 1;
					ButtonTimeReload[id] = 1;
					set_task(2.0, "ButtonReset", id + IMPULSE);
					client_print(id, print_center, "You switched to crit mode!");
				}
			}
		}
    } 
}

public ButtonReset(id)
{
	id -= IMPULSE;
	ButtonTimeReload[id] = 0;
}


public HamHook_Item_Deploy(iItem)
{
	if (pev_valid(iItem) != 2)
		return HAM_IGNORED;
	
	new id = get_pdata_cbase(iItem, 41, 4);
	if(cs_get_weapon_id(iItem) == weapon_awp && pev(iItem, pev_impulse) == IMPULSE && IsUserHaveAwp[id])
	{
		set_pev(id, pev_viewmodel2, AWP_V_MODEL);
		set_pev(id, pev_weaponmodel2, AWP_P_MODEL);
	}
	
	return HAM_IGNORED;
}

public Fakemeta_SetModel(const iEntity, szModel[])
{
	if(!pev_valid(iEntity))
		return FMRES_IGNORED;
		
	new szClassName[32];
	pev(iEntity, pev_classname, szClassName, charsmax(szClassName));
	
	if (!equali(szClassName, "weaponbox"))
		return FMRES_IGNORED;
	
	for(new iSlot, iWeapon; iSlot < 6; iSlot++)
	{
		iWeapon = get_pdata_cbase(iEntity, 34 + iSlot, 4);
		if(pev_valid(iWeapon))
		{
			if(pev(iWeapon, pev_impulse) == IMPULSE)
			{
				engfunc(EngFunc_SetModel, iEntity, AWP_W_MODEL);
				return FMRES_SUPERCEDE;
			}
		}
	}
	return FMRES_IGNORED;
}

public OnWeaponboxTouch(wEnt, id)
{
	static szModel[32]; entity_get_string(wEnt, EV_SZ_model, szModel, charsmax(szModel));
	if(equal(szModel, "models/asimov/", 14))
	{
		if(!(get_user_flags(id) & ACCESS_FLAG)) return PLUGIN_HANDLED;
		else return PLUGIN_CONTINUE;
	}
	
	return PLUGIN_CONTINUE;
}

public FreezePlayer(id)
{
	set_pev(id, pev_renderfx, kRenderFxGlowShell);
	set_pev(id, pev_rendercolor, {0.0, 100.0, 200.0});
	set_pev(id, pev_rendermode, kRenderNormal);
	set_pev(id, pev_renderamt, 18.0);
	
	new Float:vecOrigin[3];
	pev(id, pev_origin, vecOrigin);
	
	set_pev(id, pev_flags, pev(id, pev_flags) | FL_FROZEN);
	set_pev(id, pev_origin, vecOrigin);
	
	message_begin(MSG_ONE_UNRELIABLE, MsgId_ScreenFade, _, id);
	write_short(1<<0);
	write_short(1<<0);
	write_short(1<<2);
	write_byte(0);
	write_byte(50);
	write_byte(200);
	write_byte(100);
	message_end();
	
	set_task(4.0, "UnFreezePlayer", id + IMPULSE);
}

public UnFreezePlayer(id)
{
	id -= IMPULSE;
	
	set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN);
	
	message_begin(MSG_ONE_UNRELIABLE, MsgId_ScreenFade, _, id);
	write_short(1<<0);
	write_short(1<<0);
	write_short(1<<1);
	write_byte(0);
	write_byte(0);
	write_byte(0);
	write_byte(0);
	message_end();
	
	set_pev(id, pev_renderfx, kRenderFxNone);
	set_pev(id, pev_rendercolor, {255.0, 255.0, 255.0});
	set_pev(id, pev_rendermode, kRenderNormal);
	set_pev(id, pev_renderamt, 18.0);
}

stock drop_weapons(id, dropwhat)
{
	static weapons[32], num, i, weaponid;
	num = 0;
	get_user_weapons(id, weapons, num);
    
	for (i = 0; i < num; i++)
	{
		weaponid = weapons[i];
		if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
		{
			static wname[32];
			get_weaponname(weaponid, wname, sizeof wname - 1);
            
			engclient_cmd(id, "drop", wname);
		}
	}
}

stock give_item_ex2(iPlayer, const szWeaponName[], iAmmo = 0, bool:bDrop = false, iKey = 0)
{
	if (!equal(szWeaponName, "weapon_", 7))
		return false;
	
	new iWeapon = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, szWeaponName));
	
	if (!pev_valid(iWeapon))
		return false;
	
	if (bDrop)
	{
		new szWeapon[ 32 ],
			iSlot = ExecuteHamB(Ham_Item_ItemSlot, iWeapon),
			iItem = get_pdata_cbase(iPlayer, 367 + iSlot, 5);
		
		while ((pev_valid(iItem) == 2))
		{
			pev(iItem, pev_classname, szWeapon, charsmax(szWeapon));
			
			iItem = get_pdata_cbase(iItem, 42, 4);
		}
	}
	
	set_pev(iWeapon, pev_spawnflags, pev(iWeapon, pev_spawnflags) | SF_NORESPAWN);
	
	if (iKey > 0)	set_pev(iWeapon, pev_impulse, iKey);
	if (iAmmo > 0)	cs_set_user_bpammo(iPlayer, get_weaponid(szWeaponName), iAmmo);
	
	dllfunc(DLLFunc_Spawn, iWeapon);
	dllfunc(DLLFunc_Touch, iWeapon, iPlayer);
	
	return true;
}
anakonda001 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode