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

Solved Bug with hegrenade exploding


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
farawayf
Senior Member
Join Date: Jan 2019
Old 03-22-2019 , 16:12   Bug with hegrenade exploding
Reply With Quote #1

Hello.
That plugin sets targets punch angle and ignites him if attacker uses knife. But have bug: when someone throwing a grenade and changing to a knife, the plugin works like player attacks with knife.
How to solve this bug ?
PHP Code:
if(StrEqual(weapon"weapon_knife"))
{
     new 
buttons GetClientButtons(attacker);
     if (!(
buttons IN_ATTACK2))
     {
          new 
Float:punch[3];
    
          
punch[0] = GetRandomFloat(1.015.0); 
          
punch[1] = GetRandomFloat(1.015.0); 
          
punch[2] = GetRandomFloat(1.015.0); 
          
IgniteEntity(victimkfire_time);
          
SetEntPropVector(victimProp_Send"m_vecPunchAngle"punch); 
     }    
     else if (!(
buttons IN_ATTACK))
     {
         new 
Float:punch2[3];             
    
         
punch2[0] = GetRandomFloat(1.0100.0); 
         
punch2[1] = GetRandomFloat(1.0100.0); 
         
punch2[2] = GetRandomFloat(1.0100.0); 
         
SetEntPropVector(victimProp_Send"m_vecPunchAngle"punch2); 
     }


Last edited by farawayf; 03-23-2019 at 15:44.
farawayf is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 03-22-2019 , 18:25   Re: Bug with hegrenade exploding
Reply With Quote #2

Need full function code, is this running during player_hurt event or OnTakeDamage sdkhook?
CliptonHeist is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 03-22-2019 , 18:28   Re: Bug with hegrenade exploding
Reply With Quote #3

Sdkhook ontakedamage
farawayf is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 03-22-2019 , 18:53   Re: Bug with hegrenade exploding
Reply With Quote #4

Well you can check if the damage type is dmg_blast before checking the weapon and that should work I believe.
Code:
if(damagetype == DMG_BLAST) return Plugin_Continue;
CliptonHeist is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 03-23-2019 , 07:47   Re: Bug with hegrenade exploding
Reply With Quote #5

Quote:
Originally Posted by CliptonHeist View Post
Well you can check if the damage type is dmg_blast before checking the weapon and that should work I believe.
Code:
if(damagetype == DMG_BLAST) return Plugin_Continue;
it works. Thank you!
farawayf is offline
Reply


Thread Tools
Display Modes

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:42.


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