AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Using trie (https://forums.alliedmods.net/showthread.php?t=171991)

Dr7sTyLe 11-13-2011 11:28

Using trie
 
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.)

Arkshine 11-13-2011 12:08

Re: Using trie
 
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 ?

Dr7sTyLe 11-13-2011 12:45

Re: Using trie
 
Quote:

Originally Posted by Arkshine (Post 1596027)
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 ?

Arkshine 11-13-2011 13:03

Re: Using trie
 
You have to first explain what you want to do exactly.

Dr7sTyLe 11-13-2011 13:05

Re: Using trie
 
Quote:

Originally Posted by Arkshine (Post 1596054)
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".

Arkshine 11-13-2011 13:12

Re: Using trie
 
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.


All times are GMT -4. The time now is 08:35.

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