Raised This Month: $51 Target: $400
 12% 

[REQ] Only admins can connect


Post New Thread Reply   
 
Thread Tools Display Modes
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 03-07-2012 , 18:35   Re: [REQ] Only admins can connect
Reply With Quote #11

Try this...

PHP Code:
#include <amxmodx>
#include <amxmisc>

public client_connect(id) {
    if(!
is_user_admin(id))
        
server_cmd("kick #%d ^"Only admins can connect^""get_user_userid(id));

__________________

Last edited by kramesa; 03-07-2012 at 18:35.
kramesa is offline
Schpraaankiii
Veteran Member
Join Date: Dec 2009
Location: Sweden Norrköping
Old 03-07-2012 , 18:37   Re: [REQ] Only admins can connect
Reply With Quote #12

this should work, right?
... well it doesn't :/

Code:
#include <amxmodx> #include <amxmisc> public client_connect(id) {     new szName[32], szSteamID[32];     get_user_name(id, szName, charsmax(szName));     get_user_authid(id, szSteamID, charsmax(szSteamID));         if(get_user_flags(id) & ADMIN_LEVEL_D)     {         set_hudmessage(0, 255, 0, -1.0, -1.0)         show_hudmessage(id, "The admin %s has connected! (%s)", szName, szSteamID)         return PLUGIN_HANDLED;     }     else     {            set_hudmessage(0, 255, 0, -1.0, -1.0)         show_hudmessage(id, "The player %s dont have permission to connect! (%s)", szName, szSteamID)         server_cmd("kick #%d ^"Only admins can connect, You can aply for an admin job at www.badstyle.comze.com^"", get_user_userid(id));         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; }
__________________
CAOSK-ESPORTS.COM

Last edited by Schpraaankiii; 03-07-2012 at 18:38.
Schpraaankiii is offline
Send a message via Skype™ to Schpraaankiii
Schpraaankiii
Veteran Member
Join Date: Dec 2009
Location: Sweden Norrköping
Old 03-07-2012 , 18:44   Re: [REQ] Only admins can connect
Reply With Quote #13

Quote:
Originally Posted by kramesa View Post
Try this...

PHP Code:
#include <amxmodx>
#include <amxmisc>

public client_connect(id) {
    if(!
is_user_admin(id))
        
server_cmd("kick #%d ^"Only admins can connect^""get_user_userid(id));

This will make all admins allowed to connect, am I right?

EDIT: I tried it... doesn't work :/ or am I doing it wrong? xd
I want these hud text in the plugin instead of the chat text. should this work? (I mean, should the HUD text work if the plugin did)
Code:
#include <amxmodx> #include <amxmisc> public client_connect(id) {     new szName[32], szSteamID[32];     get_user_name(id, szName, charsmax(szName));     get_user_authid(id, szSteamID, charsmax(szSteamID));             if(!is_user_admin(id))     {         set_hudmessage(0, 255, 0, -1.0, -1.0)         show_hudmessage(id, "The player %s dont have permission to connect! (%s)", szName, szSteamID)         server_cmd("kick #%d ^"Only admins can connect, You can aply for an admin job at www.badstyle.comze.com^"", get_user_userid(id));         return PLUGIN_HANDLED;     }     else {         set_hudmessage(0, 255, 0, -1.0, -1.0)         show_hudmessage(id, "The admin %s has connected! (%s)", szName, szSteamID)         return PLUGIN_HANDLED;     }         return PLUGIN_CONTINUE; }

I also tried
Code:
if(!(get_user_flags(id) & ADMIN_LEVEL_D))
That doesn't work either :/
__________________
CAOSK-ESPORTS.COM

Last edited by Schpraaankiii; 03-07-2012 at 19:14.
Schpraaankiii is offline
Send a message via Skype™ to Schpraaankiii
Rirre
Veteran Member
Join Date: Nov 2006
Old 03-12-2012 , 17:51   Re: [REQ] Only admins can connect
Reply With Quote #14

Replace
Code:
client_connect
With
Code:
client_authorized
Rirre is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 03-12-2012 , 18:09   Re: [REQ] Only admins can connect
Reply With Quote #15

Quote:
Originally Posted by Rirre View Post
Replace
Code:
client_connect
With
Code:
client_authorized
http://www.amxmodx.org/funcwiki.php?go=func&id=10

According to this there is a chance you might not be authorized until after you are put in server...so I don't know if that is the best solution.

Correct me if I am wrong
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-12-2012 , 22:50   Re: [REQ] Only admins can connect
Reply With Quote #16

Quote:
Originally Posted by joshknifer View Post
http://www.amxmodx.org/funcwiki.php?go=func&id=10

According to this there is a chance you might not be authorized until after you are put in server...so I don't know if that is the best solution.

Correct me if I am wrong
Admin is given on client_authorized() and therefore should be used for any is_user_admin() checks when a player joins.
__________________
fysiks is offline
brian201049
Member
Join Date: Mar 2011
Location: Hong Kong
Old 03-13-2012 , 08:01   Re: [REQ] Only admins can connect
Reply With Quote #17

Try this. (You must put it under admin.amxx in the plugins.ini)

PHP Code:
#include <amxmodx>
#include <amxmisc>

public client_authorized(id)      // this is the problem was
{
    new 
szName[32], szSteamID[32];
    
get_user_name(idszNamecharsmax(szName));
    
get_user_authid(idszSteamIDcharsmax(szSteamID));
    
    if(!
is_user_admin(id)) 
    {
        
set_hudmessage(02550, -1.0, -1.0)
        
show_hudmessage(id"The player %s dont have permission to connect! (%s)"szNameszSteamID)
        
server_cmd("kick #%d ^"Only admins can connectYou can aply for an admin job at www.badstyle.comze.com^""get_user_userid(id));
        return 
PLUGIN_CONTINUE;
    }
    else 
    {
        
set_hudmessage(02550, -1.0, -1.0)
        
show_hudmessage(id"The admin %s has connected! (%s)"szNameszSteamID)
        return 
PLUGIN_CONTINUE;
    }
    
    return 
PLUGIN_CONTINUE;


Last edited by brian201049; 03-13-2012 at 08:02.
brian201049 is offline
Schpraaankiii
Veteran Member
Join Date: Dec 2009
Location: Sweden Norrköping
Old 03-14-2012 , 13:19   Re: [REQ] Only admins can connect
Reply With Quote #18

Thank you brian201049
It worked fine
__________________
CAOSK-ESPORTS.COM

Last edited by Schpraaankiii; 03-14-2012 at 13:29.
Schpraaankiii is offline
Send a message via Skype™ to Schpraaankiii
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-14-2012 , 13:31   Re: [REQ] Only admins can connect
Reply With Quote #19

Quote:
Originally Posted by Schpraaankiii View Post
Thank you brian201049, It worked fine
But where in this plugin does it say that the flag that's required is accessflag "p" ?
I want to change it to accessflag "n".
It doesn't have anywhere in the plugin that checks for any specific flag. It only checks if they are admin. Use this more readable version (which is set for flag "n").

PHP Code:
#include <amxmodx>
#include <amxmisc>

public client_authorized(id)
{
    new 
szName[32], szSteamID[32];
    
get_user_name(idszNamecharsmax(szName));
    
get_user_authid(idszSteamIDcharsmax(szSteamID));

    
set_hudmessage(02550, -1.0, -1.0)
    if( 
/*is_user_admin(id)*/ get_user_flags(id) & ADMIN_LEVEL_B )
    {
        
show_hudmessage(id"The admin %s has connected! (%s)"szNameszSteamID)
    }
    else
    {
        
show_hudmessage(id"The player %s dont have permission to connect! (%s)"szNameszSteamID)
        
server_cmd("kick #%d ^"Only admins can connectYou can aply for an admin job at www.badstyle.comze.com^""get_user_userid(id));
    }

__________________
fysiks is offline
Schpraaankiii
Veteran Member
Join Date: Dec 2009
Location: Sweden Norrköping
Old 03-14-2012 , 13:43   Re: [REQ] Only admins can connect
Reply With Quote #20

Thank you fysiks.
It works exactly as I wanted
No need for more help with this. This thread can be locked
__________________
CAOSK-ESPORTS.COM

Last edited by Exolent[jNr]; 03-14-2012 at 14:58. Reason: Don't crosspost about other topics.
Schpraaankiii is offline
Send a message via Skype™ to Schpraaankiii
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode