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

blocking player_hurt


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
frozenice
Junior Member
Join Date: Oct 2007
Location: germany, thüringen
Old 10-12-2007 , 14:43   blocking player_hurt
Reply With Quote #1

PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "No Damage",
    
author "frozenice",
    
description "Disables damaging others!",
    
version "0.2",
    
url "http://frozenice.de"
};

public 
OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurtEventHookMode_Pre)
}

public 
Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
victimId GetEventInt(event"userid")
    new 
attackerId GetEventInt(event"attacker")
    if (
victimId != attackerId)
    {
        return 
Plugin_Handled
    
}
    
    return 
Plugin_Continue

doesn't block it!
why? is there some pre-processing from the engine or sth? (tried in Fortress Forever btw)
frozenice is offline
Send a message via ICQ to frozenice Send a message via AIM to frozenice Send a message via MSN to frozenice Send a message via Yahoo to frozenice
Hell Phoenix
Senior Member
Join Date: Jan 2005
Old 10-12-2007 , 16:46   Re: blocking player_hurt
Reply With Quote #2

There is no player_hurt in FF.
__________________
Hell Phoenix is offline
frozenice
Junior Member
Join Date: Oct 2007
Location: germany, thüringen
Old 10-12-2007 , 17:50   Re: blocking player_hurt
Reply With Quote #3

there is, in hl2 gameevents.res (or here)
and I already printed the IDs and health, shows up correctly in server
frozenice is offline
Send a message via ICQ to frozenice Send a message via AIM to frozenice Send a message via MSN to frozenice Send a message via Yahoo to frozenice
frozenice
Junior Member
Join Date: Oct 2007
Location: germany, thüringen
Old 10-13-2007 , 05:35   Re: blocking player_hurt
Reply With Quote #4

Quote:
Originally Posted by frozenice View Post
in hl2 gameevents.res
.../hl2/resource/gameevents.res
PHP Code:
"player_hurt"
    
{
        
"userid"    "short"       // player index who was hurt                
        
"attacker"    "short"         // player index who attacked
        
"health"    "byte"        // remaining health points
    

common to all source mods!?

the fields of the event are correct when fired.

but maybe there is another approach to block damage?

Last edited by frozenice; 10-13-2007 at 05:38.
frozenice is offline
Send a message via ICQ to frozenice Send a message via AIM to frozenice Send a message via MSN to frozenice Send a message via Yahoo to frozenice
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 10-13-2007 , 10:55   Re: blocking player_hurt
Reply With Quote #5

use HookEventEx and see if it returned true or false

or, since it is pre, you could just give god mode before the event and after the event :O
__________________
http://www.nican132.com
I require reputation!

Last edited by Nican; 10-13-2007 at 11:19.
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
frozenice
Junior Member
Join Date: Oct 2007
Location: germany, thüringen
Old 10-13-2007 , 11:21   Re: blocking player_hurt
Reply With Quote #6

Quote:
L 10/13/2007 - 17:08:48: [no_damage.smx] HookEventEx returned true!
[SM] Loaded plugin no_damage.smx successfully.
damage still there.

mhm, that could possible lead to abuse
p1 shoots p2 which sits on 8 pipes or sth (plugins is for fun/skill server)
(tbh, I don't think that it would be possible, but who knows!)
any code for this? should timer be used for this or what else?

Last edited by frozenice; 10-13-2007 at 11:32.
frozenice is offline
Send a message via ICQ to frozenice Send a message via AIM to frozenice Send a message via MSN to frozenice Send a message via Yahoo to frozenice
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 00:12.


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