Raised This Month: $301 Target: $400
 75% 

Problem with code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 04-30-2020 , 11:24   Problem with code
Reply With Quote #1

I have this error:

PHP Code:
Exception reportedInvalid Handle 0 (error 4)
L 04/30/2020 18:12:40: [SMBlamingplugin.smx
L 04
/30/2020 18:12:40: [SMCall stack trace:
L 04/30/2020 18:12:40: [SM]   [0GetTrieValue
L 04
/30/2020 18:12:40: [SM]   [1Line 892plugin.sp::EventItemPickup2
L 04
/30/2020 18:12:40: [SM]   [3GivePlayerItem 
what is problem??

PHP Code:
public Action EventItemPickup2(int clientint weapon)
{
    if(
weapon == GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(clientCS_SLOT_SECONDARY) && DuelEnabled)
    {
        
int warray;
        
char classname[4];
        
//GetEdictClassname(weapon, classname, sizeof(classname));
        
Format(classname4"%i"GetEntProp(weaponProp_Send"m_iItemDefinitionIndex"));
        
        if(!
GetTrieValue(trie_armasclassnamewarray)) //line 892
        
{
            
warray GetEntProp(weaponProp_Send"m_iPrimaryReserveAmmoCount");
            
            
SetTrieValue(trie_armasclassnamewarray);
        }
    }

and
m_iPrimaryReserveAmmoCount // not found..

Last edited by jugule; 04-30-2020 at 11:41.
jugule is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2020 , 12:02   Re: Problem with code
Reply With Quote #2

Your Handle trie_armas is invalid or null.
__________________
Do not Private Message @me
Bacardi is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 04-30-2020 , 12:06   Re: Problem with code
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
Your Handle trie_armas is invalid or null.
How can I solve it?
jugule is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2020 , 12:12   Re: Problem with code
Reply With Quote #4

I can't see your whole code. Are you creating Stringmap CreateTrie() anywhere ?
Bacardi is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 04-30-2020 , 12:18   Re: Problem with code
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
I can't see your whole code. Are you creating Stringmap CreateTrie() anywhere ?
No.

trie_armas full code

PHP Code:

Handle 
    attack_timer 
INVALID_HANDLE,
    
trie_armas;

public 
void Darm(int client)
{
    if(
IsPlayerAlive(client) && DuelEnabled)
    {
        
int weapon GetEntPropEnt(clientProp_Data"m_hActiveWeapon");
        if(
weapon && (weapon == GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(clientCS_SLOT_SECONDARY)))
        {
            
int warray;
            
char classname[4];
            
//GetEdictClassname(weapon, classname, sizeof(classname));
            
Format(classname4"%i"GetEntProp(weaponProp_Send"m_iItemDefinitionIndex"));
            if(
GetTrieValue(trie_armasclassnamewarray))
            {
                if(
GetReserveAmmo(weapon) != warraySetEntProp(weaponProp_Send"m_iClip1"1);
            }
        }
    }
}

public 
Action EventItemPickup2(int clientint weapon)
{
    if(
weapon == GetPlayerWeaponSlot(clientCS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(clientCS_SLOT_SECONDARY) && DuelEnabled)
    {
        
int warray;
        
char classname[4];
        
//GetEdictClassname(weapon, classname, sizeof(classname));
        
Format(classname4"%i"GetEntProp(weaponProp_Send"m_iItemDefinitionIndex"));
        
        if(!
GetTrieValue(trie_armasclassnamewarray))
        {
            
warray GetEntProp(weaponProp_Send"m_iClip1");
            
            
SetTrieValue(trie_armasclassnamewarray);
        }
    }

full error

PHP Code:
 04/30/2020 19:19:24: [SMException reportedInvalid Handle 0 (error 4)
L 04/30/2020 19:19:24: [SMBlaminglss.smx
L 04
/30/2020 19:19:24: [SMCall stack trace:
L 04/30/2020 19:19:24: [SM]   [0GetTrieValue
L 04
/30/2020 19:19:24: [SM]   [1Line 882lss.sp::EventItemPickup2
L 04
/30/2020 19:19:24: [SM]   [3GivePlayerItem 

Last edited by jugule; 04-30-2020 at 12:20.
jugule is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2020 , 12:24   Re: Problem with code
Reply With Quote #6

ok, there is more code ?
Is this known plugin from Alliedmodders site ? https://forums.alliedmods.net/forumdisplay.php?f=108
__________________
Do not Private Message @me

Last edited by Bacardi; 04-30-2020 at 12:24.
Bacardi is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 04-30-2020 , 12:26   Re: Problem with code
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
ok, there is more code ?
Is this known plugin from Alliedmodders site ? https://forums.alliedmods.net/forumdisplay.php?f=108
Solved.

Last edited by jugule; 04-30-2020 at 12:45.
jugule is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-30-2020 , 12:47   Re: Problem with code
Reply With Quote #8

not... yet.

ok, you need somewhere in your code, do it once
fro example:
PHP Code:
public void OnPluginStart()
{
    
trie_armas CreateTrie();

__________________
Do not Private Message @me
Bacardi is offline
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 04-30-2020 , 12:54   Re: Problem with code
Reply With Quote #9

Quote:
Originally Posted by Bacardi View Post
not... yet.

ok, you need somewhere in your code, do it once
fro example:
PHP Code:
public void OnPluginStart()
{
    
trie_armas CreateTrie();

yes, that was the problem.
jugule is offline
Reply


Thread Tools
Display Modes

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 09:45.


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