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_File, 254)
format(g_File, 254, "%s/ppl.txt", g_File)
}
public asd_test(id)
{
new FileTextOpener, NewUserName[32], OldUserName[32], ReadData[128]
FileTextOpener = fopen(g_File, "r")
if(FileTextOpener)
{
while(fgets(FileTextOpener,ReadData,127))
{
parse(ReadData, OldUserName, 31)
get_user_name(id, NewUserName, 31)
if(equal(NewUserName, OldUserName))
{
client_print(id, print_chat, "YUPIIII ! %s", NewUserName)
break;
}
else
{
client_print(id, print_chat, "FAIL ! %s", NewUserName)
break;
}
}
fclose(FileTextOpener)
}
return PLUGIN_HANDLED
}