Raised This Month: $ Target: $400
 0% 

Removing Flag A


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 11-01-2009 , 09:54   Removing Flag A
Reply With Quote #1

This code does remove all flags for admins:

PHP Code:
remove_user_flags(id
How can I make, that it only should remove the A flag?
KadiR is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-01-2009 , 09:57   Re: Removing Flag A
Reply With Quote #2

Try this (untested)

PHP Code:
new iFlags = ( get_user_flagsid ) & ~ADMIN_LEVEL_A );
remove_user_flagsid );
set_user_flagsid iFlags ); 
__________________
Bugsy is online now
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 11-01-2009 , 10:20   Re: Removing Flag A
Reply With Quote #3

Didn't work for me..
KadiR is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-01-2009 , 10:40   Re: Removing Flag A
Reply With Quote #4

PHP Code:
new iFlags get_user_flags(id);
 
if (
iFlags ADMIN_LEVEL_A)
{
        
iFlags &= ~ADMIN_LEVEL_A;
 
        
remove_user_flags(id);
        
set_user_flags(idiFlags);

If by flag A you mean immunity (flag "a"), change ADMIN_LEVEL_A to ADMIN_IMMUNITY.
__________________
hleV is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-01-2009 , 10:58   Re: Removing Flag A
Reply With Quote #5

hlev, that is the same as my code except w\ an if statement; you can also shorten it with set_user_flags( id, iFlags & ~ADMIN_LEVEL_A );

Kadir, it should work. Are you properly testing if the flag exists?

Try this:
PHP Code:
//check if player has level a prior to removing
if ( get_user_flagsid ) & ADMIN_LEVEL_A )
    
client_printid print_chat "player has level a" );
else
    
client_printid print_chat "player does not have level a" );

//remove level a from flags
new iFlags = ( get_user_flagsid ) & ~ADMIN_LEVEL_A );
remove_user_flagsid );
set_user_flagsid iFlags );

//check again if player has level a
if ( get_user_flagsid ) & ADMIN_LEVEL_A )
    
client_printid print_chat "player has level a" );
else
    
client_printid print_chat "player does not have level a" ); 
__________________

Last edited by Bugsy; 11-01-2009 at 11:09.
Bugsy is online now
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-01-2009 , 17:21   Re: Removing Flag A
Reply With Quote #6

Code:
set_user_flags(id, get_user_flags(id) & ~ADMIN_IMMUNITY)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-01-2009 , 17:36   Re: Removing Flag A
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
Code:
set_user_flags(id, get_user_flags(id) & ~ADMIN_IMMUNITY)
Will not work Connor, you must remove flags too.

Try it:
PHP Code:
public testid )
{
    
//check if player has level a prior to removing
    
if ( get_user_flagsid ) & ADMIN_LEVEL_A )
        
client_printid print_chat "player has level a" );
    else
        
client_printid print_chat "player does not have level a" );
    
    
set_user_flagsid , ( get_user_flagsid ) & ~ADMIN_LEVEL_A ) );
    
    
//check again if player has level a
    
if ( get_user_flagsid ) & ADMIN_LEVEL_A )
        
client_printid print_chat "player has level a" );
    else
        
client_printid print_chat "player does not have level a" ); 

__________________
Bugsy is online now
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-01-2009 , 17:43   Re: Removing Flag A
Reply With Quote #8

Exact :

Code:
	pPlayer->flags[id] |= flag;

Which idiot wrote :
Code:
	if (id < 0)
		id = 0;
	
	if (id > 31)
		id = 31;
??
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-01-2009 , 18:20   Re: Removing Flag A
Reply With Quote #9


PHP Code:
remove_user_flagsid ADMIN_LEVEL_A ); 
__________________

Last edited by Bugsy; 11-01-2009 at 18:23.
Bugsy is online now
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-01-2009 , 19:14   Re: Removing Flag A
Reply With Quote #10

I still wonder what is the 3rd arg.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 21:05.


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