amxmodx
amxmodx copied to clipboard
is_map_valid() case-insensitive on Linux
#include <amxmodx>
public plugin_init()
{
register_concmd("testmap", "testmap")
}
public testmap(id)
{
new szMap[MAX_NAME_LENGTH]
read_argv(1, szMap, charsmax(szMap))
console_print(id, "* Map %s is %s", szMap, is_map_valid(szMap) ? "VALID" : "NOT VALID")
}
Results:
] testmap Jailbg_Play_ForFun2
* Map Jailbg_Play_ForFun2 is VALID
] testmap jailbg_play_forfun2
* Map jailbg_play_forfun2 is VALID
Even though the filename is Jailbg_Play_ForFun2.bsp
, the is_map_valid
function checks case-insensitively on both Windows and Linux.
This causes a serious problem on servers operated under Linux because players aren't able to download the map from the server, thus they aren't able to get in the server if someone decides to do "amx_map jailbg_play_forfun2".
Probably the solution would be to add a new parameter to is_map_valid
with a boolean like this native is_map_valid(name[], bool:insensitive = true)
.
Offtopic: I can't remember which was the issue with maps having mixed upper/lower case letters, maybe FastDL failing, I guess I workaround this this by making all maps lower-case to avoid any issues. amx_map
with some upper-case letter could cause some issues too.