Raised This Month: $ Target: $400
 0% 

How do i fix these errors and a warning?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 12-05-2021 , 10:09   How do i fix these errors and a warning?
Reply With Quote #1

Hello. When I try to create this plugin, I get the following errors (and warning):

// C:\Mod\cstrike\addons\amxmodx\scripting\gun.s ma(452) : error 088: number of arguments does not match definition
// C:\Mod\cstrike\addons\amxmodx\scripting\gun.s ma(672) : error 025: function heading differs from prototype
// C:\Mod\cstrike\addons\amxmodx\scripting\gun.s ma(673) : error 021: symbol already defined: "RadiusDamage"
// C:\Mod\cstrike\addons\amxmodx\scripting\gun.s ma(734) : warning 209: function "RadiusDamage" should return a value


This is line 452:
Code:
RadiusDamage(vecEndPos, pWeapon, pPlayer, EGON_RADIUS_DAMAGE, EGON_RADIUS, DMG_ENERGYBEAM|DMG_ALWAYSGIB);
This is the whole case where line 452 is contained (the line is marked in red in case you can't see it):

Code:
		case FIRE_WIDE:
		{
			if (flDMGTime < tTime)
			{
				new Float:flTakeDamage; pev(pEntity, pev_takedamage, flTakeDamage);
				
				if (flTakeDamage != DAMAGE_NO)
				{
					ExecuteHamB(Ham_TraceAttack, pEntity, pPlayer, EGON_DAMAGE, vecDir, tr, DMG_ENERGYBEAM|DMG_ALWAYSGIB);
					ExecuteHamB(Ham_TakeDamage, pEntity, pPlayer, pPlayer, EGON_DAMAGE, DMG_ENERGYBEAM|DMG_ALWAYSGIB);
				}
				
				new Float:vecEndPos[3]; get_tr2(tr, TR_vecEndPos, vecEndPos);
				RadiusDamage(vecEndPos, pWeapon, pPlayer, EGON_RADIUS_DAMAGE, EGON_RADIUS, DMG_ENERGYBEAM|DMG_ALWAYSGIB);
				
				if (!ExecuteHam(Ham_IsAlive, pPlayer))
				{
					return;
				}
				
				new Float:flAmmoUseTime; pev(pWeapon, pev_flAmmoUseTime, flAmmoUseTime);
				
				if (tTime >= flAmmoUseTime)
				{
					set_pdata_int(pPlayer, m_rgPlayerAmmoSlot + 3, get_pdata_int(pPlayer, m_rgPlayerAmmoSlot + 3) - 1);
					set_pev(pWeapon, pev_flAmmoUseTime, tTime + EGON_AMMOUSE);
				}
				
				set_pev(pWeapon, pev_dmgtime, tTime + EGON_DISCHARGE_INTERVAL);
				
				new Float:flShakeTime; pev(pWeapon, pev_shakeTime, flShakeTime);
				
				if (flShakeTime < tTime)
				{
					UTIL_ScreenShake(vecEndPos, 5.0, 150.0, 0.75, 250.0);
					set_pev(pWeapon, pev_shakeTime, tTime + 1.5);
				}
			}
			
			timedist = (flDMGTime - tTime) / EGON_DISCHARGE_INTERVAL;
		}
	}
	
	if (timedist < 0.0)
		timedist = 0.0;
	else if (timedist > 1.0)
		timedist = 1.0;
		
	timedist = 1.0 - timedist;
	
	UpdateEffect(pWeapon, pPlayer, vecEndPos, timedist);
	free_tr2(tr);
}
This is line 672:
Code:
RadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
This is the whole code of line 672:

Code:
RadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
{
	new pEntity = -1;
	new tr = create_tr2();
	new Float:flAdjustedDamage, Float:falloff;
	new Float:vecSpot[3];
	
	if (flRadius > 0)
		falloff = flDamage / flRadius;
	else
		falloff = 1.0;
		
	new bool:bInWater = bool:(engfunc(EngFunc_PointContents, vecSrc) == CONTENTS_WATER);
	
	vecSrc[2] += 1.0;
	
	if (!pevAttacker)
		pevAttacker = pevInflictor;
		
	while ((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecSrc, flRadius)) != 0)
	{
		static Float:flTakeDamage; pev(pEntity, pev_takedamage, flTakeDamage);
		
		if (flTakeDamage != DAMAGE_NO)
		{
			if (bInWater && pev(pEntity, pev_waterlevel) == 0)
				continue;
				
			if (!bInWater && pev(pEntity, pev_waterlevel) == 3)
				continue;
		
			BodyTarget(pEntity, vecSrc);
			engfunc(EngFunc_TraceLine, vecSrc, vecSpot, DONT_IGNORE_MONSTERS, pevInflictor, tr);
			
			static Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
			
			if (flFraction == 1.0 || get_tr2(tr, TR_pHit) == pEntity)
			{
				if (get_tr2(tr, TR_StartSolid))
				{
					set_tr2(tr, TR_vecEndPos, vecSrc);
					set_tr2(tr, TR_flFraction, 0.0);
					
					flFraction = 0.0;
				}
				
				static Float:vecEnd[3]; get_tr2(tr, TR_vecEndPos, vecEnd);
				
				VectorSub(vecSrc, vecEnd, vecEnd);
			
				flAdjustedDamage = VectorLength(vecEnd) * falloff;
				flAdjustedDamage = flDamage - flAdjustedDamage;
				
				if (flAdjustedDamage < 0)
				{
					flAdjustedDamage = 0.0;
				}
			
				ExecuteHamB(Ham_TakeDamage, pEntity, pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType);
			}
		}
	}
}
To see what is at line 673, just scroll a little bit above and look right below line 672.

Line 734 contains only this symbol: “{“, and this symbol marks the end of the whole code below line 672.

Here is the whole code with error-causing symbol (the symbol is at the very end of the code):

Code:
RadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
{
	new pEntity = -1;
	new tr = create_tr2();
	new Float:flAdjustedDamage, Float:falloff;
	new Float:vecSpot[3];
	
	if (flRadius > 0)
		falloff = flDamage / flRadius;
	else
		falloff = 1.0;
		
	new bool:bInWater = bool:(engfunc(EngFunc_PointContents, vecSrc) == CONTENTS_WATER);
	
	vecSrc[2] += 1.0;
	
	if (!pevAttacker)
		pevAttacker = pevInflictor;
		
	while ((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecSrc, flRadius)) != 0)
	{
		static Float:flTakeDamage; pev(pEntity, pev_takedamage, flTakeDamage);
		
		if (flTakeDamage != DAMAGE_NO)
		{
			if (bInWater && pev(pEntity, pev_waterlevel) == 0)
				continue;
				
			if (!bInWater && pev(pEntity, pev_waterlevel) == 3)
				continue;
		
			BodyTarget(pEntity, vecSrc);
			engfunc(EngFunc_TraceLine, vecSrc, vecSpot, DONT_IGNORE_MONSTERS, pevInflictor, tr);
			
			static Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
			
			if (flFraction == 1.0 || get_tr2(tr, TR_pHit) == pEntity)
			{
				if (get_tr2(tr, TR_StartSolid))
				{
					set_tr2(tr, TR_vecEndPos, vecSrc);
					set_tr2(tr, TR_flFraction, 0.0);
					
					flFraction = 0.0;
				}
				
				static Float:vecEnd[3]; get_tr2(tr, TR_vecEndPos, vecEnd);
				
				VectorSub(vecSrc, vecEnd, vecEnd);
			
				flAdjustedDamage = VectorLength(vecEnd) * falloff;
				flAdjustedDamage = flDamage - flAdjustedDamage;
				
				if (flAdjustedDamage < 0)
				{
					flAdjustedDamage = 0.0;
				}
			
				ExecuteHamB(Ham_TakeDamage, pEntity, pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType);
			}
		}
	}
}
In case you still can't understand it, here is a picture of the exact symbol and line where the warning is coming from: https://pasteboard.co/KJTFXNozEoLW.png

So, would someone help me to fix these errors and the warning?

Thanks in advance.

Last edited by GlobalPlague; 12-05-2021 at 10:22. Reason: mistake
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:44.


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