Raised This Month: $ Target: $400
 0% 

set_task additional info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DeLsTer
New Member
Join Date: Jul 2010
Old 05-17-2011 , 12:13   set_task additional info
Reply With Quote #1

Hey guys i'm a noob in scripting and i need some help. Here's the part of a code:
Code:
public damage_event(id) {
		new arg[2]
		arg[0] = get_user_attacker(id)
		set_task(0.5, "loop_burn", id, arg[0], 0, "a", g_p_upg[attacker][UPG_FNADE] );
}

public loop_burn(id,arg[0]){
	if(!is_user_alive(id) || pev(id, pev_flags)&FL_INWATER)
		return;
	
	static Float:originF[3];
	pev(id, pev_origin, originF);
	
	new rnd = random_num(5, 10);
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0);
	write_byte(TE_SPRITE);
	engfunc(EngFunc_WriteCoord, originF[0]+random_float(-5.0, 5.0));
	engfunc(EngFunc_WriteCoord, originF[1]+random_float(-5.0, 5.0));
	engfunc(EngFunc_WriteCoord, originF[2]+random_float(-10.0, 10.0));
	write_short(g_flameSpr);
	write_byte(rnd);
	write_byte(200);
	message_end();
	new bool:death = (rnd>=float(get_user_health(id)))?true:false;
	if( death )
	{
	new get_user_msgid_DeathMsg;
	get_user_msgid_DeathMsg = get_user_msgid("DeathMsg");
	set_msg_block(get_user_msgid_DeathMsg, BLOCK_ONCE);
	user_kill(id);
	make_deathmsg(arg[0], id, 0, "grenade")
 
	}else{
	set_user_health(id, get_user_health(id) - rnd);	
	
	}
	
	}
Now i want to fully imitate a grenade death, but the problem is i can't seem to understand how to get the killer wich attacked. Using the method above gives me a client freeze upon death
DeLsTer is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-17-2011 , 19:59   Re: set_task additional info
Reply With Quote #2

Instead of setting health, killing, then making a death message, why not inflict damage with just Ham_TakeDamage. This way all the technical stuff is handled by the engine.
__________________
fysiks 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:17.


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