AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [Request] Last Counter-Terrorist Alive get a knife with a lot of damage (https://forums.alliedmods.net/showthread.php?t=347015)

Yeoo 03-27-2024 18:21

[Request] Last Counter-Terrorist Alive get a knife with a lot of damage
 
Hi, could someone make me a plugin that check the last CT alive and gives him a knife with a lot of damage and a custom skin.
Also this should work only if there are at least 4 players online.

Yeoo 04-04-2024 15:51

Re: [Request] Last Counter-Terrorist Alive get a knife with a lot of damage
 
Up

bigdaddy424 04-04-2024 19:45

Re: [Request] Last Counter-Terrorist Alive get a knife with a lot of damage
 
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)
        }
    }




All times are GMT -4. The time now is 16:45.

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