Raised This Month: $ Target: $400
 0% 

damagebits & DMG_HEGRENADE


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
weplausss
Member
Join Date: Mar 2010
Old 08-11-2011 , 11:21   Re: damagebits & DMG_HEGRENADE
Reply With Quote #1

Hegrenade explode and don't take HP from me and enemies but give experience for damage
weplausss is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-11-2011 , 11:53   Re: damagebits & DMG_HEGRENADE
Reply With Quote #2

Post your WHOLE ham_takedamage2 function. Don't leave anything out.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
weplausss
Member
Join Date: Mar 2010
Old 08-11-2011 , 11:59   Re: damagebits & DMG_HEGRENADE
Reply With Quote #3

PHP Code:
public ham_takedamage2(iVictim,inflictorattackerFloat:damagedamagebits) {
    if(
is_user_alive(iVictim) && (damagebits DMG_FALL)) {
        if(
Upadek[iVictim] >= 1) {
            new 
percent Upadek[iVictim] *  5;
            
SetHamParamFloat(4damage * (1.0 - (float(percent) / 100.0)));
        }
    
    }
    new 
ExpToGive floatround(damage) / 3;
    if(
is_user_connected(attacker)){
    if(
is_user_connected(iVictim)){
    if(
IsPlayer(attacker) && IsPlayer(iVictim) && attacker != iVictim)
    {
    if((
damagebits DMG_BULLET) || (damagebits DMG_SLASH) && !(damage DMG_HEGRENADE) )
    {
    if(
NotSameTeam(attackeriVictim))
    {
    
set_hudmessage(255000.450.5020.14.00.10.1, -1);
    
show_hudmessage(attacker"+%d Xp^n"ExpToGive);
    
iExp[attacker] += ExpToGive;
        }
    }
    }
    }
    }
    if(
IsPlayer(attacker) && Noz[attacker] > 0)
    {
        if(
get_user_weapon(attacker) == CSW_KNIFE)
        {
            
SetHamParamFloat(4damage + (Noz[attacker] * 5));
        }
    }
    if(
IsPlayer(attacker) && Unik[inflictor] > 0){
        if((
random_num(1100) <= Unik[inflictor] * 5) && (damagebits DMG_BULLET))
        {
            
SetHamParamFloat(4damage 0.0);
            
ColorChat(inflictorGREEN"[%s]^x01 Reflect ^x03 %d%% Chance."prefixUnik[inflictor] * 5);
            
starthealth get_user_healthinflictor );
            
set_user_health(inflictorUnik[inflictor] * starthealth );
            
set_hudmessage(2552552550.030.8106.02.0)
            
show_hudmessage(inflictor"+%dHp",Unik[inflictor] * 5)
            
        }
    }
    
    
    return 
HAM_IGNORED;

weplausss is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-11-2011 , 14:23   Re: damagebits & DMG_HEGRENADE
Reply With Quote #4

That looks horrible.

I rearranged it to look nicer, reduced redundancy, and fixed your bugs:
Code:
public ham_takedamage2(iVictim,inflictor, attacker, Float:damage, damagebits) {     // check if fall damage     if(damagebits & DMG_FALL)     {         // check if can reduce damage         if(Upadek[iVictim] >= 1)         {             new percent = Upadek[iVictim] *  5;             SetHamParamFloat(4, damage * (1.0 - (float(percent) / 100.0)));         }     }     // not fall damage, check for valid enemy     else if(IsPlayer(attacker) && attacker != iVictim && NotSameTeam(attacker, iVictim))     {         // valid enemy, check if used knife or gun         if(!(damagebits & DMG_GRENADE))         {             // valid enemy, check if used knife             if(get_user_weapon(attacker) == CSW_KNIFE)             {                 // check if can increase knife damage                 if(Noz[attacker] > 0)                 {                     SetHamParamFloat(4, damage + (Noz[attacker] * 5));                 }             }             // did not use knife, so must be weapon. check for damage reflect chance             else if(Unik[attacker] > 0 && random_num(1, 100) <= (Unik[attacker] * 5))             {                 SetHamParamFloat(4, 0.0);                 ColorChat(inflictor, GREEN, "[%s]^x01 Reflect ^x03 %d%% Chance.", prefix, Unik[attacker] * 5);                 starthealth = get_user_health( attacker );                 set_user_health(attacker, Unik[attacker] * 5 + starthealth );                 set_hudmessage(255, 255, 255, 0.03, 0.81, 0, 6.0, 2.0)                 show_hudmessage(attacker, "+%dHp",Unik[attacker] * 5)             }         }                 // since valid enemy attack, give xp         new ExpToGive = floatround(damage) / 3;                 set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1);         show_hudmessage(attacker, "+%d Xp^n", ExpToGive);         iExp[attacker] += ExpToGive;     }         return HAM_IGNORED; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 08-11-2011 at 14:48.
Exolent[jNr] is offline
weplausss
Member
Join Date: Mar 2010
Old 08-11-2011 , 14:41   Re: damagebits & DMG_HEGRENADE
Reply With Quote #5

still don't work DMG_GRENADE don't give xp for players but take hp can you fix this ??
weplausss is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-11-2011 , 14:48   Re: damagebits & DMG_HEGRENADE
Reply With Quote #6

Try it now.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
weplausss
Member
Join Date: Mar 2010
Old 08-11-2011 , 14:54   Re: damagebits & DMG_HEGRENADE
Reply With Quote #7

everything is ok thank you ^_^
weplausss 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 03:21.


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