AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sharing Trie handle (https://forums.alliedmods.net/showthread.php?t=174519)

Backstabnoob 12-21-2011 13:48

Sharing Trie handle
 
Is it possible to share Trie handle between two plugins via natives and then retrieve data from it?

Sorry for not trying it out myself, I'm quite out of the server access now so I can't test it :(


I mean:

Code:
new Trie: TrieHandler public plugin_natives( )    register_native( "ShareTrie", "_ShareTrie" ) public _ShareTrie( Plugin, Params )    return _: TrieHandler

In another plugin:

Code:
new Trie: SharedHandle = ShareTrie( ) ... TrieGetString( SharedHandle, ... )

I think the example is not necessary, just to be sure everyone understands what I mean.

Thanks in advance

fysiks 12-21-2011 15:53

Re: Sharing Trie handle
 
PHP Code:

#include <amxmodx>

public pTrie

public plugin_init()
{
    
pTrie _:TrieCreate()
    
TrieSetString(Trie:pTrie"hello""goodbye")


PHP Code:

#include <amxmodx>

public plugin_init()
{
    new 
pTrie get_xvar_num(get_xvar_id("pTrie"))
    
    new 
string[32]
    
TrieGetString(Trie:pTrie"hello"stringcharsmax(string))
    
    
server_print("Result: %s"string)


Result:

Code:

Result: goodbye
Quote:

Originally Posted by Backstabnoob (Post 1617232)
Sorry for not trying it out myself, I'm quite out of the server access now so I can't test it :(

News Flash: Half-Life Servers are FREE.


All times are GMT -4. The time now is 11:47.

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