Raised This Month: $ Target: $400
 0% 

Hook hit with a knife


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DarkGL
Senior Member
Join Date: Aug 2010
Location: Warsaw, Poland
Old 11-28-2010 , 10:52   Hook hit with a knife
Reply With Quote #1

Hi I wanted to hook when player hit ent with a knife so I spawn ent:
Code:
public spawn(){
	new Float:origin[3]
	if(SsGetOrigin(origin))
	{
		new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
		if(ent){
			engfunc(EngFunc_SetModel, ent, "models/present1.mdl")
			engfunc(EngFunc_SetOrigin, ent, origin)
			set_pev(ent, pev_classname, "prezent");
			set_pev(ent,pev_takedamage,DAMAGE_YES)
			set_pev(ent,pev_health,999999.0)
			set_pev(ent,pev_max_health,999999.0)
			set_pev(ent,pev_solid,SOLID_BBOX) 
			engfunc(EngFunc_SetSize,ent,Float:{-15.0,-15.0,-2.0},Float:{15.0,15.0,15.0}) 
			set_pev(ent,pev_movetype,MOVETYPE_TOSS)
			set_pev(ent,pev_gravity,1.0)
			RegisterHamFromEntity(Ham_TakeDamage, ent, "fwTakeDamage", 1)
		}
	}
}
and it's work
a hook of takedamage
Code:
public fwTakeDamage(this, idinflictor, idattacker, Float:damage, damagebits){
	if((damagebits&(1<<2)) && is_user_alive(idattacker)){
		punkty[idattacker]++;
		remove_entity(this);
		return HAM_SUPERCEDE;
	}
	else
	{
		return HAM_SUPERCEDE;
	}
	return HAM_SUPERCEDE;
}
but first if is never true why ?
DarkGL is offline
 



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 11:28.


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