Raised This Month: $ Target: $400
 0% 

Using trie


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 11-13-2011 , 11:28   Using trie
Reply With Quote #1

i am trying to use a Trie for my first time and this what i did :
PHP Code:
#include <amxmodx>

#define MAX_BANNED_PLAYERS 32
new Trie:blocked_id

public plugin_init()
{
    
blocked_id TrieCreate()
    new 
filebanned_player[MAX_BANNED_PLAYERS], key[128]
    
file fopen("addons/amxmodx/configs/banned.ini""rt")
    while (!
feof(file))
    {
        
fgets(filebanned_playercharsmax(banned_player))
        
TrieSetString(blocked_idkeybanned_player)
    }
    
fclose(file)
    if(
TrieKeyExists(blocked_id"123"))
    {
        
fputs(file"this line exists")
    }

but its not working ( BTW blocked_id isn't really player id's it was the idea but didn't work.)
Dr7sTyLe is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-13-2011 , 12:08   Re: Using trie
Reply With Quote #2

Do you understand what Trie ? You set the key with an empty variable and as associated value banned_player. Do you think it's going to work with an empty key ?
__________________
Arkshine is offline
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 11-13-2011 , 12:45   Re: Using trie
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
Do you understand what Trie ? You set the key with an empty variable and as associated value banned_player. Do you think it's going to work with an empty key ?
So would you please show an example ?
Dr7sTyLe is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-13-2011 , 13:03   Re: Using trie
Reply With Quote #4

You have to first explain what you want to do exactly.
__________________
Arkshine is offline
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 11-13-2011 , 13:05   Re: Using trie
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
You have to first explain what you want to do exactly.
lets say there is a file and it has the line "Hello My Name Is Arkshine" so i want the plugin to store it in a trie and then check if the message for example contains "Arkshine".
Dr7sTyLe is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-13-2011 , 13:12   Re: Using trie
Reply With Quote #6

Array would be more appropriate, so you can traverse the Array, getthing the string and checking. Using Trie, you have to associate a key to a value. That's not what you need.
__________________
Arkshine 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 08:35.


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