Raised This Month: $ Target: $400
 0% 

Read a line from a file and check


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 11-18-2011 , 14:24   Read a line from a file and check
Reply With Quote #1

Hey guys,

My friend is trying to get a line from a file (you can see how the line should look like in the file from the formatex function he used), I helped him design it a bit cuz it didnt work for him and thats what came out:

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

#define PLUGIN "Prisoner Count"
#define VERSION "1.0"
#define AUTHOR "CreePs"

new PrisonerID[33];
new 
HighestPrisoner;
new 
filename[256]

public 
plugin_init()
{
    
get_configsdirfilename255 )
    
format(filename255"%s/prisoner.ini"filename);
    
register_clcmd("say /test""cmdTest")
}

public 
cmdTest(id)
{
    
client_print(idprint_chat"TESTDSDGFTDGF")
}
    
public 
client_putinserver(id)
{
    
Load(id);
}

Load(id)
{
    new 
data[128];
    new 
Name[64];
    new 
Authid[64];
    new 
ID[64];
    new 
Checkid[64];
    new 
Highest[256];

    
get_user_name(idName63);
    
get_user_authid(idCheckid63);
    
    new 
szReadData[200]
    new 
file fopen(filename"r")

    while( 
fgets(filedatasizeof(data) - 1) )
    {
        
parse(dataNamecharsmax(Name), Authidcharsmax(Authid), IDcharsmax(ID), Highestcharsmax(Highest) );

        if( 
equal(CheckidAuthid) )
        {
            
PrisonerID[id] = str_to_num(ID);    
            
set_user_infoid"name"Name )
            
fclose(file)
            
            return 
PLUGIN_CONTINUE
        
}
        
        
HighestPrisoner str_to_num(Highest);
    }
    
    
PrisonerID[id] = str_to_num(Highest) + 1;
                
    
get_user_authid(idAuthid63);
    
formatex(szReadDatacharsmax(szReadData) - 1"^"%s^" %s  %i %i"NameAuthidPrisonerID[id], PrisonerID[id] > HighestPrisoner PrisonerID[id] : HighestPrisoner);    
    
fputs(fileszReadData)
    
fclose(file)
            
    return 
PLUGIN_CONTINUE

Now he says it doesn't work and writes nothing, in my opinion it should work. Does someone detect something wrong?
__________________
My Projects:

Auto-Mix (Pug): 100%

Joined the Military (a soldier now) - Inactive
Diegorkable is offline
 



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 08:34.


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