Player Number Redirect
Hello,
I want to do a little modification to this plugin. I do not want to redirect all players want to redirect only 7 players.
PHP Code:
#include <amxmodx>
new g_max_players public plugin_init(){ register_plugin("Redirect All", "1.0", "Sylwester") register_clcmd("amx_redirect", "redirect_cmd", ADMIN_BAN, "") g_max_players = get_maxplayers() }
public wrong_arg(id){ client_print(id, print_console, "[Redirect All]Wrong arguments (must be ^"amx_redirect ip:port^")") return PLUGIN_HANDLED }
public redirect_cmd(id, level, cid){ new cmd[32], cmd_tmp[32], tmp[32], num read_args(cmd, 31) copy(cmd_tmp, 31, cmd) for(new i=0; i<3; i++){ strtok(cmd_tmp, tmp, 31, cmd_tmp, 31, '.') num = str_to_num(tmp) if(num < 0 || 255 < num || strlen(tmp) <= 0) return wrong_arg(id) } strtok(cmd_tmp, tmp, 31, cmd_tmp, 31, ':') num = str_to_num(tmp) if(num < 0 || 255 < num || strlen(tmp) <= 0) return wrong_arg(id) num = str_to_num(cmd_tmp) if(num < 1 || 65536 < num) return wrong_arg(id) for(new i=1; i<=g_max_players; i++) if(is_user_connected(i) || is_user_connecting(i)) client_cmd(i, "Connect %s", cmd) return PLUGIN_HANDLED }
|