Quote:
Originally Posted by extreem
Here is code, I think you will understand what I want.
|
Not really. Your code (when it works) will say that the map is aim_awp when it's actually awp_india.
However, I think you need to trim() the lines after you read them from the file. Also, I would recommend using the "newer" file function because they are more intuitive, IMO.
This is a quick version that basically does the same that you are trying to do in yours:
PHP Code:
#include <amxmodx>
public plugin_init()
{
register_clcmd("say /test", "testFunc")
}
public testFunc()
{
new mapsfile[128]
get_localinfo("amxx_configsdir", mapsfile, charsmax(mapsfile))
add(mapsfile, charsmax(mapsfile), "/allmaps.ini")
new f = fopen(mapsfile, "r")
new data[32]
new szMap[32]; get_mapname(szMap, charsmax(szMap));
if(f)
{
while( !feof(f) )
{
fgets(f, data, charsmax(data))
trim(data)
if( equal(szMap, data) )
{
client_print(0, print_chat, "This map is in the list.")
}
else
{
client_print(0, print_chat, "This map is NOT in the list.")
}
}
fclose(f)
}
}
If you explain extactly what you are trying to do (the ultimate goal of your project) we can either tell you how to do it eith a different method or elaborate on this method.
__________________