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

Player touch player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 02-14-2022 , 09:15   Player touch player
Reply With Quote #1

Hi, I have a problem and I don't know why this doesn't work. before I could make it work with the same code but now it doesn't, and I didn't change anything.

is there something wrong with the code?

PHP Code:

// this is just to be activated during the dash
new bool:touchAceKatanaPower[SH_MAXSLOTS+1]

//----------------------------------------------------------------------------------------------
public sh_client_death(victimattacker)
{
    if ( 
victim == attacker ) return
    
    new 
randnum random_num(0100)
    new 
katanachance floatround(get_pcvar_float(pcvarPercent) * 100)
    
    new 
clipammowpnid get_user_weapon(attackerclipammo
    
    if ( 
wpnid == CSW_KNIFE && katanachance >= randnum && is_user_alive(attacker) ) {
        
        
dash(attacker)
        
        new 
ptr attacker
        
new ptd victim 
        pfn_touch
(ptrptd)   
        
    }
}
//----------------------------------------------------------------------------------------------
//        EVENT of DASH + DAMAGE
//----------------------------------------------------------------------------------------------
public dash(attacker)
{
    if (!(
pev(attackerpev_flags) & FL_ONGROUND)) return
    
    static 
Float:velocity[3]
    
velocity_by_aim(attacker1750velocity)
        
    
velocity[2] = 100.0        // z
    
set_pev(attackerpev_velocityvelocity)
    
    
touchAceKatanaPower[attacker] = true
}
//-----------------------------------------
public pfn_touch(ptrptd
{
    if(!
is_valid_ent(ptr) || !is_valid_ent(ptd)) return PLUGIN_CONTINUE
            
    
if(!is_user_alive(ptr) || !is_user_alive(ptd)) return PLUGIN_CONTINUE
        
    
new classname[32]
    
entity_get_string(ptrEV_SZ_classnameclassname31)
    if ( 
equal(classname"player") ) {
        
        if ( 
touchAceKatanaPower[ptr] && get_user_team(ptr) != get_user_team(ptd) ) {
        
            
// This code is for kill
            
new damage read_data(2)
            
sh_extra_damage(ptdptrdamage"Por Katana"0SH_DMG_KILL)
        }    
    }
    
    
     return 
PLUGIN_HANDLED

Arje is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-14-2022 , 09:45   Re: Player touch player
Reply With Quote #2

What is the problem? What could you do before and does not work now?
__________________
HamletEagle is offline
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 02-14-2022 , 09:55   Re: Player touch player
Reply With Quote #3

I solved it, it was because I have many plugins with "public pfn_touch", and in some it had "plugin_handled" and this stopped everyone's fpn touch, so..

My question is, should I remove "public" from "public fpn_touch" in each of the scripts?
I don't know exactly how that works
Arje is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-14-2022 , 15:20   Re: Player touch player
Reply With Quote #4

If you remove "public", the function won't work and the plugin will throw an error.

What you need to remove is PLUGIN_HANDLED. This blocks the touch event from triggering, so unless you want to do that, don't use PLUGIN_HANDLED, or put other plugins you want to use before that one in plugins.ini so they don't get blocked.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 16:59.


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