Raised This Month: $51 Target: $400
 12% 

Setting a key more than 1 value (Tries)?


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-08-2012 , 12:59   Re: Setting a key more than 1 value (Tries)?
Reply With Quote #11

The better question is this:
Are you only checking if a player's name exists in the constant global, or is the information going to be added dynamically via functions or something?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-08-2012 , 13:08   Re: Setting a key more than 1 value (Tries)?
Reply With Quote #12

Second option exo! Bcoz i will try to set a custom model and custom weapon!
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.

Last edited by lucas_7_94; 02-08-2012 at 13:09.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-08-2012 , 13:51   Re: Setting a key more than 1 value (Tries)?
Reply With Quote #13

If you are using 1.8.2-dev version, then here is the TrieSet/GetArray method:

Code:
#include <amxmodx> enum _:Type {     Name[ 64 ],     Class[ 64 ],     Access[ 64 ] } new const szAdminInfo[ ][ Type ] = {     { "Luqqas", "Developer", "Full" }     // more more more } new Trie:AdminInfo public plugin_init( ) {     AdminInfo = TrieCreate( )         for( new i = 0; i < sizeof( szAdminInfo ); i++ )     {         TrieSetArray( AdminInfo, szAdminInfo[ i ][ Name ], szAdminInfo[ i ] );     } } public check_name(id) {     new name[32];     get_user_name(id, name, charsmax(name));         new info[Type];     if( TrieGetArray(AdminInfo, name, info, Type) ) {         // lets modify something         copy(info[Class], charsmax(info[Class]), "edited");                 TrieSetArray(AdminInfo, name, info, Type);     } }

If that produces weird results, or you need one without TrieGet/SetArray, I can post another solution.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-08-2012 , 14:02   Re: Setting a key more than 1 value (Tries)?
Reply With Quote #14

I'm using 1.8.1 , exists another method , or i should update my amx ?

Another question , when is better use Tries ? , because i'm sure i will use a menu with this , and i think its the better method , anyway , i'm trying to understand the tries , always like the method but never understand them ._., thanks you very much for the help , its really usefull.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-08-2012 , 14:06   Re: Setting a key more than 1 value (Tries)?
Reply With Quote #15

Here is 1.8.1 friendly version:

Code:
#include <amxmodx> enum _:Type {     Name[ 64 ],     Class[ 64 ],     Access[ 64 ] } new const szAdminInfo[ ][ Type ] = {     { "Luqqas", "Developer", "Full" }     // more more more } new Array:gAdminInfo new Trie:gAdminIndex new gNumAdminInfos public plugin_init( ) {     gAdminInfo = ArrayCreate( Type );     gAdminIndex = TrieCreate( )         for( new i = 0; i < sizeof( szAdminInfo ); i++ )     {         AddAdminInfo( szAdminInfo[ i ] );     } } public check_name(id) {     new name[32];     get_user_name(id, name, charsmax(name));         new index;     if( TrieGetCell(gAdminIndex, name, index) ) {         new info[Type];         ArrayGetArray(gAdminInfo, index, info);                 // lets modify something         copy(info[Class], charsmax(info[Class]), "edited");                 ArraySetArray(AdminInfo, index, info);     } } AddAdminInfo(info[Type]) {     ArrayPushArray(gAdminInfo, info);     TrieSetCell(gAdminIndex, info[Name], gNumAdminInfos);     gNumAdminInfos++; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 02-08-2012 at 14:06.
Exolent[jNr] is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-08-2012 , 14:56   Re: Setting a key more than 1 value (Tries)?
Reply With Quote #16

Amazing helpful thread .

Thanks you very much for all!
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
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 00:19.


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