Quote:
Originally Posted by Bugsy
I am having no issue. Though, I am working on very little.. you have not said what exactly you are trying to do or what the source file contents look like. If you need help, provide the problem at hand, not your troubleshooting.
PHP Code:
public a()
{
new iFile = fopen( "abc123.txt", "rt" );
new i = 0
if(iFile)
{
new szData[120], szData1[120]
while(fgets(iFile, szData, charsmax(szData)))
{
i++
switch(szData[0])
{
case EOS, ';', '/': continue
default:
{
new iz = parse(szData, szData1, charsmax(szData1))
server_print("[%s]" , szData1)
}
}
}
fclose(iFile)
}
}
Source file
Code:
Test line1
Test line2
Test line3
Test line4
Test line5
Test line6
Test line7
Test line8
T1119
T1110
T1111
T1112
Output
PHP Code:
[Test]
[Test]
[Test]
[Test]
[Test]
[Test]
[Test]
[Test]
[T1119]
[T1110]
[T1111]
[T1112]
|
I'll be as clear as possible, because I don't think you understand.
Let's use the function below as a test to remove an admin for example, after finding the line with steamid I remove it ok?
PHP Code:
public RemoveAdminHandler(id)
{
get_user_authid(g_AdminTarget[id], playerinfo, charsmax(playerinfo));
new szConfig[MAX_FMT_LENGTH]
get_configsdir(szConfig, charsmax(szConfig))
add(szConfig, charsmax(szConfig), "/users.ini")
new iFile = fopen(szConfig, "rt")
i = 0
if(iFile)
{
new szData[120], szData1[120]
while(fgets(iFile, szData, charsmax(szData)))
{
i++
switch(szData[0])
{
case EOS, ';', '/'. '[': continue
default:
{
parse(szData, szData1, charsmax(szData1))
if(equal(szData1, playerinfo))
{
write_file(szConfig, "^r", i-1)
server_cmd("amx_reloadadmins")
break
}
}
}
}
fclose(iFile)
}
return PLUGIN_HANDLED
}
In the attachment I put user.ini (which is the test before deletion) and users - after.ini (which is after removing the line), notice that in the 1st line of the "after" file there is an "invisible" space.