Raised This Month: $32 Target: $400
 8% 

[TUT] Tries


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-27-2012 , 20:34   Re: [TUT] Tries
Reply With Quote #21

Quote:
Originally Posted by guipatinador View Post
I have found that between 1000 and 10000 it becomes slower (don't know why).
To what function are you referring here? aka What is "it"? TrieSet[func] should get slower with the larger number of keys. I don't know the internal functions it uses but it's possible that it has some sort of exponential relationship between the number of existing keys and time to insert the new key.
__________________

Last edited by fysiks; 12-27-2012 at 20:36.
fysiks is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 12-27-2012 , 21:02   Re: [TUT] Tries
Reply With Quote #22

Quote:
Originally Posted by fysiks View Post
To what function are you referring here? aka What is "it"? TrieSet[func] should get slower with the larger number of keys (...)
Yes, I was talking about TrieSetCell.
I didn't test (yet) TrieSet[String|Array].
guipatinador is offline
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 12-29-2012 , 07:03   Re: [TUT] Tries
Reply With Quote #23

It should be using prefix tree method. It's obivious, that it could become slower on huge amounts of data. It's not a hash table. Also, question about what slow times we are talking.
__________________
My plugins:
[ZP] ZM_VIP (v2.0.0 is comming. v1.9.1 BETA is out!)

aaarnas is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 01-30-2013 , 21:34   Re: [TUT] Tries
Reply With Quote #24

Great tutorial

Where can i download fixed amxmodx build? (Trie arrays problem).
I'm not sure are the files on this link updated? http://www.amxmodx.org/snapshots.php
OvidiuS is offline
Send a message via Skype™ to OvidiuS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-30-2013 , 21:40   Re: [TUT] Tries
Reply With Quote #25

The TrieSetArray() bug was fixed on 2010-09-11 and the latest fix was 2010-12-12. See http://hg.alliedmods.net/amxmodx-central/
__________________
fysiks is offline
Old 01-30-2013, 21:43
OvidiuS
This message has been deleted by OvidiuS. Reason: my fail.
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 03-23-2013 , 04:21   Re: [TUT] Tries
Reply With Quote #26

@guipatinador

is it possible you could make it so the steamd ids and the Access Type ( Admin, Mod, Vip )
load from .ini file instead or hardcoded?

make it easier to edit players add or delete them

PHP Code:
#include < amxmodx >

new Trie:g_tAuthIdOfPeople

#define LOGFILE "steamidsofpeople.log"

// Just to be more easy...
#define ADMIN 1
#define MOD 2
#define VIP 3

public plugin_init( )
{
    
register_plugin"trie example""1.0.2""guipatinador" )
    
    
g_tAuthIdOfPeople TrieCreate( )
    
    
TrieSetCellg_tAuthIdOfPeople"STEAM_2:3:123456"ADMIN // admin is 1
    
TrieSetCellg_tAuthIdOfPeople"STEAM_2:3:654321"ADMIN )
    
TrieSetCellg_tAuthIdOfPeople"STEAM_2:3:123654"MOD // mod is 2
    
TrieSetCellg_tAuthIdOfPeople"STEAM_2:3:456123"VIP // vip is 3
}

public 
plugin_end( )
{
    
TrieDestroyg_tAuthIdOfPeople )
}

public 
client_authorizedid )
{
    new 
szAuthID35 ]; get_user_authididszAuthIDcharsmaxszAuthID ) )
    
    new 
iNum
    
    
// This will save our integer (ADMIN, MOD or VIP) in iNum, if the key is on the trie
    
if( TrieGetCellg_tAuthIdOfPeopleszAuthIDiNum ) )
    {
        switch( 
iNum )
        {
            case 
ADMIN:
                
log_to_fileLOGFILE"A Admin entered the server" )
            
            case 
MOD:
                
log_to_fileLOGFILE"A Mod entered the server" )
            
            case 
VIP:
                
log_to_fileLOGFILE"A Vip entered the server" )
        }
    }
    
    else 
// The key (Steam ID) is not in the trie
    
{
        
log_to_fileLOGFILE"A normal player entered the server" )
    }


Last edited by Blizzard_87; 03-23-2013 at 04:22.
Blizzard_87 is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 03-23-2013 , 04:34   Re: [TUT] Tries
Reply With Quote #27

Spoiler


Your file should be like this,
"STEAM_ID_1" "1"
"STEAM_ID_2" "3"

Last edited by guipatinador; 03-23-2013 at 04:34.
guipatinador is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 03-23-2013 , 04:42   Re: [TUT] Tries
Reply With Quote #28

THANKS... your a legend.... you've helped me alot in past to thanks mate!!!
Blizzard_87 is offline
Decompiler
>:)
Join Date: Mar 2013
Old 05-29-2013 , 13:33   Re: [TUT] Tries
Reply With Quote #29

Quote:
Originally Posted by guipatinador View Post
Spoiler


Your file should be like this,
"STEAM_ID_1" "1"
"STEAM_ID_2" "3"
Can someone help me make the following changes to the code above:

1- Instead of using "1", "2" ..etc in the file, I'd like to directly input the case. I'm trying to get it to print whatever is added after the steamid. "STEAM_ID_1" "ADMIN" = client_print (id,print_chat, "It's good to see you back ADMIN" ).
2- Remove the string/line after "STEAM_ID_1" connects. So the message should only be printed once.
Decompiler 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 03:51.


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