Raised This Month: $ Target: $400
 0% 

Reading steam id from a file...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dekken
Veteran Member
Join Date: Jul 2007
Old 03-19-2008 , 10:53   Reading steam id from a file...
Reply With Quote #1

well first of all, i did search, and it didnt help much =\
iam asking you guys, how could i read SteamID's from a file, and then Execute w/e i want on them?

for now iam using this:

PHP Code:
get_user_authid(idSteamID31)
    if ( 
equal(SteamID"STEAM_0:0:12345") || equal(SteamID"STEAM_0:0:12345") || equal(SteamID"STEAM_0:0:12345") ) 
and its KINDA GAY...
could someone make an example please?
or link me to a decent post?
Thanks.
__________________
Signature Goes Here
dekken is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 03-19-2008 , 12:22   Re: Reading steam id from a file...
Reply With Quote #2

I made this really quick, don't even know if compiles.
But the plugin reads all the SteamID's in the file "MySteamID.ini" in the configs dir. (amxmodx/configs/MySteamID.ini). It should be simple enough to see how I did it.
Code:
#include <amxmodx> #include <amxmisc> new g_SteamID[256] public plugin_init() {     register_plugin(“Name”,”Drak”,”0.1a”);     new configFile[128]     get_configdir(configFile,127);     format(configFile,127,"%s/MySteamID.ini",configFile);             new pFile = fopen(configFile,”r”);     if(pFile)     {         while(fgets(pFile,g_SteamID,255))         {         }     }     fclose(pFile); } public myFunc(id) {     new AuthID[36];     get_user_authid(id,AuthID,35);     if(contain(g_SteamID,AuthID) != -1)     {         // There SteamID was in the file.     } }
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
dekken
Veteran Member
Join Date: Jul 2007
Old 03-19-2008 , 12:57   Re: Reading steam id from a file...
Reply With Quote #3

Hmmm Thanks!
i tried messing around with this O_o
you can call me gay but could you show example like
how do i execute set_user_gravity(id, 0.25) or anything else...client_cmd...anything
on The client that matches the ini file?

=\

Ty.
__________________
Signature Goes Here
dekken is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-19-2008 , 13:12   Re: Reading steam id from a file...
Reply With Quote #4

Code:
myfunc()
{
    new id = find_player("ch", g_SteamID);
    if(id)
    {
        set_user_gravity(id, 0.25);
        client_cmd(id, "say Found me!");
    }
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
dekken
Veteran Member
Join Date: Jul 2007
Old 03-19-2008 , 13:50   Re: Reading steam id from a file...
Reply With Quote #5

and where exactly do i put this?
iam so confused...i tried few ways and it didnt work for me
__________________
Signature Goes Here
dekken is offline
Jheshka
Senior Member
Join Date: Dec 2005
Old 03-19-2008 , 13:53   Re: Reading steam id from a file...
Reply With Quote #6

Code:
#include <amxmodx> #include <amxmisc> new g_SteamID[256] public plugin_init() {     register_plugin(&#8220;Name”,”Drak”,”0.1a”);     new configFile[128]     get_configdir(configFile,127);     format(configFile,127,"%s/MySteamID.ini",configFile);             new pFile = fopen(configFile,&#8221;r”);     if(pFile)     {         while(fgets(pFile,g_SteamID,255))         {         }     }     fclose(pFile); } public myFunc(id)     //Put here replace text {     new AuthID[36];     get_user_authid(id,AuthID,35);     if(contain(g_SteamID,AuthID) != -1)     {         // There SteamID was in the file.     } }
__________________
James
Jheshka is offline
dekken
Veteran Member
Join Date: Jul 2007
Old 03-19-2008 , 14:07   Re: Reading steam id from a file...
Reply With Quote #7

i tried this....and it didnt work :X
__________________
Signature Goes Here
dekken is offline
dekken
Veteran Member
Join Date: Jul 2007
Old 03-20-2008 , 09:52   Re: Reading steam id from a file...
Reply With Quote #8

well i tried everything i could tho of..
and the search brings alot more questions then answers...
could anyone just make a simple full example of the code?
=\ thank you.
__________________
Signature Goes Here
dekken is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-20-2008 , 14:36   Re: Reading steam id from a file...
Reply With Quote #9

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define MAX_STEAMIDS    30

new g_Count;
new 
g_SteamIDs[MAX_STEAMIDS][35];
new 
bool:g_InFile[33];

public 
plugin_precache()
{
    new 
filename[200];
    
get_configsdir(filenamesizeof(filename) - 1);
    
add(filenamesizeof(filename) - 1"/steamid-test.ini");
    if(
file_exists(filename))
    {
        new 
file fopen(filename"rt");
        if(
file)
        {
            new 
data[128];
            new 
rest[sizeof(data) - sizeof(g_Steamids[])];
            while(!
feof(file) && (g_Count MAX_STEAMIDS))
            {
                
fgets(filedatasizeof(data) - 1);
                if(
data[0] != ';')
                    
parse(datag_SteamIDs[g_Count++], sizeof(g_SteamIDs[]) - 1restsizeof(rest) - 1);
            }
            
fclose(file);
        }
    }
}

public 
plugin_init()
{
    
register_plugin("SteamID From File Test""0.1""Exolent");
    
register_clcmd("steamid""clcmd_Steamid");
}

public 
client_authorized(id)
{
    if(
g_Count <= 0)
        return;
    
    
g_InFile[id] = false;
    
    new 
authid[sizeof(g_SteamIDs[])];
    
get_user_authid(idauthidsizeof(authid));
    for(new 
0g_Counti++)
    {
        if(
equali(authidg_SteamIDs[i]))
        {
            
g_InFile[id] = true;
            break;
        }
    }
}

public 
client_disconnect(id)
{
    if(
g_InFile[id])
        
g_InFile[id] = false;
}

public 
clcmd_Steamid(id)
{
    
console_print(id"-------------------------");
    
console_print(id"Listing Players in File:");
    
    new 
players[32], pnum;
    
get_players(playerspnum);
    
    new 
playername[32];
    for(new 
0pnumi++)
    {
        
player players[i];
        if(
g_InFile[player])
        {
            
get_user_name(playernamesizeof(name) - 1);
            
console_print(id"%s"name);
        }
    }
    
console_print(id"-------------------------");
    return 
PLUGIN_hANDLED;

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 03-20-2008, 16:04
dekken
This message has been deleted by dekken. Reason: Lol Nvm, sec
dekken
Veteran Member
Join Date: Jul 2007
Old 03-20-2008 , 16:44   Re: Reading steam id from a file...
Reply With Quote #10

well i probably have to be The master of Retards but and probably scripting is not for me....
but how would i give lets say...hmm weapon? Gravity? Something to a Player on new Round?
Only To Him..
or Display A Message only to Him...without Typing any command...On new Round

i already gave you Karma..so you HAVE to reply
Nah iam JustKidding
hope someone will help out -_-

i tried lets say make a Global message when the player on list Joins, and it showed to everyone that Joined.
give Weapon, didnt work well...so does gravity, speed, and such.
__________________
Signature Goes Here
dekken is offline
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 20:32.


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