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

Command only for admin & dead users while alive


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 07-23-2011 , 11:07   Command only for admin & dead users while alive
Reply With Quote #1

Hey,

I'm trying to make a command available only for admins with flag A and regular users when they're dead, but the best i could to is, to restrict the command for alive users and make it unavailable for users with ADMIN_USER (aka default).

Code:
  if (is_user_alive(id) && (get_user_flags(id) & ADMIN_USER))
  {
     client_print(id, print_chat, "Only admins or dead users could use this command")
     return PLUGIN_HANDLED
  }
__________________

Last edited by DeLiriuM; 07-23-2011 at 11:17.
DeLiriuM is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-23-2011 , 11:47   Re: Command only for admin & dead users while alive
Reply With Quote #2

PHP Code:
if (is_user_alive(id) || !(get_user_flags(id) & ADMIN_USER)) 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 07-23-2011 , 12:00   Re: Command only for admin & dead users while alive
Reply With Quote #3

Nope... no matter what flags I add or if I'm dead or alive, I get "Only admins blablabla...".
__________________
DeLiriuM is offline
fireattack
Senior Member
Join Date: Jul 2008
Old 07-23-2011 , 12:54   Re: Command only for admin & dead users while alive
Reply With Quote #4

PHP Code:

if( !is_user_aliveid )|| get_user_flagsid ) & ADMIN_IMMUNITY ) ) 

Last edited by fireattack; 07-23-2011 at 12:57.
fireattack is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-23-2011 , 13:06   Re: Command only for admin & dead users while alive
Reply With Quote #5

I was wrong the first time.

tested and working:
PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_clcmd("say !test""CmdTest");
}


public 
CmdTest(id)
{
    if(
is_user_alive(id) && !(get_user_flags(id) & ADMIN_BAN))
        
client_print(idprint_chat"You cannot access this");
        
    else
        
client_print(idprint_chat"You can access this");
    
    return 
PLUGIN_HANDLED;

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 07-23-2011 , 15:02   Re: Command only for admin & dead users while alive
Reply With Quote #6

Thanks. New problem now.

PHP Code:
public cmdMe(id)
{
  
    if (!
SayMe)
    {

        
colorChat(idCHATCOLOR_RED"%L"id"DISABLED_MSG")
        return 
PLUGIN_HANDLED
    
}
    
    
format_kill_vinfo(id0g_sBuffer)
    
colorChat(idCHATCOLOR_GREEN,"* %s"g_sBuffer)
    
    return 
PLUGIN_CONTINUE

@drekes - can't use you're version, since if... else... if... won't work (tested it).
__________________
DeLiriuM is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-23-2011 , 15:23   Re: Command only for admin & dead users while alive
Reply With Quote #7

PHP Code:
public cmdMe(id)
{
    if (!
SayMe)
    {
        
colorChat(idCHATCOLOR_RED"%L"id"DISABLED_MSG")
    }
    
    else
    {
        
format_kill_vinfo(id0g_sBuffer)
        
colorChat(idCHATCOLOR_GREEN,"* %s"g_sBuffer)
    }
    
    return 
PLUGIN_CONTINUE

You have to use braces if you have more than 1 statement in an if/else if/else
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
DeLiriuM
Senior Member
Join Date: Dec 2006
Old 07-23-2011 , 15:28   Re: Command only for admin & dead users while alive
Reply With Quote #8

Removed

PHP Code:
    if (!SayMe)
    {

        
colorChat(idCHATCOLOR_RED"%L"id"DISABLED_MSG")
        return 
PLUGIN_HANDLED
    

Added the }{ and that did the trick. Thanks ;)
__________________
DeLiriuM is offline
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 06:46.


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