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

How to get admin immunity?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hennesy
Member
Join Date: Nov 2018
Location: Czech Republic
Old 05-04-2019 , 08:37   How to get admin immunity?
Reply With Quote #1

How to get admin immunity into variable?
Hennesy is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-04-2019 , 17:04   Re: How to get admin immunity?
Reply With Quote #2

GetAdminImmunityLevel

Having said that, if you want to know whether a user can target another user, CanUserTarget is likely more useful.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-06-2019 , 10:39   Re: How to get admin immunity?
Reply With Quote #3

Didn't even put this in a compiler.

Code:
stock int GetClientAdminImmunity(client)
{
	new AdminId:AID = GetUserAdmin(client);
	if(AID == INVALID_ADMIN_ID)
		return 0;
	
	return GetAdminImmunityLevel(AID);
}
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 05-06-2019 at 10:40.
eyal282 is offline
Hennesy
Member
Join Date: Nov 2018
Location: Czech Republic
Old 05-07-2019 , 08:58   Immunity of administrators in the menu
Reply With Quote #4

Hi people!
There is the following code:
PHP Code:
for(int i 1i<=MaxClients; ++i)
{
    if(
ValidPlayer(i))
    {
        
char str_i[3];
        
IntToString(istr_isizeof(str_i));
        
char name[64];
        
GetClientName(inamesizeof(name));
         
        
menu.AddItem(str_inameITEMDRAW_DEFAULT);
    }

en: How can I make so that the list does not add admins with immunity above the admin who called the menu
ru: Как мне сделать так, чтобы в список не добавлялись админы с имунитетом выше того админа который вызвал меню
Hennesy is offline
CrazyHackGUT
AlliedModders Donor
Join Date: Feb 2016
Location: Izhevsk, Russia
Old 05-07-2019 , 09:21   Re: How to get admin immunity?
Reply With Quote #5

en: Use helper method for detecting, can your admin target another or not.
ru: Используйте вспомогательный метод для определения, может Ваш админ таргетить другого или нет.

https://sm.alliedmods.net/new-api/clients/CanUserTarget
__________________
My english is very bad. I am live in Russia. Learning english language - very hard task for me...
CrazyHackGUT is offline
Send a message via ICQ to CrazyHackGUT Send a message via Skype™ to CrazyHackGUT
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 05-07-2019 , 10:24   Re: How to get admin immunity?
Reply With Quote #6

Quote:
Originally Posted by Hennesy View Post
How can I make so that the list does not add admins with immunity above the admin who called the menu
PHP Code:
stock void CreatePlayerMenu(int clientbool bots=false)
{
    
Menu menu = new Menu(Menu_Handler);
    
menu.SetTitle("Choose a player:");

    
char userid[11], buffer[256];
    for (
int i 1<= MaxClientsi++)
    {
        if (
client != && IsClientInGame(i) && CanUserTarget(clienti) && !(!bots && IsFakeClient(i)))
        {
            
IntToString(GetClientUserId(i), useridsizeof(userid));
            
Format(buffersizeof(buffer), "%N [%s]"iuserid);
            
menu.AddItem(useridbuffer);
        }
    }

    if (!
menu.ItemCount)
    {
        
menu.AddItem("""No players available."ITEMDRAW_DISABLED);
    }

    
menu.Display(client20);
}

public 
int Menu_Handler(Menu menuMenuAction actionint clientint param2)
{
    if (
action == MenuAction_Select)
    {
        
char userid[11];
        
menu.GetItem(param2useridsizeof(userid));
        
int target GetClientOfUserId(StringToInt(userid));
        if (
target)
        {
            
// Do stuff with target
        
} else {
            
// Target is no longer in-game
        
}
    } else if (
action == MenuAction_End) {
        
delete menu;
    }

    return 
0;


Last edited by ThatKidWhoGames; 05-07-2019 at 10:26.
ThatKidWhoGames is offline
Reply


Thread Tools
Display Modes

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 00:48.


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