Raised This Month: $ Target: $400
 0% 

ExecuteHam(HamTakeDamage),instant kill.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2009 , 17:24   Re: ExecuteHam(HamTakeDamage),instant kill.
Reply With Quote #1

Quote:
Originally Posted by anakin_cstrike View Post
ExecuteHamB
Will do exactly the same except it will be hookable with RegisterHam.
I suggest to check enemy HP and set damage in consequence.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 04-15-2009 , 07:25   Re: ExecuteHam(HamTakeDamage),instant kill.
Reply With Quote #2

Something like this:
PHP Code:
// fm_radius damage stock
stock fm_radius_damage(Float:orig[3], Float:dmg Float:radbit DMG_BULLETwpnName[]="",inflictor 0)
{
   new 
Ent,Classname[33],Float:Health;
   while((
Ent engfunc(EngFunc_FindEntityInSphere,Ent,orig,rad)) != 0)
   {
      
pev(Ent,pev_classname,Classname,32);
      if(!
equal(Classname,"player"))
         continue;
      
      
pev(Ent,pev_health,Health);
      
Health -= dmg;
      
      if(
Health 1.0)
      {
         
createKill(Ent,inflictor 33 && inflictor inflictor 1,wpnName);
         continue;
      }
      
      
fm_fakedamage(Ent,wpnName,dmg,bit);
   }              
}


// stock for create kill
stock createKill(idattackerweaponDescription[]) 
{
   new 
FFon get_cvar_num("mp_friendlyfire");
   
   if (
FFon == && get_user_team(id) == get_user_team(attacker)) 
   {
      
set_pev(attacker,pev_frags,pev(attacker,pev_frags) - 1);
      
client_print(attacker,print_center,"You killed a teammate");
      
      new 
money cs_get_user_money(attacker);
      if (
money != 0)
         
cs_set_user_money(attacker,money 150,1);
   }
   else if (
get_user_team(id) != get_user_team(attacker)) 
   {
      
set_pev(attacker,pev_frags,pev(attacker,pev_frags) + 1);
      new 
money cs_get_user_money(attacker);
      if (
money 16000
         
cs_set_user_money(attacker,money 300,1);
   }
   
   
   
logKill(attackeridweaponDescription);
   
   
//Kill the victim and block the messages
   
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE);
   
set_msg_block(get_user_msgid("ScoreInfo"),BLOCK_ONCE);
   
user_kill(id);
   
   
//user_kill removes a frag, this gives it back
   
set_pev(id,pev_frags,pev(id,pev_frags) + 1);
   
   
//Replaced HUD death message
   
message_begin(MSG_ALL,get_user_msgid("DeathMsg"),{0,0,0},0);
   
write_byte(attacker);
   
write_byte(id);
   
write_byte(0);
   
write_string(weaponDescription);
   
message_end();
   
   
//Update killers scorboard with new info
   
message_begin(MSG_ALL,get_user_msgid("ScoreInfo"));
   
write_byte(attacker);
   
write_short(get_user_frags(attacker));
   
write_short(get_user_deaths(attacker));
   
write_short(0);
   
write_short(get_user_team(attacker));
   
message_end();
   
   
//Update victims scoreboard with correct info
   
message_begin(MSG_ALL,get_user_msgid("ScoreInfo"));
   
write_byte(id);
   
write_short(get_user_frags(id));
   
write_short(get_user_deaths(id));
   
write_short(0);
   
write_short(get_user_team(id));
   
message_end();
   
}


// stock for log kill
stock logKill(idvictimweaponDescription[] ) 
{
   new 
namea[32],namev[32],authida[35],authidv[35],teama[16],teamv[16];
   
   
//Info On Attacker
   
get_user_name(id,namea,31);
   
get_user_team(id,teama,15);
   
get_user_authid(id,authida,34);
   
   
//Info On Victim
   
get_user_name(victim,namev,31);
   
get_user_team(victim,teamv,15);
   
get_user_authid(victim,authidv,34);
   
   
//Log This Kill
   
if(id != victim
   {
      
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^"",
      
namea,get_user_userid(id),authida,teama,namev,get_user_userid(victim),authidv,teamvweaponDescription );
   }
   else 
   {
      
log_message("^"%s<%d><%s><%s>^" committed suicide with ^"%s^"",
      
namea,get_user_userid(id),authida,teamaweaponDescription );
   }
}


// from fakemeta_util, fm_fakedamage
stock fm_fakedamage(victim, const classname[], Float:takedmgdamagedamagetype
{
   new class[] = 
"trigger_hurt"
   
   
new entity engfunc(EngFunc_CreateEntity,engfunc(EngFunc_AllocString,class))
   
   if (!
entity)
      return 
0
   
   
new value[16],kvbuffer engfunc(EngFunc_GetInfoKeyBuffer,entity)
   
format(value15"%f"takedmgdamage 2)
   
engfunc(EngFunc_SetKeyValuekvbuffer"dmg"value)
   
   
format(value15"%i"damagetype)
   
engfunc(EngFunc_SetKeyValuekvbuffer"damagetype"value)
   
   
engfunc(EngFunc_SetKeyValuekvbuffer"origin""8192 8192 8192")
   
dllfunc(DLLFunc_Spawn,entity)
   
   
set_pev(entitypev_classnameclassname)
   
dllfunc(DLLFunc_Touch,entity,victim)
   
engfunc(EngFunc_RemoveEntity,entity)
   
   return 
1

P.S. I know something 100% wrong in my code,because it won't do 50 damage.
xbatista is offline
Send a message via Skype™ to xbatista
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 02:16.


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