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

Read, write, compare cfg file


Post New Thread Reply   
 
Thread Tools Display Modes
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-22-2010 , 20:09   Re: Read, write, compare cfg file
Reply With Quote #21

no, that will be the only plugin. But when i add an id and then check if the player is in the list. Should it reload the file to find his it or not?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-22-2010 , 20:13   Re: Read, write, compare cfg file
Reply With Quote #22

Quote:
Originally Posted by drekes View Post
no, that will be the only plugin. But when i add an id and then check if the player is in the list. Should it reload the file to find his it or not?
No, you can visualize a trie as a memory list. When the plugin loads it reads all items from the file into the trie. As you add items in-game, they are added to both the file and trie.

So the trie always has all items in it.
__________________

Last edited by Bugsy; 03-22-2010 at 20:16.
Bugsy is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-22-2010 , 20:14   Re: Read, write, compare cfg file
Reply With Quote #23

ok, thanks bugsy.
i added you in the credits just like fysiks and wrecked_, is that alright for you?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-22-2010 , 20:16   Re: Read, write, compare cfg file
Reply With Quote #24

Quote:
Originally Posted by drekes View Post
ok, thanks bugsy.
i added you in the credits just like fysiks and wrecked_, is that alright for you?
Ya thats fine
__________________
Bugsy is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-23-2010 , 03:31   Re: Read, write, compare cfg file
Reply With Quote #25

i tryed it, but if i add me, the map needs to change map first to have effect.

Is it possible to make it have effect immediatly? like amx_ban?

EDIT: nevermind, i found out how i can do it.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 03-23-2010 at 03:50. Reason: Fixed it
drekes is offline
Send a message via MSN to drekes
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-23-2010 , 04:11   Re: Read, write, compare cfg file
Reply With Quote #26

if i want to delete a id from the list, can i replace it with an empty line, because i can't really understand this. https://forums.alliedmods.net/showth...ght=write_file
i find it hard to understand
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-23-2010 , 08:46   Re: Read, write, compare cfg file
Reply With Quote #27

PHP Code:
public RemoveIDid level cid )
{
    if ( !
cmd_accessid level cid ) )
        return 
PLUGIN_HANDLED;
        
    new 
szArg35 ];
    
    if ( !
read_argvszArg charsmaxszArg ) ) )
        return 
PLUGIN_HANDLED;
        
    new 
iPlayer cmd_targetid szArg CMDTARGET_ALLOW_SELF CMDTARGET_NO_BOTS )
         
    if ( !
iPlayer )
        return 
PLUGIN_HANDLED;
            
    
get_user_authidiPlayer szArg charsmaxszArg ) );
    
    if ( !
TrieKeyExistsg_tSteamIDs szArg ) )
    {
        
console_printid "* SteamID ^"%s^" is not on the list." szArg );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iFileHandle iFilePos szLineItem35 ];
    
    
iFileHandle fopeng_szFile "rt" );

    while( !
feofiFileHandle ) )
    {
        
fgetsiFileHandle szLineItem charsmaxszLineItem ) );
        
        
trimszLineItem );
        
        
iFilePos++;

        if( 
szArg] == ';' )
            continue;
        
        if( 
equalszLineItem szArg ) )
        {
            
formatszLineItem charsmaxszLineItem ) , ";%s" szLineItem );
            
write_fileg_szFile szLineItem iFilePos );
            
TrieDeleteKeyg_tSteamIDs szArg );
            
console_printid "* SteamID ^"%s^" was removed from list." szArg );
            break;
        }
    }
        
    
fclose(iFileHandle);
    
    return 
PLUGIN_HANDLED;

__________________
Bugsy is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-23-2010 , 08:47   Re: Read, write, compare cfg file
Reply With Quote #28

tnx bugsy, but how does it work?
Does it delete the single id or does it something else?(delete in another way)
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-23-2010 , 08:49   Re: Read, write, compare cfg file
Reply With Quote #29

Quote:
Originally Posted by drekes View Post
tnx bugsy, but how does it work?
Does it delete the single id or does it something else?(delete in another way)
The id will remain in the file but the item is prefixed with a semi-colon. When the plugin loads items from file, it ignores those prefixed with a semi-colon.

Suppose we remove STEAMID3:

STEAMID1
STEAMID2
;STEAMID3
STEAMID4
__________________
Bugsy is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-23-2010 , 08:57   Re: Read, write, compare cfg file
Reply With Quote #30

nice, i didnt know a plugin could do that
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Old 03-23-2010, 11:39
drekes
This message has been deleted by drekes. Reason: remove the code
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 01:30.


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