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

Finding an error in source code.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abhishek_deshkar
Senior Member
Join Date: Jun 2013
Location: Earth
Old 11-04-2019 , 05:01   Finding an error in source code.
Reply With Quote #1

Hi,

I have source code of CSDM plugin. While compiling it says,

PHP Code:
//// csdm_misc.sma
//
// D:\AMXX Plugins + Server stuff\CSDM\csdm_misc.sma(12) : error 020: invalid symbol name ""
//
// 1 Error.
// Could not locate output file compiled\csdm_misc.amx (compile failed).
//
// Compilation Time: 0.56 sec 
I'm not able to find the error in the code. Here is the code.

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <csdm>


#define IsPlayer(%1)                (1 <= (%1) <= g_iMaxPlayers)

const HideWeapon_Flags 1

enum
{
    
HIDEHUD_WEAPONS        =    (1<<0),
    
HIDEHUD_FLASHLIGHT    =    (1<<1),
    
HIDEHUD_ALL            =    (1<<2),
    
HIDEHUD_HEALTH        =    (1<<3),
    
HIDEHUD_TIMER        =    (1<<4),
    
HIDEHUD_MONEY        =    (1<<5),
    
HIDEHUD_CROSSHAIR    =    (1<<6)
}

new const 
g_szWeaponList[][] = 
{
    
"weapon_m4a1"
    
"weapon_usp",
    
"weapon_famas"
    
"weapon_glock18"
}

new 
HamHook:g_hSecondaryAttack[sizeof(g_szWeaponList)], HamHook:g_hAddToPlayer[sizeof(g_szWeaponList)]

new 
g_bWeaponState[MAX_CLIENTS 1][CSW_P90 1]
new 
g_iMaxPlayers

new bool:g_bWeaponStateRemember trueg_bitHideHudFlagsg_iRefillClip 1


public plugin_init()
{
    
register_plugin("CSDM Misc"CSDM_VERSION_STRING"Vaqtincha")

    for(new 
0sizeof(g_szWeaponList); i++)
    {
        
DisableHamForward(g_hAddToPlayer[i] = RegisterHam(Ham_Item_AddToPlayerg_szWeaponList[i], "CBasePlayerItem_AddToPlayer", .Post true))
        
DisableHamForward(g_hSecondaryAttack[i] = RegisterHam(Ham_Weapon_SecondaryAttackg_szWeaponList[i], "CBasePlayerItem_SecAttack", .Post true))
    }

    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_cfg()
{
    
CheckForwards()
}

public 
client_putinserver(pPlayer)
{
    
g_bWeaponState[pPlayer][CSW_M4A1] = g_bWeaponState[pPlayer][CSW_USP] = g_bWeaponState[pPlayer][CSW_FAMAS] = g_bWeaponState[pPlayer][CSW_GLOCK18] = 0;
}


public 
CSDM_Initialized(const szVersion[])
{
    if(!
szVersion[0])
        
pause("ad")
}

public 
CSDM_ConfigurationLoad(const ReadTypes:iReadAction)
{
    
CSDM_RegisterConfig("misc""ReadCfg")
}

public 
CSDM_PlayerKilled(const pVictim, const pKiller, const HitBoxGroup:iLastHitGroup)
{
    if(!
g_iRefillClip || !pKiller)
        return

    if(
pVictim != pKiller && is_user_alive(pKiller))
    {
        switch(
g_iRefillClip)
        {
            case 
1:
            {
                new 
pActiveWeapon get_member(pKillerm_pActiveItem)
                if(
pActiveWeapon 0) {
                    
rg_instant_reload_weapons(pKillerpActiveWeapon)
                }
            }
            case 
2:    rg_instant_reload_weapons(pKiller// all
        
}
    }
}

public 
CBasePlayerItem_SecAttack(const pWeapon)
{
    if(
pWeapon <= 0)
        return 
HAM_IGNORED

    
new pPlayer get_member(pWeaponm_pPlayer)
    if(
IsPlayer(pPlayer)) {
        
g_bWeaponState[pPlayer][get_member(pWeaponm_iId)] = get_member(pWeaponm_Weapon_iWeaponState)
    }

    return 
HAM_IGNORED
}

public 
CBasePlayerItem_AddToPlayer(const pWeapon, const pPlayer)
{
    if(
pWeapon && IsPlayer(pPlayer)) {
        
set_member(pWeaponm_Weapon_iWeaponStateg_bWeaponState[pPlayer][get_member(pWeaponm_iId)])
    }

    return 
HAM_IGNORED
}

public 
Message_HideWeapon(const iMsgId, const iMsgDest, const iMsgEntity)
{
    if(
g_bitHideHudFlags) {
        
set_msg_arg_int(HideWeapon_FlagsARG_BYTEget_msg_arg_int(HideWeapon_Flags) | g_bitHideHudFlags)
    }
}

public 
ReadCfg(const szLineData[], const iSectionID)
{
    new 
szKey[MAX_KEY_LEN], szValue[MAX_VALUE_LEN], szSign[2]
    if(!
ParseConfigKey(szLineDataszKeyszSignszValue))
        return

    if(
equali(szKey"weaponstate_remember")) 
    {
        
g_bWeaponStateRemember bool:(str_to_num(szValue))
    }
    else if(
equali(szKey"refill_clip_weapons")) 
    {
        
g_iRefillClip clamp(str_to_num(szValue), 02)
    }
    else if(
equali(szKey"hide_hud_flags")) 
    {
        if(
ContainFlag(szValue"c"))
            
g_bitHideHudFlags |= HIDEHUD_CROSSHAIR
        
if(ContainFlag(szValue"f"))
            
g_bitHideHudFlags |= HIDEHUD_FLASHLIGHT
        
if(ContainFlag(szValue"m"))
            
g_bitHideHudFlags |= HIDEHUD_MONEY
        
if(ContainFlag(szValue"h"))
            
g_bitHideHudFlags |= HIDEHUD_HEALTH
        
if(ContainFlag(szValue"t"))
            
g_bitHideHudFlags |= HIDEHUD_TIMER
    
}
}

CheckForwards()
{
    static 
iMsgIdHideWeaponiMsgHookHideWeapon
    
if(!iMsgIdHideWeapon) {
        
iMsgIdHideWeapon get_user_msgid("HideWeapon")
    }

    for(new 
0sizeof(g_szWeaponList); i++)
    {
        if(
g_bWeaponStateRemember)
        {
            
EnableHamForward(g_hAddToPlayer[i])
            
EnableHamForward(g_hSecondaryAttack[i])
        }
        else
        {
            
DisableHamForward(g_hAddToPlayer[i])
            
DisableHamForward(g_hSecondaryAttack[i])
        }    
    }

    if(
g_bitHideHudFlags && !iMsgHookHideWeapon)
    {
        
iMsgHookHideWeapon register_message(iMsgIdHideWeapon"Message_HideWeapon")
    }
    else if(!
g_bitHideHudFlags && iMsgHookHideWeapon)
    {
        
unregister_message(iMsgIdHideWeaponiMsgHookHideWeapon)
        
iMsgHookHideWeapon 0
    
}

Thanks!
abhishek_deshkar is offline
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 11-05-2019 , 03:12   Re: Finding an error in source code.
Reply With Quote #2

Enum has no name. Try setting a name.
iNvectus is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 11-07-2019 , 15:25   Re: Finding an error in source code.
Reply With Quote #3

Try this
PHP Code:
enum
{
    
HIDEHUD_WEAPONS        =    (1<<0),
    
HIDEHUD_FLASHLIGHT    =    (1<<1),
    
HIDEHUD_ALL            =    (1<<2),
    
HIDEHUD_HEALTH        =    (1<<3),
    
HIDEHUD_TIMER        =    (1<<4),
    
HIDEHUD_MONEY        =    (1<<5),
    
HIDEHUD_CROSSHAIR    =    (1<<6)

->
PHP Code:
enum (<<= 1)
{
    
HIDEHUD_WEAPONS 1,
    
HIDEHUD_FLASHLIGHT,
    
HIDEHUD_ALL,
    
HIDEHUD_HEALTH,
    
HIDEHUD_TIMER,
    
HIDEHUD_MONEY,
    
HIDEHUD_CROSSHAIR

__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 17:17.


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