Raised This Month: $ Target: $400
 0% 

Invalid Trie Handle


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Elusive138
Senior Member
Join Date: Dec 2010
Old 01-09-2011 , 23:28   Re: Invalid Trie Handle
Reply With Quote #7

Sorry, probably should have done this the first post..

EDIT: Never mind, now works correctly. I didn't even know there was a v1.8.2...
Quote:
joaquimandrade - Fix TrieSetArray reading the wrong parameter
Oh, and thanks fysiks.

If anyone could tell me what TrieMallocCount() and TrieFreeCount() does, exactly, I'd very much appreciate it.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Elusive"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /test2""Debug_Test2")
}

stock Float:CheckCooldown(index=0Float:cooldownTime=0.0id=0bool:readonly=falsebool:remove=false)
{
    static 
Trie:cooldownTrie
    
new key[16], Float:buffer[33
    
    if (!
cooldownTrie)
    {
        
cooldownTrie TrieCreate()
    }
    if (
cooldownTrie == Invalid_Trie)
    {
        
set_fail_state("Invalid Handle")
    }
    
formatex(keycharsmax(key), "ID%i"id)
    
    if (
remove)
    {
        if (
TrieKeyExists(cooldownTriekey))
        {
            
TrieDeleteKey(cooldownTriekey)
            return 
Float:1
        
}
        else
        {
            return 
Float:0
        
}
    }
    
    if (
TrieKeyExists(cooldownTriekey))
    {
        
TrieGetArray(cooldownTriekeybuffersizeof(buffer))
    }
    
    new 
Float:currentTime get_gametime()
    if (
buffer[index] > currentTime)
    {
        return (
buffer[index] - currentTime)
    }
    if (
readonly)
    {
        return 
Float:0
    
}
    
    
buffer[index] = currentTime cooldownTime
    
    TrieSetArray
(cooldownTriekeybuffersizeof(buffer))
    
    return 
Float:0
}

public 
Debug_Test2(id)
{
    
client_print(idprint_chat"ID = 222, cooldown = %f"CheckCooldown(id5.0222__))
    
client_print(idprint_chat"ID = 555, cooldown = %f"CheckCooldown(id10.0555__))
    
client_print(idprint_chat"ID = 222, cooldown = %f"CheckCooldown(id5.0222__))
    
client_print(idprint_chat"ID = 555, cooldown = %f"CheckCooldown(id10.0555__))
    
client_print(idprint_chat"ID = 222, cooldown = %f"CheckCooldown(id5.0222_true))
    
client_print(idprint_chat"ID = 555, cooldown = %f"CheckCooldown(id10.0555_true))
    
client_print(idprint_chat"ID = 222, cooldown = %f"CheckCooldown(id5.0222__))
    
client_print(idprint_chat"ID = 555, cooldown = %f"CheckCooldown(id10.0555__))

Code:
L 01/10/2011 - 15:25:44: Invalid trie handle provided (1)
L 01/10/2011 - 15:25:44: [AMXX] Displaying debug trace (plugin "Debug.amxx")
L 01/10/2011 - 15:25:44: [AMXX] Run time error 10: native error (native "TrieSetArray")
L 01/10/2011 - 15:25:44: [AMXX]    [0] Debug.sma::CheckCooldown (line 62)
L 01/10/2011 - 15:25:44: [AMXX]    [1] Debug.sma::Debug_Test2 (line 69)

Last edited by Elusive138; 01-10-2011 at 00:19.
Elusive138 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 02:12.


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