Hi, I've been testing file system with checking
peoples steam ids. I got a function so I don't
have to include all the messy code in the main code.
The problem is that with this script the function
is only reading the first line in the "people.ini" file.
The first line is a BOT steamid, the second line
is holding my steamid. The rest is just miscellaneous steamid's.
I've tried without the function by having it in the
main script but I receive same results there.
As you can see I'm using old file system but
I've tried with each of the systems.
Smart old system, old system, new system.
Well, everything gets f****d.
Here's the script :
Code:
#include <amxmodx>
#include <amxmisc>
#pragma semicolon 1
#define DEBUG_MODE
enum
{
PARSED,
ACTIVE
};
new filename
[256];
new amx_vips;
public plugin_init
()
{
register_plugin("Testing",
"1.0",
"[A]tomen");
register_concmd("amx_hi",
"hi_func",
-1,
"Say hi to the people");
get_configsdir(filename,
255);
format(filename,
255,
"%s/people.ini", filename
);
amx_vips =
register_cvar("amx_vip",
"1");
}
public hi_func
(id
)
{
if(check_steamid(id) == 1) //Notice that I check if it returns the value '1'
server_cmd("say Hello there");
return 1;
}
public check_steamid(id) //Function to check the ids authority's.
{
if(get_pcvar_num(amx_vips
))
{
if(file_exists(filename
))
{
new readdata
[128], txtlen;
new steamid
[2][33];
new fsize =
file_size(filename,
1);
for(new line =
0; line <= fsize; line++
)
{
read_file(filename, line, readdata,
127, txtlen
);
parse(readdata, steamid
[PARSED
],
32);
get_user_authid(id, steamid
[ACTIVE
],
32);
#if defined DEBUG_MODE
log_amx("!!!!!! PARSED : %s !!!!!! STEAMID : %s !!!!!! END", steamid
[PARSED
], steamid
[ACTIVE
]);
#endif
if(!equal(steamid[ACTIVE], steamid[PARSED])) //Only the first line in the file is checked.
{
#if defined DEBUG_MODE
client_print(id, print_chat,
"[AMXX] SteamID's wasn't Equal ! SteamID : [%s] | Parsed : [%s]", steamid
[ACTIVE
], steamid
[PARSED
]);
log_amx("[AMXX] SteamID's wasn't Equal ! SteamID : [%s] | Parsed : [%s]", steamid
[ACTIVE
], steamid
[PARSED
]);
#endif
return -1; //Notice the return results
}
else
{
#if defined DEBUG_MODE
client_print(id, print_chat,
"[AMXX] SteamID's was Equal ! SteamID : [%s] | Parsed : [%s]", steamid
[ACTIVE
], steamid
[PARSED
]);
log_amx("[AMXX] SteamID's was Equal ! SteamID : [%s] | Parsed : [%s]", steamid
[ACTIVE
], steamid
[PARSED
]);
#endif
return 1; //Notice the return results
}
}
}
else if(!
file_exists(filename
))
{
#if defined DEBUG_MODE
log_amx("File [%s] is not Created !", filename
);
#endif
server_print("File [%s] is not Created !", filename
);
client_print(id, print_chat,
"File [%s] is not Created !", filename
);
}
}
return 0; //Notice the return results
}
__________________