Raised This Month: $ Target: $400
 0% 

Player touch player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 11:31.


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