Whenever I try using this code I wrote to read from a file and then randomly pick a line (map) from that file, it doesn't work. I tested it and whenever I use the command it always displays "[AMXX] Denied Command Access: 'amx_map_random'!"
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "amx_map random"
#define VERSION "1.0"
#define AUTHOR "BOYSplayCS"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_map_random", "eventChangeMap", ADMIN_SLAY, "- Randomly change map");
}
public eventChangeMap(id, level, cid)
{
if (cmd_access(id, level, cid, 2))
{
new mapCycle[64];
copy(mapCycle, 63, "mapcycle.txt");
if (file_exists(mapCycle))
{
new file = fopen(mapCycle, "rt");
new mapData[64];
while (!feof(file))
{
fgets(file, mapData, 63);
server_cmd("changelevel %s", mapData);
}
}
}
client_print(id, print_chat, "[AMXX] Denied Command Access: 'amx_map_random'!");
return PLUGIN_HANDLED;
}