View Single Post
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 04-04-2024 , 19:45   Re: [Request] Last Counter-Terrorist Alive get a knife with a lot of damage
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <cstrike_const>
#include <fakemeta>
#include <hamsandwich>

const m_pPlayer 41
const XO_CBASEPLAYERITEM 4
const MIN_PLAYERS 4
const Float:DAMAGE_MULTIPLIER 4.0

new arr_players[MAX_PLAYERS], last_ctnum_ct
new const knife_model[] = "models/v_knife_r.mdl"

public plugin_init()
{
    
register_event("DeathMsg""player_killed""a""1>0")
    
RegisterHam(Ham_Item_Deploy"weapon_knife""weapon_knife"1)
    
RegisterHam(Ham_TakeDamage"player""knife_damage")
    
register_logevent("reset_last_ct"2"1=Round_Start")  
    
register_logevent("reset_last_ct"2"1=Round_End")
    
register_event("TextMsg""reset_last_ct""a""2=#Game_Commencing""2=#Game_will_restart_in")
}

public 
plugin_precache()
    
precache_model(knife_model)

public 
client_authorized()
    
check()
public 
client_disconnected()
    
check()
public 
player_killed()
    
check()
public 
reset_last_ct()
    
last_ct 0

public check()
{
    
get_players(arr_playersnum_ct"ae""CT")
    
last_ct = (num_ct == arr_players[0] : 0)

    if (
last_ct)
    {
        if (
get_user_weapon(last_ct) == CSW_KNIFE)
            
client_cmd(last_ct"lastinv;lastinv")
    }
}

public 
weapon_knife(entity)
{
    if (
get_playersnum() >= MIN_PLAYERS)
    {
        new 
id get_pdata_cbase(entitym_pPlayerXO_CBASEPLAYERITEM)
        if (
id == last_ct)
            
set_pev(idpev_viewmodel2knife_model)
    }
}

public 
knife_damage(victimiidFloat:dmg)
{
    if (
get_playersnum() >= MIN_PLAYERS)
    {
        if (
is_user_connected(id))
        {
            if(
id == last_ct && get_user_weapon(id) == CSW_KNIFE)
                
SetHamParamFloat(4dmg DAMAGE_MULTIPLIER)
        }
    }

__________________
bigdaddy424 is offline