PDA

View Full Version : Bind when admin connect ?!


4JOKE
04-13-2008, 10:31
I try to make plugin which will BIND key F1, only when admin connects.
And when admin leaves server, it will unbind F1.
But these don't function. My plugin binds key F1 for everybody...

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
register_plugin("Admin Binder", AMXX_VERSION_STR, "by MisoX");
}

public client_connect (id) {

if( is_user_admin(id) )
return PLUGIN_CONTINUE;

client_cmd(id, "bind ^"F1^" ^"amxmodmenu^"")

return PLUGIN_HANDLED;
}

public client_disconnect (id) {

if( is_user_admin(id) )
return PLUGIN_CONTINUE;

client_cmd(id, "bind ^"F1^" ^"^"")

return PLUGIN_HANDLED;
}

What I am doing wrong?

atomen
04-13-2008, 15:27
#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
register_plugin("Admin Binder", AMXX_VERSION_STR, "by MisoX");
}

public client_authorized (id)
{
if( is_user_admin(id) )
client_cmd(0, "bind F1 amxmodmenu")
}

public client_disconnect (id)
{
if( is_user_admin(id) )
client_cmd(0, "bind F1 ^"^"")
}Though i don't know if the key will be un-binded on disconnect.
Since it seems to be called when the user already have disconnected.

It is most used to remove tasks. But you can try.

4JOKE
04-18-2008, 15:54
I tryed your code, but it still dont function. It doesnt bind keys to nobody. If I am admin or not, It does nothing... :(

|PJ| Shorty
04-19-2008, 15:59
change:
public client_connect (id)
to
public client_authorized (id)

atomen is right, unbinding the key is not possible in client_disconnect.
i think there is no way to do that.

DarkEnergy
04-19-2008, 17:06
you can't execute on players after they have disconnected

Howdy!
04-19-2008, 17:20
you can't execute on players after they have disconnected
Did you even read all post(s)? That have been already mentioned twice in this thread.

ConnorMcLeod
04-19-2008, 17:30
#include <amxmodx>

public plugin_init()
{
register_plugin("Admin Binder", AMXX_VERSION_STR, "by MisoX")
}

public client_authorized(id)
{
new iFlags = get_user_flags(id)
if( iFlags && !(iFlags & ADMIN_USER) )
{
client_cmd(id, "bind F1 amxmodmenu")
}
}

Also, make sure to declare this plugin after default plugins in plugins.ini

4JOKE
04-25-2008, 14:55
thnx to all, now it's ok