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

Protection from explosion bomb


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cssnik
Member
Join Date: Apr 2011
Location: Russia
Old 05-24-2011 , 13:09   Protection from explosion bomb
Reply With Quote #1

I would like to plugin that will protect the player with the custom flag from the bomb explosion. The explosion can not kill the player... =)

Is it possible?
cssnik is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 05-24-2011 , 21:20   Re: Protection from explosion bomb
Reply With Quote #2

I would think it's possible especially using SDKHooks... if damage from c4 plugin_handled... similar to how no fall damage is handled...

I would have to look for the damage type that c4 dishes out... I'm sure someone here could whip something like this up faster than I could... if I have time, I'll try to work on it

I need the practice
TnTSCS is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 05-25-2011 , 11:10   Re: Protection from explosion bomb
Reply With Quote #3

Can't you just take the code from the End Round Immunity plugin for TF2 and convert it? No idea if that would work but it's an idea.

http://forums.alliedmods.net/showthread.php?p=703282
Drixevel is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 05-28-2011 , 12:15   Re: Protection from explosion bomb
Reply With Quote #4

Well... with my limited knowledge and lack of time to work on this, I'm 85% done.

I've successfully been able to block damage (albeit all damage as I cannot isolate C4 damage, I know DMG_BLAST, but I dunno)...

Now I'll work on making the immunity for only those with reserved_flag
TnTSCS is offline
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 05-28-2011 , 18:32   Re: Protection from explosion bomb
Reply With Quote #5

Quote:
Originally Posted by r3dw3r3w0lf View Post
Can't you just take the code from the End Round Immunity plugin for TF2 and convert it? No idea if that would work but it's an idea.

http://forums.alliedmods.net/showthread.php?p=703282
That just applies godmode, it does not and can not filter damage types.
SDKHooks is the way to go.
__________________
DarthNinja is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 05-28-2011 , 18:41   Re: Protection from explosion bomb
Reply With Quote #6

I will try it.
Bimbo1 is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 05-28-2011 , 19:22   Re: Protection from explosion bomb
Reply With Quote #7

It works for me, just check if it isn't removing the damage from grenades
PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>

public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(
damagetype == 64 && !IsClientConnected(attacker))
    {
        if(
GetUserFlagBits(victim) & ADMFLAG_CUSTOM1)
        {
            
damage 0.0;
            return 
Plugin_Continue;
        }
    }
    return 
Plugin_Continue;

Bimbo1 is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 05-28-2011 , 22:08   Re: Protection from explosion bomb
Reply With Quote #8

I was trying to figure out the darn damagetype for C4... is there a list somewhere?

I'll load that up and see if it works on the test server... my issue is I could use if(damagetype && DMG_BLAST) but it would block nade damage ... but I was using a bool for roundend as well

-------------
EDIT:
Your code was blocking nade damage too... needed the roundend bool

here's the meat of the code I posted - get the full .sp from the post:
PHP Code:
#include <sourcemod>
#include <sdkhooks>

new bool:g_bRoundOver false;

public 
OnPluginStart()
{
    
HookEvent("player_spawn",Event_PlayerSpawn);
    
HookEvent("round_end"Event_RoundEndEventHookMode_Pre);
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
g_bRoundOver true;
    return;
}

public 
Action:OnTakeDamage(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(
g_bRoundOver && damagetype == 64)
    {
        if(
GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
        {
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
g_bRoundOver false;
    return;


Last edited by TnTSCS; 05-28-2011 at 23:26.
TnTSCS is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 05-28-2011 , 23:22   Re: Protection from explosion bomb
Reply With Quote #9

plugin posted...

Thank you Bimbo1 for showing me how to get the ADMFLAG of a client... I was " " that close, but you showed me the light... and now, I find admin.inc - LOL

Plugin posted HERE

admin.inc for GetAdminFlag:
PHP Code:

/**
 * Returns whether or not a flag is enabled on an admin.
 *
 * @param id            AdminId index of the admin.
 * @param flag            Admin flag to use.
 * @param mode            Access mode to check.
 * @return                True if enabled, false otherwise.
 */
native bool:GetAdminFlag(AdminId:idAdminFlag:flagAdmAccessMode:mode=Access_Effective); 

Last edited by TnTSCS; 05-28-2011 at 23:43.
TnTSCS is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-04-2011 , 11:17   Re: Protection from explosion bomb
Reply With Quote #10

Have a look at CheckCommandAccess. That way people can just add an admin override to change the flag without the need of a recompile
__________________
Peace-Maker 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 10:57.


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