Raised This Month: $ Target: $400
 0% 

TS Melee


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 12-24-2008 , 16:48   TS Melee
Reply With Quote #1

I'm looking for an alternative method of detecting when a player is hit besides TSFUN, which apparently hasn't worked since 1.70... I'd prefer that it worked basically the same way, if that's at all possible.
Spunky is offline
Send a message via AIM to Spunky
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-24-2008 , 17:58   Re: TS Melee
Reply With Quote #2

If you wanna know is player hit in any mean you can use hamsandwich's "Ham_TakeDamage"

Example:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "Damage Detect"
#define VERSION "1.0"
#define AUTHOR "CodeMaster"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_TakeDamage,"player","hook_damage",0// if you want post check change 0 to 1
}

public 
hook_damage(id,inflictor_id,attacker_id,Float:damage,damagebits) {
    
// Your code here...
    
    // inflictor_id represents "weapon" id, so maybe if melee attacks has id like custom weapon,
    // you could use:
    
    
if(inflictor_id 30) {     //Higher than highest standard weapon id?
        // if it was kung fu?
    
}
    
    return 
HAM_HANDLED

I'm HIGHLY unsure about that inflictor part, cause I never used melee attacks, but Ham_TakeDamage detects any sort of damage so it still may come handy.

Cheers ;)

Nidza
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation

CodeMaster is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 12-24-2008 , 20:05   Re: TS Melee
Reply With Quote #3

Thanks, I should be able to make that work.
Spunky is offline
Send a message via AIM to Spunky
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 12-26-2008 , 18:15   Re: TS Melee
Reply With Quote #4

I can't get that to work.

PHP Code:
public hook_damage(idinflictor_idattacker_idFloat:damagedamagebits)
{
    
// Katana and up, according to tsconst.inc
    
if (inflictor_id >= 34)
        
nrp_setuserstamina(idnrp_getuserstamina(id) - (floatround(damagefloatround_round) / 10))
    else
    {
        
// Ignore worldspawn
        
if (inflictor_id == 0)
        {
        }
        else
            
client_print(idprint_chat"[NRP] Weapons are not allowed!")

        
set_user_health(idget_user_health(id) + floatround(damagefloatround_round))
    }

    return 
HAM_HANDLED


Last edited by Spunky; 12-26-2008 at 18:18.
Spunky is offline
Send a message via AIM to Spunky
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 09:18.


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