Raised This Month: $51 Target: $400
 12% 

Damage Grenade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raducuursu
Junior Member
Join Date: Sep 2012
Old 03-03-2014 , 09:32   Damage Grenade
Reply With Quote #1

Hi
I have a problem with the zombie plague, grenade explode


I sometimes appears
Damge to Name :: -23 dmg
Damge to Name :: -12 dmg
Damge to Name :: -3 dmg
Damge to Name :: -7 dmg

but must as a minimum be 0

but I look and positive numbers

look at the source
Quote:
// Set damage
static id, name[32], distance, Float:damage
id = entity_get_edict(ent, EV_ENT_owner)
get_user_name(victim, name, charsmax(name))
distance = floatround(entity_range(ent, victim))
damage = get_pcvar_float(cvar_explosedamage)-(get_pcvar_float(cvar_explosedamage)/NADE_EXPLOSION_RADIUS)*float(distance)
fm_set_user_health(victim, pev(victim, pev_health) - floatround(damage))
zp_colored_print(id, "%s Damage to^x03 %s^x01 ::^x04 %i damage", CHAT_PREFIX, name, floatround(damage))
and

Quote:
// Explosion radius for custom grenades
const Float:NADE_EXPLOSION_RADIUS = 240.0
Thanks
raducuursu is offline
Kiske
Veteran Member
Join Date: May 2009
Old 03-03-2014 , 11:51   Re: Damage Grenade
Reply With Quote #2

Show the code what check if victim is in nade radius.
__________________

Kiske is offline
Send a message via Skype™ to Kiske
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 03-03-2014 , 13:54   Re: Damage Grenade
Reply With Quote #3

Code:
// Set damage static id, damage id = entity_get_edict(ent, EV_ENT_owner) // damage lower than 1 has no point, so we round it down damage = floatround(get_pcvar_float(cvar_explosedamage) - (get_pcvar_float(cvar_explosedamage) / NADE_EXPLOSION_RADIUS) * entity_range(ent, victim), floatround_floor) // the target is out of the explosion range if (!damage)     return; // max CS name lenght is 31, not 32 static name[31] get_user_name(victim, name, 30) fm_set_user_health(victim, pev(victim, pev_health) - damage) zp_colored_print(id, "%s Damage to^x03 %s^x01 ::^x04 %d damage", CHAT_PREFIX, name, damage)
__________________

Last edited by georgik57; 03-03-2014 at 13:58.
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Kiske
Veteran Member
Join Date: May 2009
Old 03-04-2014 , 03:30   Re: Damage Grenade
Reply With Quote #4

PHP Code:
if(!is_valid_ent(ent)) {
    return;
}

new 
iAttacker;
iAttacker entity_get_edict(entEV_ENT_owner);

if(!
is_user_connected(iAttacker)) {
    return;
}

new 
Float:vecOrigin[3];
new 
Float:fCVAR_Value;
new 
Float:fDistance;
new 
Float:fDamage;
new 
Float:fEq;
new 
iVictim;

entity_get_vector(entEV_VEC_originvecOrigin);

fCVAR_Value get_pcvar_float(cvar_explosedamage);
fEq fCVAR_Value NADE_EXPLOSION_RADIUS;

iVictim = -1;

while((
iVictim engfunc(EngFunc_FindEntityInSphereiVictimvecOriginNADE_EXPLOSION_RADIUS)) != 0) {
    if(!
is_user_alive(iVictim))
        continue;
    
    
fDistance entity_range(entiVictim);
    
    
fDamage fCVAR_Value - (fEq fDistance);
    
    
ExecuteHam(Ham_TakeDamageiVictimiAttackeriAttackerfDamageDMG_BLAST);

__________________

Kiske is offline
Send a message via Skype™ to Kiske
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 16:12.


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