Raised This Month: $ Target: $400
 0% 

Immunity not work?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
schmidt
BANNED
Join Date: Mar 2010
Location: Milky Way/Earth
Old 10-13-2012 , 13:34   Immunity not work?
Reply With Quote #1

Immunity not work? I tried this code with the bot:

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

public OnPluginStart()
{
    
RegConsoleCmd("kill_target"kill_target"kill_target <userid>");
}

public 
Action:kill_target(clientargs)
{
    if (
client && args 0)
    {
        
decl String:str_userid[15]; GetCmdArg(1str_userid15);
        new 
target GetClientOfUserId(StringToInt(str_userid));

        if (
target 1PrintToChat(client"Target not found");
        else if (!
IsPlayerAlive(target)) PrintToChat(client"Target dead");

        else if (
CanUserTarget(clienttarget))
        {
            
ForcePlayerSuicide(target);
            
PrintToChat(client"Target killed");
        }

        else 
PrintToChat(client"Target have immunity");
    }
    return 
Plugin_Handled;
}

public 
OnClientPostAdminCheck(client)
{
    new 
AdminId:id GetUserAdmin(client);

    if (
id == INVALID_ADMIN_ID)
    {
        
id CreateAdmin();
        
SetUserAdmin(clientidtrue);
    }

    if (
IsFakeClient(client))
    {
        
SetAdminImmunityLevel(id65);
        
PrintToChatAll("%N: immunity = 65"client); // more immunity for the bot
    
}

    else
    {
        
SetAdminImmunityLevel(id50);
        
PrintToChatAll("%N: immunity = 50"client); // human
    
}

I tried to change sm_immunity_mode 1/2/3 - no effect. Or is it because he's a bot?

Last edited by schmidt; 10-13-2012 at 17:21.
schmidt is offline
Send a message via Skype™ to schmidt
ecca
Sexy Santa
Join Date: Jan 2011
Old 10-13-2012 , 16:03   Re: Immunity not work?
Reply With Quote #2

Quote:
Originally Posted by schmidt View Post
Immunity not work? I tried this code with the bot:

PHP Code:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

public OnPluginStart()
{
    
RegConsoleCmd("kill_target"kill_target"kill_target <userid>");
}

public 
Action:kill_target(clientargs)
{
    if (
client && args 0)
    {
        
decl String:str_userid[15]; GetCmdArg(1str_userid15);
        new 
target GetClientOfUserId(StringToInt(str_userid));

        if (
target 1PrintToChat(client"Target not found");
        else if (!
IsPlayerAlive(target)) PrintToChat(client"Target dead");

        else if (
CanUserTarget(clienttarget))
        {
            
ForcePlayerSuicide(target);
            
PrintToChat(client"Target killed");
        }

        else 
PrintToChat(client"Target have immunity");
    }
    return 
Plugin_Handled;
}

public 
OnClientPostAdminCheck(client)
{
    new 
AdminId:id GetUserAdmin(client);

    if (
id == INVALID_ADMIN_ID)
    {
        
id CreateAdmin();
        
SetUserAdmin(clientidtrue);
    }

    if (
IsFakeClient(client))
    {
        
SetAdminImmunityLevel(id50);
        
PrintToChatAll("%N: immunity = 50"client); // bot
    
}

    else
    {
        
SetAdminImmunityLevel(id65);
        
PrintToChatAll("%N: immunity = 65"client); // human
    
}

I tried to change sm_immunity_mode 1/2/3 - no effect. Or is it because he's a bot?
Any errors ? Also if you have set your immunity to higher than the target you can always target him. High == lower , lower != high.

Last edited by ecca; 10-13-2012 at 16:14.
ecca is offline
schmidt
BANNED
Join Date: Mar 2010
Location: Milky Way/Earth
Old 10-13-2012 , 16:36   Re: Immunity not work?
Reply With Quote #3

Oh I mistaken in the code a bit, must be so:

PHP Code:
if (IsFakeClient(client))
{
    
SetAdminImmunityLevel(id65); // more immunity for the bot
}
else
{
    
SetAdminImmunityLevel(id50); // human

ie set for bot more immunity than yourself, and try to kill him.
result: bot killed (error)
Human have less immunity, but it can kill a bot with a higher immunity.
Perhaps the same problem would be if tested this code on a real player? (but I have no such opportunity)

Quote:
Originally Posted by ecca View Post
Any errors ?
no errors, just does not work

Last edited by schmidt; 10-13-2012 at 17:32.
schmidt is offline
Send a message via Skype™ to schmidt
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-13-2012 , 18:05   Re: Immunity not work?
Reply With Quote #4

Do you have the 'z' admin flag? It bypasses immunity.
__________________
asherkin is offline
schmidt
BANNED
Join Date: Mar 2010
Location: Milky Way/Earth
Old 10-13-2012 , 18:20   Re: Immunity not work?
Reply With Quote #5

Quote:
Originally Posted by asherkin View Post
Do you have the 'z' admin flag? It bypasses immunity.
ahh, there's a reason (yes, I had the flag z)
Tried without it - works (thx)
schmidt is offline
Send a message via Skype™ to schmidt
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-14-2012 , 05:20   Re: Immunity not work?
Reply With Quote #6

It's better not give (root) "z" flag to anyone. Not even yourself.
Bacardi is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 10-14-2012 , 23:38   Re: Immunity not work?
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
It's better not give (root) "z" flag to anyone. Not even yourself.
Why?
__________________
FaTony is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-15-2012 , 07:12   Re: Immunity not work?
Reply With Quote #8

Quote:
Originally Posted by FaTony View Post
Why?
- you get all flags
- immunity have no effect
- you see all cmds from admin menu
- admin command restriction won't work
- plugin developers should not have to build extra code for root users in plugins...
Code:
	new AdminId:admin = GetUserAdmin(client);
	if( admin != INVALID_ADMIN_ID && GetAdminFlag(admin, Admin_Root) )
	{
		// Do code when root user
	}
http://forums.alliedmods.net/showpos...1&postcount=15
__________________
Do not Private Message @me
Bacardi is offline
schmidt
BANNED
Join Date: Mar 2010
Location: Milky Way/Earth
Old 10-15-2012 , 11:05   Re: Immunity not work?
Reply With Quote #9

I still do not see why should not be given the flag 'z'. If it's bad, why the flag exists? If the server belongs to you and you have a flag 'z' - i think it's not bad, especially when there is a special functions in plugins only for the main admin.

Quote:
Originally Posted by asherkin View Post
One silly thing some people do that could screw this up: Give other people the Root flag
This is a matter of course. Just judging by your post, the flag 'z' is always dangerous (or I'm a bad translated English).

Quote:
Originally Posted by Bacardi View Post
Not even yourself

Last edited by schmidt; 10-15-2012 at 11:08.
schmidt is offline
Send a message via Skype™ to schmidt
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 10-25-2012 , 01:10   Re: Rob Gronkowski Jersey
Reply With Quote #10

Quote:
Originally Posted by opkicvbjersey View Post
freak jearsy
if you try to sell something go to right place..
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 10-25-2012 at 01:12.
GsiX 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 03:23.


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