AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Bug with hegrenade exploding (https://forums.alliedmods.net/showthread.php?t=315103)

farawayf 03-22-2019 16:12

Bug with hegrenade exploding
 
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); 
     }



CliptonHeist 03-22-2019 18:25

Re: Bug with hegrenade exploding
 
Need full function code, is this running during player_hurt event or OnTakeDamage sdkhook?

farawayf 03-22-2019 18:28

Re: Bug with hegrenade exploding
 
Sdkhook ontakedamage

CliptonHeist 03-22-2019 18:53

Re: Bug with hegrenade exploding
 
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;

farawayf 03-23-2019 07:47

Re: Bug with hegrenade exploding
 
Quote:

Originally Posted by CliptonHeist (Post 2644497)
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!


All times are GMT -4. The time now is 18:24.

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