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

Read, write, compare cfg file


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

Hi,

i found out a new idea for a plugin, but it needs a cfg or ini file(what is best)
This is what is should do,

read a clients steamid and compare it to the ids in the cfg,

if ( equel(steamid, fileid))
// something

be able to get a clients id and write it in the cfg(only admin)
I searched and tryed, looked at amx_ban plugins but i can't figure out how it works, so i hope you guys can explain me.

Thanks in advance, Drekes

(FYI: Would Wrecked_ be the first to answer again?)
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-21-2010 , 18:37   Re: Read, write, compare cfg file
Reply With Quote #2

Tell us what you are trying to do before we answer. Be specific.
__________________
fysiks is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-21-2010 , 18:44   Re: Read, write, compare cfg file
Reply With Quote #3

1.
when a client is put in the server and before he chose a team, retrieve his steamid and compare it with the steamid's in the cfg file.

2.Make a admin command similar to amx_addip <player> that adds him steamid to the cfg file.

sorry for the unreadable first post, i thought it was simple to figure it out.

thanks for the fast reply
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-21-2010 , 19:09   Re: Read, write, compare cfg file
Reply With Quote #4

Here is the first part:

PHP Code:
#include <amxmodx>

new Trie:g_tSteamIDs

public plugin_ini()
{
    
g_tSteamIDs TrieCreate()

    new 
data[32]
    new 
fopen("path to file.ini""rt")

    while( !
feof(f) )
    {
        
fgets(fdatasizeof(data) - 1)

        
trim(data)
        if( !
data[0] || data[0] == ';' || data[0] == '/' && data[1] == '/' ) continue;
        
TrieSetCell(g_tSteamIDsdata1)
    }

    
fclose(f)
}

public 
client_putinserver(id)
{
    new 
AuthID[32]
    
get_user_authid(idAuthIDcharsmax(AuthID))

    if( 
TrieKeyExists(g_tSteamIDsAuthID) )
    {
        
// SteamID is in the list
    
}

__________________
fysiks is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-21-2010 , 19:12   Re: Read, write, compare cfg file
Reply With Quote #5

Quote:
Originally Posted by drekes View Post
1.
when a client is put in the server and before he chose a team, retrieve his steamid and compare it with the steamid's in the cfg file.

2.Make a admin command similar to amx_addip <player> that adds him steamid to the cfg file.

sorry for the unreadable first post, i thought it was simple to figure it out.

thanks for the fast reply
Some things:
Also, read up on concmd's and writing the steamid to a file shouldn't be difficult.

EDIT: Damn, fysiks.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-21-2010 , 19:19   Re: Read, write, compare cfg file
Reply With Quote #6

@ wrecked_
i understand it's not difficult for you, wrecked_.
But i searched for tutorials that explain the commands used like TrieSetCell and such. i just don't know what they actually do. And that is why i don't know how to do it.
Thanks


@fysics:
Do i change
PHP Code:
 new fopen("path to file.ini""rt"
to
PHP Code:
  new fopen("addons/amxmodx/configs""rt"
If i want the file to be in configs folder or do i do that another way?
Thanks for the part you posted.
__________________

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

Last edited by drekes; 03-21-2010 at 19:21. Reason: forgot to thank wrecked_
drekes is offline
Send a message via MSN to drekes
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-21-2010 , 19:26   Re: Read, write, compare cfg file
Reply With Quote #7

Quote:
Originally Posted by drekes View Post
@ wrecked_
i understand it's not difficult for you, wrecked_.
Oh, no I didn't mean it like that. I was trying to say that if you read up on concmd's then as a result you should be able to write to a file pretty easily.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-21-2010 , 19:28   Re: Read, write, compare cfg file
Reply With Quote #8

i don't understand what you mean by "read up on concmd's"
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-21-2010 , 19:37   Re: Read, write, compare cfg file
Reply With Quote #9

Quote:
Originally Posted by drekes View Post
i don't understand what you mean by "read up on concmd's"
Look at the beginning tutorials on the website (1 has a concmd, I think it's the amx_hp one), look at source code that involve concmd's, search the forums for others that were trying to use concmd's too, etc.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-21-2010 , 19:40   Re: Read, write, compare cfg file
Reply With Quote #10

ow, you mean learning how they work?

btw: can i add you guys in the credits in case this ever gets realised?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 04:24.


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