Raised This Month: $ Target: $400
 0% 

How to fix the bug that makes any weapon to influence the damage done by the jetpack?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 10-31-2021 , 18:20   Re: How to fix the bug that makes any weapon to influence the damage done by the jetp
Reply With Quote #10

Quote:
Originally Posted by DJEarthQuake View Post
Nice. Welcome. Put it before SetHamParamFloat.

if(!has_fired_whatever(attacker))
SetHamParamFloat...
Is this how the code shouuld look like? Red code is the bugfix code:

Code:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, dmg_bits)
{
	if (!is_user_alive(attacker))
		return HAM_IGNORED;

	if (!g_has_plasmagun[attacker])
		return HAM_IGNORED;

	if (get_user_weapon(attacker) != CSW_AUG)
		return HAM_IGNORED;
		
	if(!has_fired_plasmagun(attacker))

	SetHamParamFloat(OFFSET_LINUX_WEAPONS, damage * get_pcvar_float(cvar_plasmagun_damage));

	return HAM_IGNORED;
}

bool:has_fired_plasmagun(attacker)
{
    new fired_plasmagun = find_ent(-1,"info_plasmagun")
    return pev(fired_plasmagun, pev_owner) != attacker ? false : true
}
I added "if(!has_fired_plasmagun(attacker))" where you told me to add it - now the compiler doen't produce any errors or warnings. However, the bugfix doesn't work. The jetpack rocket's damage is still influenced when you fire the rocket and switch to PlasmaGun before the rocket hit a zombie.

Any ideas how to fix this bug?

Shouldn't we try to edit the jetpack code, and add bugfixes there, instead of adding bugfixes in every extra item (weapon) one by one? Is there a way to edit the jetpack code in a way the jetpack rocket's damage to not be influenced by other weapons when you switch to other weapons after you fire the rocket but you switch to other weapons before the rocket hit a zombie?

Or, maybe the bugfix works, but i didn't add it correctly? Didn't i add the bugfix in the way you told me to add it?

Last edited by GlobalPlague; 10-31-2021 at 18:22.
GlobalPlague 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 11:38.


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