Raised This Month: $32 Target: $400
 8% 

Change Flag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mousesports
Senior Member
Join Date: Oct 2010
Old 01-11-2019 , 10:20   Change Flag
Reply With Quote #1

Hello everyone ,


I have this amx_highlander plugin. At this time, the amx_highlander 1 command can be used only by those with rcon access. It can be set for all who have access to the amx_ban command, but also a green colored message when an admin uses the command amx_highlander 1 or amx_highlander 0?

Thank you !

Quote:
#include < amxmodx >

#include < amxmisc >



new g_iHighlander = 0;



public plugin_init( )

{

register_plugin( "Admin Highlander", "0.0.1", "Exolent" );



register_clcmd( "amx_highlander", "CmdHighlander", ADMIN_RCON, "<0|1> -- 0 to disable highlander, 1 for enable" );



register_concmd( "amx_addadmin", "CmdCheckAdmins" );

register_concmd( "amx_reloadadmins", "CmdCheckAdmins" );

}



public client_authorized( iPlayer )

{

if( g_iHighlander )

{

set_task( 0.1, "TaskCheckFlags", iPlayer );

}

}



public client_putinserver( iPlayer )

{

if( g_iHighlander )

{

set_task( 0.1, "TaskCheckFlags", iPlayer );

}

}



public client_infochanged( iPlayer )

{

if( g_iHighlander && g_iHighlander != iPlayer && is_user_connected( iPlayer ) )

{

new szNewName[ 32 ], szOldName[ 32 ];

get_user_info( iPlayer, "name", szNewName, charsmax( szNewName ) );

get_user_name( iPlayer, szOldName, charsmax( szOldName ) );



if( !equal( szNewName, szOldName ) )

{

set_task( 0.1, "TaskCheckFlags", iPlayer );

}

}

}



public client_disconnect( iPlayer )

{

if( g_iHighlander == iPlayer )

{

g_iHighlander = 0;



server_cmd( "amx_reloadadmins" );

server_exec( );

}

}



public CmdHighlander( iPlayer, iLevel, iCID )

{

if( !cmd_access( iPlayer, iLevel, iCID, 2 ) )

{

return PLUGIN_HANDLED;

}



new szArg[ 3 ];

read_argv( 1, szArg, charsmax( szArg ) );



if( szArg[ 0 ] == '1' )

{

if( g_iHighlander )

{

if( g_iHighlander == iPlayer )

{

client_print( iPlayer, print_chat, "Highlander is already enabled." );

}

else

{

client_print( iPlayer, print_chat, "THERE CAN ONLY BE ONE HIGHLANDER!" );

}

}

else

{

g_iHighlander = iPlayer;



client_print( iPlayer, print_chat, "You are now the highlander." );



new iPlayers[ 32 ], iNum;

get_players( iPlayers, iNum );



for( new i = 0; i < iNum; i++ )

{

iPlayer = iPlayers[ i ];



if( iPlayer != g_iHighlander )

{

RemoveFlags( iPlayer );

}

}

}

}

else

{

if( g_iHighlander )

{

if( g_iHighlander == iPlayer )

{

g_iHighlander = 0;



client_print( iPlayer, print_chat, "Highlander is now disabled." );



server_cmd( "amx_reloadadmins" );

server_exec( );

}

else

{

client_print( iPlayer, print_chat, "YOU ARE NOT THE HIGHLANDER!" );

}

}

else

{

client_print( iPlayer, print_chat, "There is no highlander." );

}

}



return PLUGIN_HANDLED;

}



public CmdCheckAdmins( )

{

if( g_iHighlander )

{

remove_task( 123 );

set_task( 0.5, "TaskCheckAdmins", 123 );

}

}



public TaskCheckFlags( iPlayer )

{

RemoveFlags( iPlayer );

}



public TaskCheckAdmins( )

{

if( g_iHighlander )

{

new iPlayers[ 32 ], iNum;

get_players( iPlayers, iNum );



new iPlayer;



for( new i = 0; i < iNum; i++ )

{

iPlayer = iPlayers[ i ];



if( iPlayer != g_iHighlander )

{

RemoveFlags( iPlayer );

}

}

}

}



RemoveFlags( iPlayer )

{

new iNewFlags = is_user_admin( iPlayer ) ? ADMIN_RESERVATION : ADMIN_USER;

remove_user_flags( iPlayer );

set_user_flags( iPlayer, iNewFlags );

}

Last edited by mousesports; 01-11-2019 at 10:22.
mousesports is offline
Nutu_
AlliedModders Donor
Join Date: Mar 2016
Location: Germany
Old 01-11-2019 , 10:27   Re: Change Flag
Reply With Quote #2

go to cmdaccess.ini and search for amx_highlander and put what flag you want
EDIT: if you want do it from plugin..
PHP Code:
register_clcmd"amx_highlander""CmdHighlander"ADMIN_RCON"<0|1> -- 0 to disable highlander, 1 for enable" ); 
ADMIN_RCON change in what flag you want
__________________
a simple act of caring creates an endless ripple.

Last edited by Nutu_; 01-11-2019 at 10:28.
Nutu_ is offline
mousesports
Senior Member
Join Date: Oct 2010
Old 01-11-2019 , 10:37   Re: Change Flag
Reply With Quote #3

Quote:
Originally Posted by Nutu_ View Post
go to cmdaccess.ini and search for amx_highlander and put what flag you want
EDIT: if you want do it from plugin..
PHP Code:
register_clcmd"amx_highlander""CmdHighlander"ADMIN_RCON"<0|1> -- 0 to disable highlander, 1 for enable" ); 
ADMIN_RCON change in what flag you want
Thank you !

Anything about green colored message when an admin uses the command amx_highlander 1 or amx_highlander 0?

EDIT :
I tested the plugin and used the amx_highlander command with a lower level admin. Access has left only the admin who used the command, even the admin with the highest rank on the server. When anyone fix this one please?

Last edited by mousesports; 01-11-2019 at 10:55. Reason: Acces after amx_highlander 1
mousesports 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 16:21.


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