Raised This Month: $ Target: $400
 0% 

Read data from file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-23-2010 , 13:02   Re: Read data from file
Reply With Quote #1

What parameters would you change in the fgets, to change which line is read. Also, when I tried using feof, it says "undefined symbol: feof".

I'm trying to make a plugin where on round start, if someone's steamid is in the steamids.ini file, they will get kicked. I know, basically a ban, just trying to learn basics.

here's code

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "AutoSteamID Kicker"
#define VERSION "1.0"
#define AUTHOR "H3avY Ra1n"

public plugin_init() {
    //Register Plugin
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_logevent("round_start", 2, "1=Round_Start")
}

public round_start()
{
    if(file_exists("addons/amxmodx/configs/steamids.ini"))
    {
    new fp = fopen("addons/amxmodx/configs/steamids.ini", "a"), buffer[100]

    
   
    fgets(fp, buffer, charsmax(buffer))  

    new players[32], player, num
    get_players(players, num)
    
    for(new i;i<num;i++)
    {
        player=players[i]
    new userid=get_user_userid(player)
    new authid[32]
    get_user_authid(player, authid, 19)
    
    if(equali(buffer, authid))
    {
        server_cmd("kick #%s", userid)
    
    // Close file handle
        fclose(fp)
}  
}
}
}

Last edited by nikhilgupta345; 07-23-2010 at 13:17.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
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:17.


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