Quote:
Originally Posted by Flick3rR
I think that this serip is the problem, because you get the IP of everyone (with index 0) and I think this can't be don..
|
Quote:
Originally Posted by aron9forever
getting index 0's ip gets the server's ip
can't understand code or whether op wants that or not but it should help
to get all ips use a loop
|
Let me give you a new one:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "Beta Server System"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "ryo89589"
new plugin_enabled, pip[65][22]
public plugin_init()
{
register_plugin(PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_AUTHOR)
plugin_enabled = register_cvar("amx_betasys", "0")
register_concmd("amx_addpass", "addpass", ADMIN_RCON, "<playername|auth> - add specified player as a pass user")
register_concmd("amx_delpass", "delpass", ADMIN_RCON, "<playername|auth> - delete specified player as a pass user")
}
public client_authorized(id)
return get_pcvar_num(plugin_enabled) ? checkUser(id) : PLUGIN_CONTINUE
public delayed_kick(user[])
server_cmd("kick #%d", user[0])
public checkUser(id)
{
new serip[22], userip[22]
get_user_ip(0, serip, charsmax(serip), 1)
get_user_ip(id, userip, charsmax(userip), 1)
if( equal(userip, serip, 21) || equal(userip, pip[0], 21) )
return PLUGIN_HANDLED
new userid[3]
userid[0] = get_user_userid(id)
set_task(0.1, "delayed_kick", 0, userid, 1)
return PLUGIN_CONTINUE
}
public addpass(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new name[33], ip[22], arg[33]
read_argv(1, arg, 32)
get_user_name(id, name, charsmax(name))
get_user_ip(id, ip, charsmax(ip))
if( !equal(arg, pip[0], 21) )
copy(pip[0], charsmax(arg), arg)
return PLUGIN_HANDLED
}
public delpass(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new name[33], ip[22], arg[22]
read_argv(1, arg, charsmax(arg))
get_user_name(id, name, charsmax(name))
get_user_ip(id, ip, charsmax(ip))
if( equal(arg, pip[0], 21) )
copy(pip[0], 0, "")
return PLUGIN_HANDLED
}
This adds "equal(userip, serip, 21)" only.
The problem still exists.
When I use amx_addpass added the player as a pass user, this is no problem.
Players can enter the server.
When I add multiple ip in the database, the problems will arise.
Only the latest IP can pass.
Also, when I delete an ip , all pass user's IP will be affect.
So, I think "addpass" & "delpass" There are some problems.
Please help me to check. Thank you!!