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

How do i fix these errors and a warning?


Post New Thread Reply   
 
Thread Tools Display Modes
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
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-05-2021 , 11:43   Re: How do i fix these errors and a warning?
Reply With Quote #2

Post the whole plugin.
__________________
Bugsy is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-06-2021 , 09:27   Re: How do i fix these errors and a warning?
Reply With Quote #3

Quote:
error 088: number of arguments does not match definition
RadiusDamage has 3 args and deals fractional HP so be aware of that if ever deciding to apply it to mods that are not round-based.
Quote:
(672) : error 025: function heading differs from prototype
This is the 'prototype'.
Code:
stock RadiusDamage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier)
https://www.amxmodx.org/api/engine_stocks/RadiusDamage
Quote:
error 021: symbol already defined: "RadiusDamage"
Happens when trying to use a native or stock in this case as the name of your function.

Quote:
(734) : warning 209: function "RadiusDamage" should return a value
Once you get all the other stuff right that might go away. If not script might need type of a RETURN on end of function if it is working otherwise.

I shared the API link a few days ago. Why not use it?
__________________
DJEarthQuake is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 12-08-2021 , 15:21   Re: How do i fix these errors and a warning?
Reply With Quote #4

Quote:
Originally Posted by DJEarthQuake View Post
This is the 'prototype'.
Code:
stock RadiusDamage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier)
https://www.amxmodx.org/api/engine_stocks/RadiusDamage
So, I need to replace this:
Code:
RadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
with this:
Code:
stock RadiusDamage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier)
Is this what I should do?

Quote:
Originally Posted by DJEarthQuake View Post
I shared the API link a few days ago. Why not use it?
Is this what you are talking about:

PHP Code:
/* Copyright (C) 2006-2008 Space Headed Productions
*
* WeaponMod is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation.
*
* WeaponMod is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeaponMod; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/



// Uncomment this, to enable Condition Zero support

// #define CONDITION_ZERO



// Uncomment this, to enable UL Money support

// #define UL_MONEY_SUPPORT



#include <amxmodx>

#include <fakemeta>

#include <weaponmod>



#if defined UL_MONEY_SUPPORT

#include <money_ul>

#endif



// Plugin informations

#if defined UL_MONEY_SUPPORT



#if defined CONDITION_ZERO

new const PLUGIN[] = "WPN GameInfo CZ (UL)"

#else

new const PLUGIN[] = "WPN GameInfo CS (UL)"

#endif



#else



#if defined CONDITION_ZERO

new const PLUGIN[] = "WPN GameInfo CZ"

#else

new const PLUGIN[] = "WPN GameInfo CS"

#endif



#endif

new const VERSION[] = "0.9" // 0.8 - 0.9 fix broken plugin indefinate freezetime.

new const AUTHOR[] = "SPiNX|DevconeS"



// Tasks

#define TASK_ENABLE_FREEZE    1564

#define TASK_UPDATE_SPEED    1565



// Offsets

#define OFFSET_MONEY    115

#define OFFSET_DEATHS    444//449



// GameInfos

new const WEAPON_INDEX 29                    // Weapon Index of the weapon that should be replaced

new const Float:WEAPON_RUN_SPEED 250.0        // Run speed of the replaced weapon

new const WEAPON_COMMAND[] = "weapon_knife"        // Command to take the weapon

new const WEAPON_V_MODEL[] = "models/v_knife.mdl"    // Viewmodel of the weapon that should be replaced

new const WEAPON_P_MODEL[] = "models/p_knife.mdl"    // Playermodel of the weapon that should be replaced

#if defined CONDITION_ZERO

new const GUNSHOT_DECALS[] = {5354555657}    // Gunshot decal list

new const EXPLOSION_DECALS[] = {585960}        // Explosion decal list

new const SMALL_EXPLOSION_DECALS[] = {404142}    // Small Explosion decal list

new const LARGE_BLOOD_DECALS[] = {216217}        // Large blood decals

new const SMALL_BLOOD_DECALS[] = {202203204205206207208209}    // Small blood decals

#else

new const GUNSHOT_DECALS[] = {4142434445}    // Gunshot decal list

new const EXPLOSION_DECALS[] = {464748}        // Explosion decal list

new const SMALL_EXPLOSION_DECALS[] = {282933}    // Small Explosion decal list

new const LARGE_BLOOD_DECALS[] = {204205}        // Large blood decals

new const SMALL_BLOOD_DECALS[] = {190191192193194196197198}    // Small blood decals

#endif



// User Messages

new g_msgCurWeapon

new g_msgAmmoX

new g_msgScoreInfo

new g_msgDeathMsg

new g_msgDamage

#if !defined UL_MONEY_SUPPORT

new g_msgMoney

#endif



// CVAR Pointers

new g_PlayerKillMoney

new g_MonsterKillMoney

new g_Enabled



// General information

new bool:g_FreezeTime

new g_MaxPlayers



// Register the plugin

public plugin_init()

{

    
// Important informations :)

    
register_plugin(PLUGINVERSIONAUTHOR)



    
// Events

    
register_event("CurWeapon""eventCurWeapon""be""1=1")

    
register_event("TextMsg""eventRoundRestart""a""2=#Game_will_restart_in")

    
register_logevent("logEventRoundStart"2"1=Round_Start")

    
register_logevent("logEventRoundEnd"2"0=World triggered""1=Round_End")



    
// User Messages

    
g_msgCurWeapon get_user_msgid("CurWeapon")

    
g_msgAmmoX get_user_msgid("AmmoX")

    
g_msgScoreInfo get_user_msgid("ScoreInfo")

    
g_msgDeathMsg get_user_msgid("DeathMsg")

    
g_msgDamage get_user_msgid("Damage")

#if !defined UL_MONEY_SUPPORT

    
g_msgMoney get_user_msgid("Money")

#endif



    // CVARs

    
g_PlayerKillMoney register_cvar("wpn_playerkill_money""300")

    
g_MonsterKillMoney register_cvar("wpn_monsterkill_money""800")

    
g_Enabled get_cvar_pointer("wpn_enabled")



    
// Forwards

    
register_forward(FM_EmitSound"fwd_EmitSound")



    
wpn_gameinfo_init()

    
g_MaxPlayers get_maxplayers()

}



// Start sending some infos to WeaponMod :)

wpn_gameinfo_init()

{

    
// Let WeaponMod know that a GameInfo file is installed

    
wpn_set_gameinfo(gi_available1)



    
// Is this a Teamplay game?

    
wpn_set_gameinfo(gi_teamplay1)

}



// These natives are very important since they'll get called by WeaponMod and addons

public plugin_natives()

{

    
register_native("wpn_gi_is_default_weapon""native_gi_is_default_weapon")

    
register_native("wpn_gi_set_offset_int""native_gi_set_offset_int")

    
register_native("wpn_gi_get_offset_int""native_gi_get_offset_int")

    
register_native("wpn_gi_in_freeze_time""native_gi_in_freeze_time")

    
register_native("wpn_gi_take_default_weapon""native_gi_take_default_weapon")

    
register_native("wpn_gi_get_gunshot_decal""native_gi_get_gunshot_decal")

    
register_native("wpn_gi_get_explosion_decal""native_gi_get_explosion_decal")

    
register_native("wpn_gi_get_smallexplosion_decal""native_gi_get_smallexpl_decal")

    
register_native("wpn_gi_get_blood_decal""native_gi_get_blood_decal")

    
register_native("wpn_gi_get_smallblood_decal""native_gi_get_smallblood_decal")

}



// Checks if the selected weapon is the default weapon

public native_gi_is_default_weapon()

{

    if(
get_param(1) == WEAPON_INDEX)

    {

        return 
1

    
}



    return 
0

}



// Sets an offset value

public native_gi_set_offset_int()

{

    return 
set_offset_value(get_param(1), get_param(2), get_param(3))

}



// Gets an offset value

public native_gi_get_offset_int()

{

    return 
get_offset_value(get_param(1), get_param(2))

}



// Identifies if the game is currently in the freeze time

public native_gi_in_freeze_time()

{

    return 
g_FreezeTime

}



// Player has to take the default weapon (obviously picked up a new special weapon)

public native_gi_take_default_weapon()

{

    
engclient_cmd(get_param(1), WEAPON_COMMAND)

}



// Returns a random gunshot decal

public native_gi_get_gunshot_decal()

{

    return 
GUNSHOT_DECALS[random_num(0sizeof(GUNSHOT_DECALS) - 1)]

}



// Returns a random explosion decal

public native_gi_get_explosion_decal()

{

    return 
EXPLOSION_DECALS[random_num(0sizeof(EXPLOSION_DECALS) - 1)]

}



// Returns a random small explosion decal

public native_gi_get_smallexpl_decal()

{

    return 
SMALL_EXPLOSION_DECALS[random_num(0sizeof(SMALL_EXPLOSION_DECALS) - 1)]

}



// Returns a random large blood decal

public native_gi_get_blood_decal()

{

    return 
LARGE_BLOOD_DECALS[random_num(0sizeof(LARGE_BLOOD_DECALS) - 1)]

}



// Returns a random small blood decal

public native_gi_get_smallblood_decal()

{

    return 
SMALL_BLOOD_DECALS[random_num(0sizeof(SMALL_BLOOD_DECALS) - 1)]

}




// Called when round's restarted

public eventRoundRestart()
{
    if(!
task_exists(TASK_ENABLE_FREEZE))

    {

        
// No task has been created by now, create one

        
set_task(float(read_data(3))-0.1"enable_freeze"TASK_ENABLE_FREEZE)

    }

}





// Round started

public logEventRoundStart()

{

    
g_FreezeTime false



    
// Create update speed task (delayed because of possibility to be overwritten by CS)

    
set_task(0.1"update_speed"TASK_UPDATE_SPEED)

}



// Delayed speed update

public update_speed()

{

    new 
usrwpn = -1

    
new wpnid = -1

    
new Float:maxspeed

    
for(new id 1id g_MaxPlayersid++)

    {

        
usrwpn wpn_get_user_weapon(id)

        if(
usrwpn != -1)

        {

            
// User is using a WeaponMod weapon, set his maxspeed

            
wpnid wpn_get_userinfo(idusr_wpn_indexusrwpn)

            
maxspeed wpn_get_float(wpnidwpn_run_speed)

            
set_pev(idpev_maxspeedmaxspeed)

        }

    }

}



// Round end

public logEventRoundEnd()

{

    
set_task(1.0"enable_freeze"TASK_ENABLE_FREEZE)

}



// Removes special weapons on map

public enable_freeze()

{

    
g_FreezeTime true

}



// This function is used to update the players Ammo displayed on HUD

public wpn_gi_update_ammo(idwpnidpAmmosAmmo)

{

    if(
wpnid > -1)    // -1 would be no special weapon

    
{

        
// Primary Ammo

        
message_begin(MSG_ONEg_msgCurWeapon, {000}, id)

        
write_byte(1)

        
write_byte(20)

        
write_byte(pAmmo)

        
message_end()



        
// Secondary Ammo

        
message_begin(MSG_ONEg_msgAmmoX, {000}, id)

        
write_byte(3)

        
write_byte(sAmmo)

        
message_end()



        return 
PLUGIN_CONTINUE

    
}



    
// Hide Ammo from HUD since user is using the knife

    
message_begin(MSG_ONEg_msgCurWeapon, {000}, id)

    
write_byte(-1)

    
write_byte(29)

    
write_byte(-1)

    
message_end()



    return 
PLUGIN_CONTINUE

}



// A player was killed by a special weapon

public wpn_gi_player_killed(idkillerhitplacewpnidweapon[], bool:monster)

{

    
// Update Scoreboard - Killer

    
emessage_begin(MSG_BROADCASTg_msgScoreInfo)

    
ewrite_byte(killer)

    
ewrite_short(get_user_frags(killer))

    
ewrite_short(get_offset_value(killeroffset_deaths))

    
ewrite_short(0)

    
ewrite_short(get_user_team(killer))

    
emessage_end()



    new 
moneyIncreasement 0



    
// Monster's can't be showed inside a death message and do not have a scoreboard :P

    
if(!monster)

    {

        
// Write death message

        
emessage_begin(MSG_BROADCASTg_msgDeathMsg)

        
ewrite_byte(killer)

        
ewrite_byte(id)

        
ewrite_byte(hitplace == 0)

        
ewrite_string(weapon)

        
emessage_end()



        if(
id != killer)    // No need to update the scoreboard twice :)

        
{

            
// Update Scoreboard - Victim

            
emessage_begin(MSG_BROADCASTg_msgScoreInfo)

            
ewrite_byte(id)

            
ewrite_short(get_user_frags(id))

            
ewrite_short(get_offset_value(idoffset_deaths))

            
ewrite_short(0)

            
ewrite_short(get_user_team(id))

            
emessage_end()

        }



        
moneyIncreasement get_pcvar_num(g_PlayerKillMoney)

    } else {

        
moneyIncreasement get_pcvar_num(g_MonsterKillMoney)

    }



    if(
moneyIncreasement != 0)

    {

        
// Money of the killer changes, update it :)

        
new newMoney get_offset_value(killeroffset_money)+moneyIncreasement

        set_offset_value
(killeroffset_moneynewMoney)

    }

}



// Damage caused by a WeaponMod weapon

public wpn_attack_damage(victimattackerwpniddamagehitplacedamageTypebool:monster)

{

    if(
monster || !pev_valid(victim))

    {

        
// Damage was caused to a monster or the victim is not a valid entity, ignore

        
return PLUGIN_CONTINUE

    
}



    
// Make sure it's definetely a player and make sure he's alive

    
if(pev(victimpev_flags) & (FL_CLIENT FL_FAKECLIENT))

    {

        if(
is_user_alive(victim))

        {

            
// Get attacker's origin

            
new origin[3]

            
get_user_origin(attackerorigin)



            
// Write damage message

            
message_begin(MSG_ONE_UNRELIABLEg_msgDamage, {0,0,0}, victim)

            
write_byte(0)    // Damage save not supported

            
write_byte(damage)

            
write_long(damageType)

            
write_coord(origin[0])

            
write_coord(origin[1])

            
write_coord(origin[2])

            
message_end()

        }

    }

    return 
PLUGIN_CONTINUE

}



// This forward is used to reset the replaced weapon to its default values

public wpn_gi_reset_weapon(id)

{

    
// Models

    
set_pev(idpev_viewmodelengfunc(EngFunc_AllocStringWEAPON_V_MODEL))

    
set_pev(idpev_weaponmodelengfunc(EngFunc_AllocStringWEAPON_P_MODEL))



    
// Run speed

    
if(!g_FreezeTime)

    {

        
set_pev(idpev_maxspeedWEAPON_RUN_SPEED)

    }

}



// Handle weapon change

public eventCurWeapon(id)

{

    if(!
get_pcvar_num(g_Enabled)) return PLUGIN_CONTINUE

    
if(wpn_user_weapon_count(id) > 0)

    {

        if(
read_data(2) == WEAPON_INDEX)

        {

            
// Take the last used weapon

            
wpn_change_user_weapon(idwpn_get_user_weapon(id), false)

        }

    }



    return 
PLUGIN_CONTINUE

}



// Handle draw command

public client_command(id)

{

    if(!
get_pcvar_num(g_Enabled)) return PLUGIN_CONTINUE



    
new cmd[32]

    
read_argv(0cmd31)



    if(
equal(cmdWEAPON_COMMAND))    // Does he execute the knife command?

    
{

        new 
wpnCount wpn_user_weapon_count(id)

        if(
wpnCount 0)    // Does he even have a special weapon?

        
{

            new 
clipammo

            
new weapon get_user_weapon(idclipammo)

            if(
weapon == WEAPON_INDEX)    // Is his current weapon the knife?

            
{

                new 
actWeapon wpn_get_user_weapon(id)+1

                
if(actWeapon >= wpnCount)

                {

                    
// Weapon index got over the amount of weapons, set it back to the beginning

                    
actWeapon = -1

                
}

                
// Now send the changes back to weaponmod :)

                
wpn_change_user_weapon(idactWeapon)

            }

        }

    }



    return 
PLUGIN_CONTINUE

}



// Block knife sound

public fwd_EmitSound(entitychannel, const sample[])

{

    if(
entity && entity 33)

    {

        if(
is_user_alive(entity))

        {

            if(
wpn_get_user_weapon(entity) != -1)

            {

                
// Player's using a weaponmod weapon, block any knife sounds emitted

                
if(containi(sample"weapons/knife_") != -1)

                {

                    return 
FMRES_SUPERCEDE

                
}

            }

        }

    }



    return 
FMRES_IGNORED

}



// Gets offset data

public get_offset_value(idtype)

{

    new 
key = -1

    
switch(type)

    {

        case 
offset_money:

        {

#if defined UL_MONEY_SUPPORT

            
return cs_get_user_money_ul(id)

#else

            
key OFFSET_MONEY

#endif

        
}

        case 
offset_deathskey OFFSET_DEATHS

    
}



    if(
key != -1)

    {

        if(
is_amd64_server()) key += 25

        
return get_pdata_int(idkey)

    }



    return -
1;

}



// Sets offset data

public set_offset_value(idtypevalue)

{

    new 
key = -1

    
switch(type)

    {

        case 
offset_money:

        {

#if defined UL_MONEY_SUPPORT

            
return cs_set_user_money_ul(idvalue)

#else

            
key OFFSET_MONEY



            
// Send Money message to update player's HUD

            
message_begin(MSG_ONE_UNRELIABLEg_msgMoney, {0,0,0}, id)

            
write_long(value)

            
write_byte(1)    // Flash (difference between new and old money)

            
message_end()

#endif

        
}

        case 
offset_deathskey OFFSET_DEATHS

    
}



    if(
key != -1)

    {

        if(
is_amd64_server()) key += 25

        set_pdata_int
(idkeyvalue)

    }



    return 
PLUGIN_CONTINUE


If yes, keep in mind I already have it. But, the plugin I'm having problems with doesn't require WeaponMod.

Quote:
Originally Posted by DJEarthQuake View Post
"RadiusDamage has 3 args and deals fractional HP so be aware of that if ever deciding to apply it to mods that are not round-based."
What does that mean? Does it mean RadiusDamage shouldn't be applied to a server with an infinite round? My server has a finite round of 8 minutes, after that, the round ends and a new round starts. If the last human or the first zombie is killed before the end of these 8 minutes, the round will end earlier than the end of the 8 minutes. What did you mean by "round-based"?

It seems I didn't understand how to fix the errors...

Last edited by GlobalPlague; 12-08-2021 at 15:25.
GlobalPlague is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-09-2021 , 07:50   Re: How do i fix these errors and a warning?
Reply With Quote #5

You are misapplying a native as a function header and function header as a native. Radiusdamage cannot be the name of a function and the name of a native. Use another name. Replace radiusdamage with something else, unique.

Code:
RadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
==>
Code:
TheRadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
API is www.amxmodx.org/api/

One can type radiusdmage and it is a native in the api. You are using a native as a name of a function. Can not do that.

I erased the part about the consequences of the native radiusdamage as that is not what you were really trying to use. It hoses the client. It can be fixed but it's more code and not worth the effort as it will always be buggy.
__________________

Last edited by DJEarthQuake; 12-09-2021 at 10:17. Reason: updating
DJEarthQuake is offline
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 12-09-2021 , 14:26   Re: How do i fix these errors and a warning?
Reply With Quote #6

Quote:
Originally Posted by DJEarthQuake View Post
You are misapplying a native as a function header and function header as a native. Radiusdamage cannot be the name of a function and the name of a native. Use another name. Replace radiusdamage with something else, unique.

Code:
RadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
==>
Code:
TheRadiusDamage(Float:vecSrc[3], pevInflictor, pevAttacker, Float:flDamage, Float:flRadius, bitsDamageType)
API is www.amxmodx.org/api/

One can type radiusdmage and it is a native in the api. You are using a native as a name of a function. Can not do that.

I erased the part about the consequences of the native radiusdamage as that is not what you were really trying to use. It hoses the client. It can be fixed but it's more code and not worth the effort as it will always be buggy.
When I replaced the old line with the new line you gave me, I got 2 errors, but I fixed them by myself. Now, the plugin works. Adding "The" (or anything else that makes "RadiusDamage" unique) fixed the problem, and eliminated the rest of the errors (and the warning) I mentioned in my first post.

Thanks.
GlobalPlague is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-09-2021 , 19:10   Re: How do i fix these errors and a warning?
Reply With Quote #7

You are most welcome. Glad you got it!
__________________

Last edited by DJEarthQuake; 12-09-2021 at 19:11.
DJEarthQuake is offline
Reply



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 15:28.


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