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 limit, reduction, toggle_plugin, save;
new bleeding[32] = 0 //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(client, inflictor, attacker, Float:damage, damagebits, victim)
{
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(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)
}
}
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(victim, health - 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(players, num)
new player
for(new i = 0; i < num; i++)
{
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.