Raised This Month: $ Target: $400
 0% 

Reading from a file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 03-28-2011 , 11:37   Reading from a file
Reply With Quote #1

I'm trying to read from a text file "ppl.txt", it's working only for the first line (Player1). If I try with Player2 or with KillerGirl it fails.

I think the the script is reading only the first line. How can I make to read the rest of lines?

ppl.txt:
Code:
Player1
Player2
KillerGirl
PHP Code:
#include <amxmodx>
#include <amxmisc>

new g_File[255]

public 
plugin_init()
{
    
register_plugin("TEST","1.0","KG")
    
    
register_concmd("say dsa","asd_test")
    
    
get_configsdir(g_File254)
    
format(g_File254"%s/ppl.txt"g_File)    
}

public 
asd_test(id)
{    
    new 
FileTextOpenerNewUserName[32], OldUserName[32], ReadData[128]
    
    
FileTextOpener fopen(g_File"r")
    
    if(
FileTextOpener)
    {
        while(
fgets(FileTextOpener,ReadData,127))
        {
            
parse(ReadDataOldUserName31)
            
            
get_user_name(idNewUserName31)
            
            if(
equal(NewUserNameOldUserName))
            {
                
client_print(idprint_chat"YUPIIII ! %s"NewUserName)
                break;
            }
            else
            {
                
client_print(idprint_chat"FAIL ! %s"NewUserName)
                break;
            }
        }
        
fclose(FileTextOpener)
    }
    
    return 
PLUGIN_HANDLED

killergirl is offline
 


Thread Tools
Display Modes

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 14:29.


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