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

Solved get_pdata_int(ent, m_iId, 4) returns invalid value


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-10-2021 , 05:37   get_pdata_int(ent, m_iId, 4) returns invalid value
Reply With Quote #1

PHP Code:
public plugin_init()
{
    for(new 
i=CSW_P228szClassname[32]; <= CSW_P90i++)
    {
        if((
get_weaponname(iszClassnamecharsmax(szClassname)) > 7) && ((1<<i) & (CSW_ALL_PISTOLS|CSW_ALL_GRENADES|(1<<CSW_KNIFE))))
        {
            
RegisterHam(Ham_Item_DeployszClassname"fw_weapon_deploy"true);
        }
        else if(
szClassname[0] != 0)
        {
            
RegisterHam(Ham_Item_DeployszClassname"fw_weapon_remove"true);
        }
    }
}

public 
fw_weapon_deploy(ent)
{
    new 
id pev(entpev_owner), ent;
    
    if(
id && (ent=ENT_PLAYER[id]) > 0)
    {
        
engfunc(EngFunc_SetModelent"");
        
        new 
aWeapons[32], szWeaponName[32], wpnum 0currwpn;
        
get_user_weapons(idaWeaponswpnum);
        
        const 
m_iId 43
        currwpn 
= (1<<get_pdata_int(entm_iId4)); // get used weapon...
        
        
for(new 0szString[64], szClassname[32]; wpnumi++)
        {
            
client_print(idprint_chat"currwpn: %d WpnID: %d"get_pdata_int(entm_iId4), aWeapons[i]);
            if( ( (
1<<aWeapons[i]) & ( (0xFFFFFF & ~0x000001) & ~(currwpn|CSW_ALL_PISTOLS|CSW_ALL_GRENADES|(1<<CSW_KNIFE)) ) ) > 0)
            {
                if(
get_weaponname(aWeapons[i], szClassnamecharsmax(szClassname)) > 7) {
                    
formatex(szStringcharsmax(szString), "models/w_%s.mdl"szClassname[7]);
                    
engfunc(EngFunc_SetModelentszString);
                    break;
                }
            }
        }
    }
}

public 
fw_weapon_remove(ent)
{
    new 
id pev(entpev_owner), ent;
    
    if(
id && (ent=ENT_PLAYER[id]) > 0)
    {
        
engfunc(EngFunc_SetModelent"");
    }


Outputs :-
Code:
currwpn: 0 WpnID: 4
currwpn: 0 WpnID: 9
currwpn: 0 WpnID: 25
currwpn: 0 WpnID: 26
currwpn: 0 WpnID: 28
currwpn: 0 WpnID: 29

meta list

Code:
Currently loaded plugins:
      description      stat pend  file              vers      src  load  unlod
 [ 1] AMX Mod X        RUN   -    amxmodx_mm.dll    v1.9.0.5  ini  Start ANY  
 [ 2] POD-Bot mm       RUN   -    podbot_mm.dll     vV3B22    ini  Chlvl ANY  
 [ 3] FakeMeta         RUN   -    fakemeta_amxx.dl  v1.9.0.5  pl1  ANY   ANY  
 [ 4] Ham Sandwich     RUN   -    hamsandwich_amxx  v1.9.0.5  pl1  ANY   ANY  
 [ 5] CSX              RUN   -    csx_amxx.dll      v1.9.0.5  pl1  ANY   ANY  
 [ 6] CStrike          RUN   -    cstrike_amxx.dll  v1.9.0.5  pl1  ANY   ANY  
 [ 7] Fun              RUN   -    fun_amxx.dll      v1.9.0.5  pl1  ANY   ANY  
7 plugins, 7 running
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-10-2021 at 10:18.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-10-2021 , 10:10   Re: get_pdata_int(ent, m_iId, 4) returns invalid value
Reply With Quote #2

Your problem is here:
Code:
public fw_weapon_deploy(ent)
{
	new id = pev(ent, pev_owner), ent;
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-10-2021 , 10:17   Re: get_pdata_int(ent, m_iId, 4) returns invalid value
Reply With Quote #3

lmao i see, i was wondering why i had alot of invalid outputs, the compiler is stupid but it should give warnings about such problems..
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-10-2021 at 10:17.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-10-2021 , 10:26   Re: get_pdata_int(ent, m_iId, 4) returns invalid value
Reply With Quote #4

Yeah, I wish the compiler would catch duplicate variable definitions. It can drive you crazy trying to figure out why code is not working when you know it is otherwise correct.
__________________
Bugsy 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 17:55.


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