Raised This Month: $ Target: $400
 0% 

Catch legs and arms shot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-16-2009 , 14:41   Re: Catch legs and arms shot
Reply With Quote #1

Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <hamsandwich> #define m_LastHitGroup 75 new ScreenShake; public plugin_init() {     RegisterHam(Ham_TakeDamage, "player", "FwdPlayerDamage", 1);         ScreenShake = get_user_msgid("ScreenShake"); } public FwdPlayerDamage(client, inflictor, attacker, Float:damage, damagebits) {     if( !is_user_alive(client) ) return HAM_IGNORED;         switch( get_pdata_int(client, m_LastHitGroup) )     {         case HIT_LEFTARM, HIT_RIGHTARM:         {             message_begin(MSG_ONE, ScreenShake, _, client);             write_byte(255<<14);             write_byte(10<<14);             write_byte(255<<14);             message_end();         }         case HIT_LEFTLEG, HIT_RIGHTLEG:         {             new Float:velocity[3];             pev(client, pev_velocity, velocity);                         if( pev(client, pev_flags) & FL_ONGROUND )             {                 velocity[0] *= 0.25;                 velocity[1] *= 0.25;             }             else             {                 velocity[0] *= 1.5;                 velocity[1] *= 1.5;             }                         set_pev(client, pev_velocity, velocity)         }     }         return HAM_HANDLED; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 01-16-2009 , 21:48   Re: Catch legs and arms shot
Reply With Quote #2

Just checking, are these offsets CS-only or do they work for all mods?
__________________

Community / No support through PM
danielkza is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-16-2009 , 23:42   Re: Catch legs and arms shot
Reply With Quote #3

ok so thanks for telling me how to get if damage was done to legs arms..

i was using the ham take damage to that..

If i want it to check to addin the set task to make them bleed
thats what i added below

set_task(1.0,"victim_stuff", victim+35435,"",0, "b")
PHP Code:
/* CREDITS
Exolent[jNr] & Connor for Catching arm leg shot
Exolent[jNr] for Slow down and screen shake
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define m_LastHitGroup 75
new ScreenShake;
new 
limitreductiontoggle_pluginsave;
new 
bleeding[32] = //is bleeding
public plugin_init() 
{
 
register_plugin("Virtual Reality","2.0","NcB_Sav"); 
 
 
reduction register_cvar("vr_reduction""1");
 
toggle_plugin register_cvar("vr_mod","1");
 
limit register_cvar("vr_limit""65");
 
save register_cvar("vr_stop" "10");
 
 
//Player Spawn
 
RegisterHam(Ham_Spawn"player""playerspawn"1)
 
 
//Leg Shot 
 
RegisterHam(Ham_TakeDamage"player""FwdPlayerDamage"1);
    
 
ScreenShake get_user_msgid("ScreenShake");
 
 
register_event("DeathMsg""death_msg""a")
 
 
register_logevent("round_end"2"1=Round_End")
 
}
public 
FwdPlayerDamage(clientinflictorattackerFloat:damagedamagebitsvictim)

 if( !
is_user_alive(client) ) return HAM_IGNORED;
    
 if(
get_user_health(victim) > get_pcvar_num(limit)) return HAM_HANDLED;
 
 if(!
get_pcvar_num(toggle_plugin)) return HAM_IGNORED;
    
 switch( 
get_pdata_int(clientm_LastHitGroup) )
 {
  case 
HIT_LEFTARMHIT_RIGHTARM:
  {
   
message_begin(MSG_ONEScreenShake_client);
   
write_byte(255<<14);
   
write_byte(10<<14);
   
write_byte(255<<14);
   
message_end();
  }
  case 
HIT_LEFTLEGHIT_RIGHTLEG:
  {
   new 
Float:velocity[3];
   
pev(clientpev_velocityvelocity);
            
   if( 
pev(clientpev_flags) & FL_ONGROUND )
   {
    
velocity[0] *= 0.25;
    
velocity[1] *= 0.25;
   }
   else
   {
    
velocity[0] *= 1.5;
    
velocity[1] *= 1.5;
   }
            
   
set_pev(clientpev_velocityvelocity)
  }
 }
 
 
set_task(1.0,"victim_stuff"victim+35435,"",0"b")
    
 return 
HAM_HANDLED;
}
public 
death_msg()
{
 new 
victim read_data(2)
 
 if(
task_exists(victim+35435))
  
remove_task(victim+35435);
}
public 
victim_stuff(taskid)
{
 new 
victim taskid 35435;
 
 new 
health get_user_health(victim);
 
 if(
health get_pcvar_num(save))
  
remove_task(victim+35435);
 
 
set_user_health(victimhealth get_pcvar_num(reduction));
 ++
bleeding[victim]
 
 new 
iOrigin[3]
 
get_user_origin(victim,iOrigin)
 
 
fx_bleed(iOrigin)
}
public 
round_end()
{
 new 
players[32], num
 get_players
(playersnum)
 
 new 
player
 
for(new 0numi++)
 {
  
player players[i]
  
  if(
task_exists(player+35435))
   
remove_task(player+35435);
 }
}
public 
fx_bleed(origin[3])
{
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
 
write_byte(TE_BLOODSTREAM);
 
write_coord(origin[0]);
 
write_coord(origin[1]);
 
write_coord(origin[2]+10);
 
write_coord(random_num(-360,360));
 
write_coord(random_num(-360,360));
 
write_coord(-10);
 
write_byte(70);
 
write_byte(random_num(50,100));
 
message_end()
}
public 
playerspawn(id)
{
 
round_end();
 
bleeding[id] = 0

when i compile it and upload it i get laged out when i shoot a player.

Last edited by Doc-Holiday; 01-17-2009 at 00:24.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-17-2009 , 03:32   Re: Catch legs and arms shot
Reply With Quote #4

Quote:
Originally Posted by danielkza View Post
Just checking, are these offsets CS-only or do they work for all mods?
Those 2 offsets should exist on other mods, but could have other values.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 01:39.


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