Raised This Month: $ Target: $400
 0% 

need help with reducing damage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 02-19-2007 , 11:27   need help with reducing damage
Reply With Quote #1

Code:
#define PA_LOW  50.0
#define PA_HIGH 75.0
#define PAC_LOW  25.0
#define PAC_HIGH 45.0
public event_Damage(id) {
  if(get_cvar_num(CVAR_STATUS) <= 0 
  || !is_user_connected(id) 
  || !is_user_alive(id)
  || is_user_bot(id)) return;
  new iWeapID, attacker = get_user_attacker(id , iWeapID);
  if(!is_user_connected(attacker)) return;

//    if(!is_user_connected(attacker)) return PLUGIN_HANDLED;
    if(iWeapID == 4) {
        
        message_begin(MSG_ONE , gMsgScreenShake , {0,0,0} ,id)
        write_short( 1<<14 );
        write_short( 1<<14 );
        write_short( 1<<14 );
        message_end();
        new victim_id = id
        new dmg_take = read_data( 2 );
        new dmgtype = read_data( 3 );
    //    new Float:damage = dmg_take / 2;
        new szDamage = dmg_take / 2;
        new he_hp = get_user_health( victim_id )
        new attacker_id = get_user_attacker( victim_id)

        message_begin(MSG_ONE_UNRELIABLE , gMsgScreenFade , {0,0,0} , id);
        write_short( 4<<10 );
        write_short( 3<<10 );
        write_short( 1<<12 );
        write_byte( 225 );
        write_byte( 0 );
        write_byte( 0 );
        write_byte( 230 );
        message_end();
        
        
        set_task(1.5,"omgivebeenhe",id) //stunned this long then waking+heartbeat and breathe sounds
        set_task(6.5,"he_effectsfade1",id) //fading of echo
        client_cmd(id,"room_type 6;room_delay 0.3;room_lp 1;room_mod 5;room_feedback 0.85;room_size 0.9;room_left 0.5;room_refl 2")
        //    client_cmd(id,"room_type 7")     //those nice echo effects like on de_rats + tweaked    
        //    client_cmd(id,"room_lp 1")    //effect - some kind of filter //hope this few lines doesnt make overflows
        //    client_cmd(id,"room_mod 1")      //effect - modulation
        //    client_cmd(id,"room_size 0.5")    //effect - size of the room echo(and how long the sound is "bounced)
        //    client_cmd(id,"room_left 0.1")    //effect - nice stereo delay
        //    client_cmd(id,"room_refl 2")     //effect - all LOUDER!
        emit_sound(id, CHAN_AUTO, "hgrunt/gr_pain4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
        set_task(1.0,"he_loudyeffectstop",id)
        set_task(8.1,"he_effectisstopped",id)
        client_cmd(id,"spk voi/voi_heffect2") //u hear the stunning sound
        new Float:fVec[3];
        
        
        flags = entity_get_int(id, EV_INT_flags)
        if(flags & FL_DUCKING) // to deal 2x less damage
        {
                    set_user_health(victim_id, he_hp + szDamage)
        {

    //        if( floatround(Damage) >= he_hp ) {
              if( szDamage >= he_hp ) {
                if( victim_id == attacker_id ) 
                {
                    return //PLUGIN_CONTINUE
                    }else{
                    log_kill( attacker_id, victim_id, "grenade", 0 );
                }
                
                return 
                }else {
                if( victim_id == attacker_id ) return //PLUGIN_CONTINUE
                
    //            fakedamage( victim_id, "weapon_grenade", damage, dmgtype );
                        
                
            }
            
        }

        message_begin(MSG_ONE, gMsgScreenShake, {0,0,0}, id)
        write_short(1<<20)
        write_short(1<<14)
        write_short(2<<20)
        message_end()
        fVec[0] = random_float(PAC_LOW , PAC_HIGH);
        fVec[1] = random_float(PAC_LOW , PAC_HIGH);
        fVec[2] = random_float(PAC_LOW , PAC_HIGH);
        entity_set_vector(id , EV_VEC_punchangle , fVec);
    }
    else
    {
        message_begin(MSG_ONE, gMsgScreenShake, {0,0,0}, id)
        write_short(4<<20)
        write_short(1<<14)
        write_short(2<<20)
        message_end()
        fVec[0] = random_float(PA_LOW , PA_HIGH);
        fVec[1] = random_float(PA_LOW , PA_HIGH);
        fVec[2] = random_float(PA_LOW , PA_HIGH);
        entity_set_vector(id , EV_VEC_punchangle , fVec);
    }
}
//return PLUGIN_CONTINUE
}
how to make this reduce damage properly? if i use float it gives me error in lower line, also when u shouldnt die from reduced damage when crouched you die anyways
any ideas ?
__________________
Voi is offline
 



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 00:39.


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