Change guillotine into knife

Unpaid Requests, Public Plugins
ngamerz
Member
Member
Philippines
Posts: 21
Joined: 4 Months Ago
Location: Philippines From South Korea
Has thanked: 1 time
Been thanked: 3 times
Contact:

Change guillotine into knife

#1

Post by ngamerz » 3 Months Ago

Hello, can someone change the guillotine to use knife slot instead. Instead of using primary weapon slot, I think it's better to use knife slot so humans can still shoot then switch to guillotine if they want to.
My Steam:
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2160
Joined: 4 Years Ago
Has thanked: 49 times
Been thanked: 145 times
Age: 23
Contact:

#2

Post by Raheem » 3 Months Ago

Post your version, you can change the weapon base to "weapon_knife".
He who fails to plan is planning to fail

ngamerz
Member
Member
Philippines
Posts: 21
Joined: 4 Months Ago
Location: Philippines From South Korea
Has thanked: 1 time
Been thanked: 3 times
Contact:

#3

Post by ngamerz » 3 Months Ago

I did it previously but it doesnt work well. If you want to try i'll drop the code.

Code: Select all

#include <zombie_escape>
#include <engine>
#include <fakemeta_util>
#include <cstrike>
#include <fun>
 
#define PLUGIN "Blood-Dripper"
#define VERSION "1.0"
#define AUTHOR "m4m3ts"
 
#define CSW_BDRIPPER CSW_KNIFE
#define weapon_guillotine "weapon_knife"
#define old_event "events/knife.sc"
#define old_w_model "models/w_knife.mdl"
#define WEAPON_SECRETCODE 1329419
 
 
#define DEFAULT_AMMO 10
#define DAMAGE 200
#define BDRIP_CLASSNAME "Blood Dripper"
#define WEAPON_ANIMEXT "knife"
 
#define Get_Ent_Data(%1,%2) get_pdata_int(%1,%2,4)
#define Set_Ent_Data(%1,%2,%3) set_pdata_int(%1,%2,%3,4)
 
const PDATA_SAFE = 2
const OFFSET_LINUX_WEAPONS = 4
const OFFSET_WEAPONOWNER = 41
 
new const v_model[] = "models/zombie_escape/v_guillotine.mdl"
new const p_model[] = "models/zombie_escape/p_guillotine.mdl"
new const w_model[] = "models/zombie_escape/w_guillotine.mdl"
new const KNIFE_MODEL[] = "models/zombie_escape/guillotine_projectile.mdl"
new const PECAH_MODEL[] = "models/zombie_escape/gibs_guilotine.mdl"
new const hit_wall[] = "weapons/janus9_stone1.wav"
new const hit_wall2[] = "weapons/janus9_stone2.wav"
new const weapon_sound[6][] =
{
    "weapons/guillotine_catch2.wav",
    "weapons/guillotine_draw.wav",
    "weapons/guillotine_draw_empty.wav",
    "weapons/guillotine_explode.wav",
    "weapons/guillotine_red.wav",
    "weapons/guillotine-1.wav"
}
 
 
new const WeaponResource[3][] =
{
    "sprites/weapon_guillotine.txt",
    "sprites/640hud120.spr",
    "sprites/guillotine_lost.spr"
}
 
enum
{
    ANIM_IDLE = 0,
    ANIM_IDLE_EMPTY,
    ANIM_SHOOT,
    ANIM_DRAW,
    ANIM_DRAW_EMPTY,
    ANIM_IDLE_SHOOT,
    ANIM_IDLE_SHOOT2,
    ANIM_CATCH,
    ANIM_LOST
}
 
new g_MsgDeathMsg
 
new g_had_guillotine[33], g_guillotine_ammo[33], shoot_mode[33], shoot_ent_mode[33], g_pecah, headshot_mode[33], ent_sentuh[33], ent_sentuh_balik[33]
new g_old_weapon[33], g_smokepuff_id, m_iBlood[2], guillotine_korban[33], headshot_korban[33], gmsgScoreInfo
new g_iItemID
 
const PRIMARY_WEAPONS_BIT_SUM =
(1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<
CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
 
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar("guillotine_version", "m4m3ts", FCVAR_SERVER|FCVAR_SPONLY)
    register_forward(FM_CmdStart, "fw_CmdStart")
    register_forward(FM_SetModel, "fw_SetModel")
    register_think(BDRIP_CLASSNAME, "fw_Think")
    register_touch(BDRIP_CLASSNAME, "*", "fw_touch")
    register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
    register_forward(FM_TraceLine, "fw_traceline", 1)
    register_forward(FM_AddToFullPack, "fm_addtofullpack_post", 1)
    RegisterHam(Ham_Weapon_WeaponIdle, weapon_guillotine, "fw_guillotineidleanim", 1)
    RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    RegisterHam(Ham_Item_AddToPlayer, weapon_guillotine, "fw_AddToPlayer_Post", 1)
    register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
   
    g_iItemID = ze_register_item("Blood Dripper", 20, 0)
   
    register_clcmd("weapon_guillotine", "hook_weapon")
   
    g_MsgDeathMsg = get_user_msgid("DeathMsg")
    gmsgScoreInfo = get_user_msgid("ScoreInfo")
}
 
 
public plugin_precache()
{
    precache_model(v_model)
    precache_model(p_model)
    precache_model(w_model)
    precache_model(KNIFE_MODEL)
    g_pecah = precache_model(PECAH_MODEL)
    precache_sound(hit_wall)
    precache_sound(hit_wall2)
   
    for(new i = 0; i < sizeof(weapon_sound); i++)
        precache_sound(weapon_sound[i])
   
    for(new i = 1; i < sizeof(WeaponResource); i++)
        precache_model(WeaponResource[i])
   
    g_smokepuff_id = engfunc(EngFunc_PrecacheModel, WeaponResource[2])
    m_iBlood[0] = precache_model("sprites/blood.spr")
    m_iBlood[1] = precache_model("sprites/bloodspray.spr") 
}
 
public ze_user_infected(id)
{
    remove_guillotine(id)
}
 
public fw_PlayerKilled(id)
{
    remove_guillotine(id)
}
 
public hook_weapon(id)
{
    engclient_cmd(id, weapon_guillotine)
    return
}
 
public ze_select_item_pre(id, itemid)
{
    // This not our item?
    if (itemid != g_iItemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    // Finally return that it's available
    return ZE_ITEM_AVAILABLE
}
 
public ze_select_item_post(id, itemid)
{
    // This is not our item, Block it here and don't execute the blew code
    if (itemid != g_iItemID)
        return
   
    get_guillotine(id)
}
 
public get_guillotine(id)
{
    if(!is_user_alive(id))
        return
    drop_weapons(id, 1)
    g_had_guillotine[id] = 1
    g_guillotine_ammo[id] = DEFAULT_AMMO
   
    give_item(id, weapon_guillotine)
    update_ammo(id)
   
    static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, weapon_guillotine, id)
    if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)
}
 
public remove_guillotine(id)
{
    g_had_guillotine[id] = 0
}
 
public refill_guillotine(id)
{  
    if(g_had_guillotine[id]) g_guillotine_ammo[id] = 15
   
    if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id]) update_ammo(id)
}
   
public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
    if(!is_user_alive(id) || !is_user_connected(id))
        return FMRES_IGNORED   
    if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
        set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
   
    return FMRES_HANDLED
}
 
public Event_CurWeapon(id)
{
    if(!is_user_alive(id))
        return
       
    if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
    {
        set_pev(id, pev_viewmodel2, v_model)
        set_pev(id, pev_weaponmodel2, p_model)
        set_pdata_string(id, 492 * 4, WEAPON_ANIMEXT, -1 , 20)
        if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] >= 1) set_weapon_anim(id, ANIM_DRAW)
        if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] == 0) set_weapon_anim(id, ANIM_DRAW_EMPTY)
        update_ammo(id)
    }
   
    g_old_weapon[id] = get_user_weapon(id)
}
 
public fw_guillotineidleanim(Weapon)
{
    new id = get_pdata_cbase(Weapon, 41, 4)
 
    if(!is_user_alive(id) || ze_is_user_zombie(id) || !g_had_guillotine[id] || get_user_weapon(id) != CSW_BDRIPPER)
        return HAM_IGNORED;
   
    if(shoot_mode[id] == 0 && g_guillotine_ammo[id] >= 1)
        return HAM_SUPERCEDE;
   
    if(headshot_mode[id] == 0 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25)
    {
        set_weapon_anim(id, ANIM_IDLE_SHOOT)
        set_pdata_float(Weapon, 48, 20.0, 4)
        return HAM_SUPERCEDE;
    }
   
    if(headshot_mode[id] == 1 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25)
    {
        set_weapon_anim(id, ANIM_IDLE_SHOOT2)
        set_pdata_float(Weapon, 48, 20.0, 4)
        return HAM_SUPERCEDE;
    }
   
    if(g_guillotine_ammo[id] == 0 && get_pdata_float(Weapon, 48, 4) <= 0.25)
    {
        set_weapon_anim(id, ANIM_IDLE_EMPTY)
        set_pdata_float(Weapon, 48, 20.0, 4)
        return HAM_SUPERCEDE;
    }
 
    return HAM_IGNORED;
}
 
public fw_CmdStart(id, uc_handle, seed)
{
    if(!is_user_alive(id) || !is_user_connected(id))
        return
    if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
        return
   
    static ent; ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
    if(!pev_valid(ent))
        return
    if(get_pdata_float(ent, 46, OFFSET_LINUX_WEAPONS) > 0.0 || get_pdata_float(ent, 47, OFFSET_LINUX_WEAPONS) > 0.0)
        return
   
    static CurButton
    CurButton = get_uc(uc_handle, UC_Buttons)
   
    if(CurButton & IN_ATTACK)
    {
        CurButton &= ~IN_ATTACK
        set_uc(uc_handle, UC_Buttons, CurButton)
       
        if(g_guillotine_ammo[id] == 0)
            return
        if(shoot_mode[id] == 0 && get_pdata_float(id, 83, 5) <= 0.0)
        {
            g_guillotine_ammo[id]--
            update_ammo(id)
            shoot_mode[id] = 1
            FireKnife(id)
            set_weapon_anim(id, ANIM_SHOOT)
            emit_sound(id, CHAN_WEAPON, weapon_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
            set_weapons_timeidle(id, CSW_BDRIPPER, 0.7)
            set_player_nextattackx(id, 0.7)
        }
    }
}
 
public FireKnife(id)
{
    static Float:StartOrigin[3], Float:velocity[3], Float:angles[3], Float:anglestrue[3], Float:jarak_max[3]
    get_position(id, 2.0, 0.0, 0.0, StartOrigin)
    get_position(id, 700.0, 0.0, 0.0, jarak_max)
   
    pev(id,pev_v_angle,angles)
    static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
    if(!pev_valid(Ent)) return
    anglestrue[0] = 360.0 - angles[0]
    anglestrue[1] = angles[1]
    anglestrue[2] = angles[2]
   
    // Set info for ent
    set_pev(Ent, pev_movetype, MOVETYPE_FLY)
    set_pev(Ent, pev_owner, id)
    set_pev(Ent, pev_iuser1, id)
    set_pev(Ent, pev_fuser1, get_gametime() + 4.0)
    set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
   
    entity_set_string(Ent, EV_SZ_classname, BDRIP_CLASSNAME)
    engfunc(EngFunc_SetModel, Ent, KNIFE_MODEL)
    set_pev(Ent, pev_mins, Float:{-1.0, -1.0, -1.0})
    set_pev(Ent, pev_maxs, Float:{1.0, 1.0, 1.0})
    set_pev(Ent, pev_origin, StartOrigin)
    set_pev(Ent, pev_angles, anglestrue)
    set_pev(Ent, pev_gravity, 0.01)
    set_pev(Ent, pev_solid, SOLID_BBOX)
    set_pev(Ent, pev_frame, 1.0)
    set_pev(Ent, pev_framerate, 30.0)
    set_pev(Ent, pev_sequence, 0)
   
    velocity_by_aim( id, 1100, velocity )
    set_pev( Ent, pev_velocity, velocity )
    set_pev(Ent, pev_vuser1, velocity)
    set_pev(Ent, pev_vuser2, jarak_max)
    shoot_ent_mode[id] = 0
    ent_sentuh[id] = 1
    ent_sentuh_balik[id] = 0
}
 
public fm_addtofullpack_post(es, e, user, host, host_flags, player, p_set)
{
    if(!player)
        return FMRES_IGNORED
       
    if(!is_user_connected(host) || !is_user_alive(user))
        return FMRES_IGNORED
       
    if(!ze_is_user_zombie(user) || headshot_korban[user] != 1)
        return FMRES_IGNORED
       
    if(host == user)
        return FMRES_IGNORED
   
    new Float:PlayerOrigin[3], Float:anglesss[3]
    pev(user, pev_origin, PlayerOrigin)
   
    engfunc(EngFunc_GetBonePosition, user, 8, PlayerOrigin, anglesss)
                       
    engfunc(EngFunc_SetOrigin, guillotine_korban[user], PlayerOrigin)
    engfunc(EngFunc_SetOrigin, guillotine_korban[user], PlayerOrigin)
 
    return FMRES_HANDLED
}
 
public fw_Think(Ent)
{
    if(!pev_valid(Ent))
        return
   
    static Float:pulang[3], Float:StartOriginz[3], pemilix, Float:brangkat[3], Float:jarak_max[3], Float:origin_asli[3], korban
    pemilix = pev(Ent, pev_iuser1)
    pev(Ent, pev_origin, StartOriginz)
    korban = pev(Ent, pev_iuser2)
   
    if(headshot_korban[korban] == 1)
    {
        if(get_gametime() - 0.2 > pev(Ent, pev_fuser3))
        {
            Damage_guillotine(Ent, korban)
            set_pev(Ent, pev_fuser3, get_gametime())
        }
    }
   
    if(ent_sentuh_balik[pemilix] == 0 && shoot_ent_mode[pemilix] == 1)
    {
        ent_sentuh_balik[pemilix] = 1
        pev(pemilix, pev_origin, origin_asli)
        origin_asli[2] += 7.5
    }
   
    if(ent_sentuh[pemilix] == 1)
    {
        ent_sentuh[pemilix] = 0
        pev(Ent, pev_vuser2, jarak_max)
        pev(Ent, pev_vuser1, brangkat)
        get_speed_vector(StartOriginz, origin_asli, 1100.0, pulang)
                   
        if(shoot_ent_mode[pemilix] == 1)
        {
            set_pev(Ent, pev_velocity, pulang)
        }
        else set_pev(Ent, pev_velocity, brangkat)
    }
   
    if(shoot_ent_mode[pemilix] == 0 && get_distance_f(StartOriginz, jarak_max) <= 10.0)
    {
        shoot_ent_mode[pemilix] = 1
        ent_sentuh[pemilix] = 1
        set_pev(Ent, pev_owner, 0)
    }
   
    if(shoot_ent_mode[pemilix] == 1 && get_distance_f(StartOriginz, origin_asli) <= 10.0)
    {
        if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
        else ancur(Ent)
    }
    else if(headshot_korban[korban] == 1) set_pev(Ent, pev_nextthink, get_gametime() + 0.2)
    else set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
}
 
public fw_touch(Ent, Id)
{
    // If ent is valid
    if(!pev_valid(Ent))
        return
    if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
        return
    static classnameptd[32]
    pev(Id, pev_classname, classnameptd, 31)
    if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 80.0, DMG_GENERIC )
   
    // Get it's origin
    new Float:originF[3], pemilix
    pemilix = pev(Ent, pev_iuser1)
    pev(Ent, pev_origin, originF)
    // Alive...
   
    if(is_user_alive(Id) && ze_is_user_zombie(Id))
    {
        Damage_guillotine(Ent, Id)
        set_pev(Ent, pev_owner, Id)
        ent_sentuh[pemilix] = 1
        create_blood(originF)
        create_blood(originF)
    }
   
    else if(shoot_ent_mode[pemilix] == 1 && Id == pemilix)
    {
        if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
        else ancur(Ent)
    }
   
    else if(is_user_alive(Id) && !ze_is_user_zombie(Id))
    {
        set_pev(Ent, pev_owner, Id)
        ent_sentuh[pemilix] = 1
    }
   
    else
    {
        set_pev(Ent, pev_owner, 0)
 
        if(shoot_ent_mode[pemilix] == 0)
        {
            shoot_ent_mode[pemilix] = 1
            engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall, 1.0, ATTN_STATIC, 0, PITCH_NORM)
            ent_sentuh[pemilix] = 1
        }
        else ancur(Ent)
    }
}
 
public ancur(Ent)
{
    if(!pev_valid(Ent))
        return
    static Float:origin2[3], pemilix, Float:origin3[3]
    pemilix = pev(Ent, pev_iuser1)
    entity_get_vector(Ent, EV_VEC_origin, origin2)
    pev(Ent, pev_origin, origin3)
   
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2, 0)
    write_byte(TE_BREAKMODEL)
    engfunc(EngFunc_WriteCoord, origin2[0])
    engfunc(EngFunc_WriteCoord, origin2[1])
    engfunc(EngFunc_WriteCoord, origin2[2])
    engfunc(EngFunc_WriteCoord, 25)
    engfunc(EngFunc_WriteCoord, 25)
    engfunc(EngFunc_WriteCoord, 25)
    engfunc(EngFunc_WriteCoord, random_num(-25, 25))
    engfunc(EngFunc_WriteCoord, random_num(-25, 25))
    engfunc(EngFunc_WriteCoord, 5)
    write_byte(5)
    write_short(g_pecah)
    write_byte(10)
    write_byte(17)
    write_byte(0x00)
    message_end()
   
    fake_smokes(origin3)
    engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall2, 1.0, ATTN_STATIC, 0, PITCH_NORM)
    shoot_mode[pemilix] = 0
    remove_entity(Ent)
   
    if(!is_user_alive(pemilix) || !is_user_connected(pemilix) || get_user_weapon(pemilix) != CSW_BDRIPPER || !g_had_guillotine[pemilix])
        return
   
    set_weapon_anim(pemilix, ANIM_LOST)
    set_weapons_timeidle(pemilix, CSW_BDRIPPER, 2.5)
    set_player_nextattackx(pemilix, 2.5)
    set_task(1.3, "reload2", pemilix)
    set_task(1.4, "reload", pemilix)
}
 
public reload(id)
{
    if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
        return
   
    set_weapon_anim(id, ANIM_DRAW)
}
 
public reload2(id)
{
    if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
        return
   
    set_weapon_anim(id, ANIM_IDLE_SHOOT2)
}
 
public balik(Ent)
{
    if(!pev_valid(Ent))
        return
    static id
    id = pev(Ent, pev_iuser1)
    set_weapon_anim(id, ANIM_CATCH)
    emit_sound(id, CHAN_WEAPON, weapon_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
    set_weapons_timeidle(id, CSW_BDRIPPER, 1.0)
    set_player_nextattackx(id, 1.0)
    shoot_mode[id] = 0
    g_guillotine_ammo[id]++
    update_ammo(id)
   
    remove_entity(Ent)
}
 
public Damage_guillotine(Ent, Id)
{
    static Owner; Owner = pev(Ent, pev_iuser1)
    static Attacker;
    if(!is_user_alive(Owner))
    {
        Attacker = 0
        return
    } else Attacker = Owner
 
    new bool:bIsHeadShot; // never make that one static
    new Float:flAdjustedDamage, bool:death
       
    switch( Get_MissileWeaponHitGroup(Ent) )
    {
        case HIT_GENERIC: flAdjustedDamage = DAMAGE * 1.0
        case HIT_STOMACH: flAdjustedDamage = DAMAGE * 1.2
        case HIT_LEFTLEG, HIT_RIGHTLEG: flAdjustedDamage = DAMAGE * 1.0
        case HIT_LEFTARM, HIT_RIGHTARM: flAdjustedDamage = DAMAGE * 1.0
        case HIT_HEAD, HIT_CHEST:
        {
            flAdjustedDamage = DAMAGE * 3.0
            bIsHeadShot = true
            if(headshot_mode[Owner] == 0) set_task(2.0, "balik_bro", Ent+1858941 )
            headshot_mode[Owner] = 1
            headshot_korban[Id] = 1
            guillotine_korban[Id] = Ent
            set_pev(Ent, pev_iuser2, Id)
            set_pev(Ent, pev_sequence, 1)
            set_pev(Ent, pev_solid, SOLID_NOT)
            set_pev(Ent, pev_fuser3, 0.0)
        }
    }
    if(pev(Id, pev_health) <= flAdjustedDamage) death = true
   
    if(is_user_alive(Id))
    {
        if( bIsHeadShot && death)
        {
            if(task_exists( Ent+1858941 )) remove_task( Ent + 1858941 )
            set_pev(Ent, pev_sequence, 0)
            headshot_korban[pev(Ent, pev_iuser2)] = 0
            headshot_mode[Owner] = 0
            shoot_ent_mode[Owner] = 1
            ent_sentuh[Owner] = 1
            ent_sentuh_balik[Owner] = 0
            set_pev(Ent, pev_solid, SOLID_BBOX)
            set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
   
            kill(Attacker, Id, 1)
           
            death = false          
        }
        if(death)
        {
            kill(Attacker, Id, 0)
           
            death = false          
        }
        else ExecuteHamB(Ham_TakeDamage, Id, Ent, Attacker, flAdjustedDamage, DMG_BULLET)
    }
}
 
public balik_bro(Ent)
{
    Ent -= 1858941
   
    if(!pev_valid(Ent))
        return
   
    static pemilix; pemilix = pev(Ent, pev_iuser1)
    set_pev(Ent, pev_sequence, 0)
    headshot_korban[pev(Ent, pev_iuser2)] = 0
    headshot_mode[pemilix] = 0
    shoot_ent_mode[pemilix] = 1
    ent_sentuh[pemilix] = 1
    ent_sentuh_balik[pemilix] = 0
    set_pev(Ent, pev_solid, SOLID_BBOX)
    set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
}
 
public fw_SetModel(entity, model[])
{
    if(!pev_valid(entity))
        return FMRES_IGNORED
   
    static Classname[64]
    pev(entity, pev_classname, Classname, sizeof(Classname))
   
    if(!equal(Classname, "weaponbox"))
        return FMRES_IGNORED
   
    static id
    id = pev(entity, pev_owner)
   
    if(equal(model, old_w_model))
    {
        static weapon
        weapon = fm_get_user_weapon_entity(entity, CSW_BDRIPPER)
       
        if(!pev_valid(weapon))
            return FMRES_IGNORED
       
        if(g_had_guillotine[id])
        {
            set_pev(weapon, pev_impulse, WEAPON_SECRETCODE)
            set_pev(weapon, pev_iuser4, g_guillotine_ammo[id])
            engfunc(EngFunc_SetModel, entity, w_model)
           
            g_had_guillotine[id] = 0
            g_guillotine_ammo[id] = 0
           
            return FMRES_SUPERCEDE
        }
    }
 
    return FMRES_IGNORED;
}
 
public fw_AddToPlayer_Post(ent, id)
{
    if(pev(ent, pev_impulse) == WEAPON_SECRETCODE)
    {
        g_had_guillotine[id] = 1
        g_guillotine_ammo[id] = pev(ent, pev_iuser4)
       
        set_pev(ent, pev_impulse, 0)
    }          
   
    message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
    write_string((g_had_guillotine[id] == 1 ? "weapon_guillotine" : "weapon_mac10"))
    write_byte(6)
    write_byte(100)
    write_byte(-1)
    write_byte(-1)
    write_byte(0)
    write_byte(13)
    write_byte(CSW_BDRIPPER)
    write_byte(0)
    message_end()
}
 
public update_ammo(id)
{
    if(!is_user_alive(id))
        return
 
    static weapon_ent; weapon_ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
    if(!pev_valid(weapon_ent)) return
   
    cs_set_weapon_ammo(weapon_ent, g_guillotine_ammo[id])  
    cs_set_user_bpammo(id, CSW_BDRIPPER, g_guillotine_ammo[id])
   
    engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
    write_byte(1)
    write_byte(CSW_BDRIPPER)
    write_byte(-1)
    message_end()
   
    message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id)
    write_byte(1)
    write_byte(g_guillotine_ammo[id])
    message_end()
}
 
public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id,ptr)
{
    if(!is_user_alive(id))
        return HAM_IGNORED 
    if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
        return HAM_IGNORED
 
    // get crosshair aim
    static Float:aim[3];
    get_aim(id,v1,aim);
   
    // do another trace to this spot
    new trace = create_tr2();
    engfunc(EngFunc_TraceLine,v1,aim,noMonsters,id,trace);
   
    // copy ints
    set_tr2(ptr,TR_AllSolid,get_tr2(trace,TR_AllSolid));
    set_tr2(ptr,TR_StartSolid,get_tr2(trace,TR_StartSolid));
    set_tr2(ptr,TR_InOpen,get_tr2(trace,TR_InOpen));
    set_tr2(ptr,TR_InWater,get_tr2(trace,TR_InWater));
    set_tr2(ptr,TR_pHit,get_tr2(trace,TR_pHit));
    set_tr2(ptr,TR_iHitgroup,get_tr2(trace,TR_iHitgroup));
 
    // copy floats
    get_tr2(trace,TR_flFraction,aim[0]);
    set_tr2(ptr,TR_flFraction,aim[0]);
    get_tr2(trace,TR_flPlaneDist,aim[0]);
    set_tr2(ptr,TR_flPlaneDist,aim[0]);
   
    // copy vecs
    get_tr2(trace,TR_vecEndPos,aim);
    set_tr2(ptr,TR_vecEndPos,aim);
    get_tr2(trace,TR_vecPlaneNormal,aim);
    set_tr2(ptr,TR_vecPlaneNormal,aim);
 
    // get rid of new trace
    free_tr2(trace);
 
    return FMRES_IGNORED;
}
 
get_aim(id,Float:source[3],Float:ret[3])
{
    static Float:vAngle[3], Float:pAngle[3], Float:dir[3], Float:temp[3];
 
    // get aiming direction from forward global based on view angle and punch angle
    pev(id,pev_v_angle,vAngle);
    pev(id,pev_punchangle,pAngle);
    xs_vec_add(vAngle,pAngle,temp);
    engfunc(EngFunc_MakeVectors,temp);
    global_get(glb_v_forward,dir);
   
    /* vecEnd = vecSrc + vecDir * flDistance; */
    xs_vec_mul_scalar(dir,8192.0,temp);
    xs_vec_add(source,temp,ret);
}
 
public fake_smokes(Float:Origin[3])
{
    static TE_FLAG
   
    TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG |= TE_EXPLFLAG_NOSOUND
    TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
   
    engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
    write_byte(TE_EXPLOSION)
    engfunc(EngFunc_WriteCoord, Origin[0])
    engfunc(EngFunc_WriteCoord, Origin[1])
    engfunc(EngFunc_WriteCoord, Origin[2])
    write_short(g_smokepuff_id)
    write_byte(6)
    write_byte(25)
    write_byte(TE_FLAG)
    message_end()
}
 
stock set_weapon_anim(id, anim)
{
    if(!is_user_alive(id))
        return
   
    set_pev(id, pev_weaponanim, anim)
   
    message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
    write_byte(anim)
    write_byte(pev(id, pev_body))
    message_end()
}
 
stock kill(k, v, headshot)
{
    cs_set_user_money(k, cs_get_user_money(k) + 500)
   
    set_user_frags(k, get_user_frags(k) + 1)
   
    set_msg_block(g_MsgDeathMsg,BLOCK_ONCE)
    set_msg_block(gmsgScoreInfo,BLOCK_ONCE)
    user_kill(v,1)
   
    new kteam = get_user_team(k);
    new vteam = get_user_team(v);
   
    new kfrags = get_user_frags(k);
    new kdeaths = get_user_deaths(k);
   
    new vfrags = get_user_frags(v);
    new vdeaths = get_user_deaths(v);
   
    emessage_begin(MSG_ALL, gmsgScoreInfo);
    ewrite_byte(k);
    ewrite_short(kfrags);
    ewrite_short(kdeaths);
    ewrite_short(0);
    ewrite_short(kteam);
    emessage_end();
   
    emessage_begin(MSG_ALL, gmsgScoreInfo);
    ewrite_byte(v);
    ewrite_short(vfrags);
    ewrite_short(vdeaths);
    ewrite_short(0);
    ewrite_short(vteam);
    emessage_end();
   
    emessage_begin(MSG_BROADCAST, g_MsgDeathMsg)
    ewrite_byte(k)
    ewrite_byte(v)
    ewrite_byte(headshot)
    ewrite_string("Blood Dripper")
    emessage_end()
}
 
 
stock create_blood(const Float:origin[3])
{
    // Show some blood :)
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_BLOODSPRITE)
    engfunc(EngFunc_WriteCoord, origin[0])
    engfunc(EngFunc_WriteCoord, origin[1])
    engfunc(EngFunc_WriteCoord, origin[2])
    write_short(m_iBlood[1])
    write_short(m_iBlood[0])
    write_byte(75)
    write_byte(8)
    message_end()
}
 
stock drop_weapons(id, dropwhat)
{
    static weapons[32], num, i, weaponid
    num = 0
    get_user_weapons(id, weapons, num)
     
    for (i = 0; i < num; i++)
    {
        weaponid = weapons[i]
         
        if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
        {
            static wname[32]
            get_weaponname(weaponid, wname, sizeof wname - 1)
            engclient_cmd(id, "drop", wname)
        }
    }
}
 
stock Get_MissileWeaponHitGroup( iEnt )
{
    new Float:flStart[ 3 ], Float:flEnd[ 3 ];
   
    pev( iEnt, pev_origin, flStart );
    pev( iEnt, pev_velocity, flEnd );
    xs_vec_add( flStart, flEnd, flEnd );
   
    new ptr = create_tr2();
    engfunc( EngFunc_TraceLine, flStart, flEnd, 0, iEnt, ptr );
   
    new iHitGroup, Owner, nOhead, head
    Owner = pev(iEnt, pev_iuser1)
    nOhead = get_tr2( ptr, TR_iHitgroup )
    head = set_tr2( ptr, TR_iHitgroup, HIT_HEAD )
   
    iHitGroup = headshot_mode[Owner] ? head : nOhead
   
    free_tr2( ptr );
   
    return iHitGroup;
}
 
stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
{
    new_velocity[0] = origin2[0] - origin1[0]
    new_velocity[1] = origin2[1] - origin1[1]
    new_velocity[2] = origin2[2] - origin1[2]
    static Float:num; num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    new_velocity[0] *= num
    new_velocity[1] *= num
    new_velocity[2] *= num
   
    return 1;
}
 
stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
{
    static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
   
    pev(id, pev_origin, vOrigin)
    pev(id, pev_view_ofs, vUp) //for player
    xs_vec_add(vOrigin, vUp, vOrigin)
    pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
   
    angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward) //or use EngFunc_AngleVectors
    angle_vector(vAngle, ANGLEVECTOR_RIGHT, vRight)
    angle_vector(vAngle, ANGLEVECTOR_UP, vUp)
   
    vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
    vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
    vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}
 
stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
{
    if(!is_user_alive(id))
        return
       
    static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
    if(!pev_valid(entwpn))
        return
       
    set_pdata_float(entwpn, 48, TimeIdle + 0.2, OFFSET_LINUX_WEAPONS)
}
 
stock set_player_nextattackx(id, Float:nexttime)
{
    if(!is_user_alive(id))
        return
       
    set_pdata_float(id, 83, nexttime, 5)
}
My Steam:
Image

NOVA
Member
Member
Great Britain
Posts: 16
Joined: 3 Months Ago
Has thanked: 1 time
Been thanked: 1 time
Contact:

#4

Post by NOVA » 2 Months Ago

try this Code and Replace the Older one , i did not tested
  1. public fw_AddToPlayer_Post(ent, id)
  2. {
  3.     if(pev(ent, pev_impulse) == WEAPON_SECRETCODE)
  4.     {
  5.         g_had_guillotine[id] = 1
  6.         g_guillotine_ammo[id] = pev(ent, pev_iuser4)
  7.        
  8.         set_pev(ent, pev_impulse, 0)
  9.     }          
  10.    
  11.     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  12.     write_string((g_had_guillotine[id] == 1 ? "weapon_guillotine" : "weapon_knife")) // Here Changed
  13.     write_byte(6)
  14.     write_byte(100)
  15.     write_byte(-1)
  16.     write_byte(-1)
  17.     write_byte(2) // Here i think need to Change
  18.     write_byte(0)
  19.     write_byte(CSW_BDRIPPER)
  20.     write_byte(0)
  21.     message_end()
  22. }

ngamerz
Member
Member
Philippines
Posts: 21
Joined: 4 Months Ago
Location: Philippines From South Korea
Has thanked: 1 time
Been thanked: 3 times
Contact:

#5

Post by ngamerz » 2 Months Ago

Still have bugs, like throwing it. The default knife sounds still intacts and the throw animation doesnt play.
My Steam:
Image

User avatar
Evillious Energy
Member
Member
Nepal
Posts: 6
Joined: 8 Months Ago
Has thanked: 2 times
Been thanked: 0
Contact:

#6

Post by Evillious Energy » 2 Months Ago

a
Last edited by Evillious Energy on 20 Feb 2021, 09:13, edited 2 times in total.

User avatar
Evillious Energy
Member
Member
Nepal
Posts: 6
Joined: 8 Months Ago
Has thanked: 2 times
Been thanked: 0
Contact:

#7

Post by Evillious Energy » 2 Months Ago

Evillious Energy wrote:
2 Months Ago
ngamerz wrote:
2 Months Ago
Still have bugs, like throwing it. The default knife sounds still intacts and the throw animation doesnt play.
I have better guillotine menu but i can't share now after a person server which i work for bring updates of that then i may share but not sure :P

ngamerz
Member
Member
Philippines
Posts: 21
Joined: 4 Months Ago
Location: Philippines From South Korea
Has thanked: 1 time
Been thanked: 3 times
Contact:

#8

Post by ngamerz » 1 Month Ago

Evillious Energy wrote:
2 Months Ago
Evillious Energy wrote:
2 Months Ago
ngamerz wrote:
2 Months Ago
Still have bugs, like throwing it. The default knife sounds still intacts and the throw animation doesnt play.
I have better guillotine menu but i can't share now after a person server which i work for bring updates of that then i may share but not sure :P
Hmmmm... Try this one
Note: I did test it on my custom made zombie escape server. I'm not sure about escapers version, but surely it will work.

You don't have to use MultiPower CS Menu, just use this one and it's ready to use. If there's bugs, report it to me

Video: Guillotine Test

EDIT: Lol, i've just bump and answered my own thread.

Code: Select all

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <amxmisc>
#include <zombie_escape>

#define PLUGIN "[ZE] Blood-Dripper"
#define VERSION "1.6"
#define AUTHOR "DemonSlayerCS" // Edited to use Knife Slot

#define CSW_BDRIPPER CSW_KNIFE
#define weapon_guillotine "weapon_mac10"
#define old_event "events/mac10.sc"
#define old_w_model "models/w_mac10.mdl"
#define WEAPON_SECRETCODE 1329419

const pev_catchedspeed = pev_iuser4
#define DEFAULT_AMMO 10
#define DAMAGE 30
#define BDRIP_CLASSNAME "Blood Dripper"
#define WEAPON_ANIMEXT "knife"

#define Get_Ent_Data(%1,%2) get_pdata_int(%1,%2,4)
#define Set_Ent_Data(%1,%2,%3) set_pdata_int(%1,%2,%3,4)

const PDATA_SAFE = 2
const OFFSET_LINUX_WEAPONS = 4
const OFFSET_WEAPONOWNER = 41
const m_flNextAttack = 83
const m_szAnimExtention = 492

new const v_model[] = "models/v_guillotine.mdl"
new const p_model[] = "models/p_guillotine.mdl"
new const w_model[] = "models/w_guillotine.mdl"
new const KNIFE_MODEL[] = "models/guillotine_projectile.mdl"
new const PECAH_MODEL[] = "models/gibs_guilotine.mdl"
new const hit_wall[] = "weapons/janus9_stone1.wav"
new const hit_wall2[] = "weapons/janus9_stone2.wav"
new const weapon_sound[6][] = 
{
	"weapons/guillotine_catch2.wav",
	"weapons/guillotine_draw.wav",
	"weapons/guillotine_draw_empty.wav",
	"weapons/guillotine_explode.wav",
	"weapons/guillotine_red.wav",
	"weapons/guillotine-1.wav"
}


new const WeaponResource[3][] = 
{
	"sprites/weapon_guillotine.txt",
	"sprites/640hud120.spr",
	"sprites/guillotine_lost.spr"
}

enum
{
	ANIM_IDLE = 0,
	ANIM_IDLE_EMPTY,
	ANIM_SHOOT,
	ANIM_DRAW,
	ANIM_DRAW_EMPTY,
	ANIM_IDLE_SHOOT,
	ANIM_IDLE_SHOOT2,
	ANIM_CATCH,
	ANIM_LOST
}

new g_MsgDeathMsg, g_endround

new g_had_guillotine[33], g_guillotine_ammo[33], shoot_mode[33], shoot_ent_mode[33], g_pecah, headshot_mode[33], ent_sentuh[33], ent_sentuh_balik[33]
new g_old_weapon[33], g_smokepuff_id, m_iBlood[2], guillotine_korban[33], headshot_korban[33], gmsgScoreInfo
new g_iItemID

const PRIMARY_WEAPONS_BIT_SUM = 
(1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<
CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_SetModel, "fw_SetModel")
	register_think(BDRIP_CLASSNAME, "fw_Think")
	register_touch(BDRIP_CLASSNAME, "*", "fw_touch")
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	register_forward(FM_TraceLine, "fw_traceline", 1)
	register_forward(FM_AddToFullPack, "fm_addtofullpack_post", 1)
	RegisterHam(Ham_Weapon_WeaponIdle, weapon_guillotine, "fw_guillotineidleanim", 1)
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	RegisterHam(Ham_Item_AddToPlayer, weapon_guillotine, "fw_AddToPlayer_Post", 1)
	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
	
	register_clcmd("weapon_guillotine", "hook_weapon")
	
	g_MsgDeathMsg = get_user_msgid("DeathMsg")
	gmsgScoreInfo = get_user_msgid("ScoreInfo")
	g_endround = 1
	
	g_iItemID = ze_register_item("Blood-Dripper", 20, 0)
}

public plugin_precache()
{
	precache_model(v_model)
	precache_model(p_model)
	precache_model(w_model)
	precache_model(KNIFE_MODEL)
	g_pecah = precache_model(PECAH_MODEL)
	precache_sound(hit_wall)
	precache_sound(hit_wall2)
	
	for(new i = 0; i < sizeof(weapon_sound); i++) 
		precache_sound(weapon_sound[i])
	
	for(new i = 1; i < sizeof(WeaponResource); i++)
		precache_model(WeaponResource[i])
	
	g_smokepuff_id = engfunc(EngFunc_PrecacheModel, WeaponResource[2])
	m_iBlood[0] = precache_model("sprites/blood.spr")
	m_iBlood[1] = precache_model("sprites/bloodspray.spr")	
}

public ze_user_infected(id)
{
	remove_guillotine(id)
}

public fw_PlayerKilled(id)
{
	remove_guillotine(id)
}

public hook_weapon(id)
{
	engclient_cmd(id, weapon_guillotine)
	return
}

public ze_select_item_pre(id, itemid)
{
    // This not our item?
    if (itemid != g_iItemID)
        return ZE_ITEM_AVAILABLE
   
    // Available for Humans only, So don't show it for zombies
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
   
    // Finally return that it's available
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(id, itemid)
{
    // This is not our item, Block it here and don't execute the blew code
    if (itemid != g_iItemID)
        return
   
    get_guillotine(id)
}

public get_guillotine(id)
{
	if(!is_user_alive(id))
		return
	drop_weapons(id, 1)
	g_had_guillotine[id] = 1
	g_guillotine_ammo[id] = DEFAULT_AMMO
	
	give_item(id, weapon_guillotine)
	update_ammo(id)
	
	//static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, weapon_guillotine, id)
	//if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)
}

public remove_guillotine(id)
{
	g_had_guillotine[id] = 0
	static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	ancur(Ent)
}

public refill_guillotine(id)
{	
	if(g_had_guillotine[id]) g_guillotine_ammo[id] = 15
	
	if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id]) update_ammo(id)
}
	
public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
	if(!is_user_alive(id) || !is_user_connected(id))
		return FMRES_IGNORED	
	if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001) 
	
	return FMRES_HANDLED
}

public message_DeathMsg(msg_id, msg_dest, id)
{
   static szTruncatedWeapon[33], iAttacker, iVictim
   
   get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
   
   iAttacker = get_msg_arg_int(1)
   iVictim = get_msg_arg_int(2)
   
   if(!is_user_connected(iAttacker) || iAttacker == iVictim) return PLUGIN_CONTINUE
   
   if(get_user_weapon(iAttacker) == CSW_BDRIPPER)
   {
      if(g_had_guillotine[iAttacker])
         set_msg_arg_string(4, "knife")
   }
   
   return PLUGIN_CONTINUE
}

public fw_TraceAttack_Sg(Victim, Attacker, Float:Damage, Float:Direction[3], TraceHandle, DamageBit, ptr)
{         
   return HAM_IGNORED
}

public Event_CurWeapon(id)
{
	if(!is_user_alive(id))
		return
		
	if(get_user_weapon(id) == CSW_BDRIPPER && g_had_guillotine[id])
	{
		set_pev(id, pev_viewmodel2, v_model)
		set_pev(id, pev_weaponmodel2, p_model)
		set_pdata_string(id, m_szAnimExtention * 4, WEAPON_ANIMEXT, -1 , 20)
		if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] >= 1) set_weapon_anim(id, ANIM_DRAW)
		
		if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] == 0 && headshot_mode[id] == 0) set_weapon_anim(id, ANIM_DRAW_EMPTY)
		if(g_old_weapon[id] != CSW_BDRIPPER && g_guillotine_ammo[id] == 0) set_weapon_anim(id, ANIM_DRAW_EMPTY)
		update_ammo(id)
	}
	
	g_old_weapon[id] = get_user_weapon(id)
}

public fw_guillotineidleanim(Weapon)
{
	new id = get_pdata_cbase(Weapon, 41, 4)

	if(!is_user_alive(id) || ze_is_user_zombie(id)(id) || !g_had_guillotine[id] || get_user_weapon(id) != CSW_BDRIPPER)
		return HAM_IGNORED;
	
	if(shoot_mode[id] == 0 && g_guillotine_ammo[id] >= 1) 
		return HAM_SUPERCEDE;
	
	if(headshot_mode[id] == 0 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25) 
	{
		set_weapon_anim(id, ANIM_IDLE_SHOOT)
		set_pdata_float(Weapon, 48, 20.0, 4)
		return HAM_SUPERCEDE;
	}
	
	if(headshot_mode[id] == 1 && shoot_mode[id] == 1 && get_pdata_float(Weapon, 48, 4) <= 0.25) 
	{
		set_weapon_anim(id, ANIM_IDLE_SHOOT2)
		set_pdata_float(Weapon, 48, 20.0, 4)
		return HAM_SUPERCEDE;
	}
	
	if(g_guillotine_ammo[id] == 0 && get_pdata_float(Weapon, 48, 4) <= 0.25) 
	{
		set_weapon_anim(id, ANIM_IDLE_EMPTY)
		set_pdata_float(Weapon, 48, 20.0, 4)
		return HAM_SUPERCEDE;
	}

	return HAM_IGNORED;
}

public fw_CmdStart(id, uc_handle, seed)
{
	if(!is_user_alive(id) || !is_user_connected(id))
		return
	if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
		return
	
	static ent; ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
	//if(!pev_valid(ent))
	//	return
	if(get_pdata_float(ent, 46, OFFSET_LINUX_WEAPONS) > 0.0 || get_pdata_float(ent, 47, OFFSET_LINUX_WEAPONS) > 0.0) 
		return
	
	static CurButton
	CurButton = get_uc(uc_handle, UC_Buttons)
	
	if(CurButton & IN_ATTACK)
	{
		CurButton &= ~IN_ATTACK
		set_uc(uc_handle, UC_Buttons, CurButton)
		
		//if(g_guillotine_ammo[id] == 0)
		//	return
		if(shoot_mode[id] == 0 && get_pdata_float(id, 83, 5) <= 0.0)
		{
			//g_guillotine_ammo[id]--
			//update_ammo(id)
			shoot_mode[id] = 1
			FireKnife(id)
			set_weapon_anim(id, ANIM_SHOOT)
			emit_sound(id, CHAN_WEAPON, weapon_sound[5], 1.0, ATTN_NORM, 0, PITCH_NORM)
			set_weapons_timeidle(id, CSW_BDRIPPER, 0.7)
			set_player_nextattackx(id, 0.7)
		}
	}
}

public FireKnife(id)
{
	static Float:StartOrigin[3], Float:velocity[3], Float:angles[3], Float:anglestrue[3], Float:jarak_max[3]
	get_position(id, 2.0, 0.0, 0.0, StartOrigin)
	get_position(id, 700.0, 0.0, 0.0, jarak_max)
	
	pev(id,pev_v_angle,angles)
	static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	if(!pev_valid(Ent)) return
	anglestrue[0] = 360.0 - angles[0]
	anglestrue[1] = angles[1]
	anglestrue[2] = angles[2]
	
	// Set info for ent
	set_pev(Ent, pev_movetype, MOVETYPE_FLY)
	set_pev(Ent, pev_owner, id)
	set_pev(Ent, pev_iuser1, id)
	set_pev(Ent, pev_fuser1, get_gametime() + 4.0)
	set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
	
	entity_set_string(Ent, EV_SZ_classname, BDRIP_CLASSNAME)
	engfunc(EngFunc_SetModel, Ent, KNIFE_MODEL)
	set_pev(Ent, pev_mins, Float:{-1.0, -1.0, -1.0})
	set_pev(Ent, pev_maxs, Float:{1.0, 1.0, 1.0})
	set_pev(Ent, pev_origin, StartOrigin)
	set_pev(Ent, pev_angles, anglestrue)
	set_pev(Ent, pev_gravity, 0.01)
	set_pev(Ent, pev_solid, SOLID_BBOX)
	set_pev(Ent, pev_frame, 1.0)
	set_pev(Ent, pev_framerate, 30.0)
	set_pev(Ent, pev_sequence, 0)
	
	//ExecuteHamB(Ham_Weapon_PrimaryAttack, ent)
	set_pev(Ent, pev_catchedspeed, 1100)
	velocity_by_aim( id, 1400, velocity )
	set_pev( Ent, pev_velocity, velocity )
	set_pev(Ent, pev_vuser1, velocity)
	set_pev(Ent, pev_vuser2, jarak_max)
	shoot_ent_mode[id] = 0
	set_pev(Ent, pev_iuser4, 0)
	ent_sentuh[id] = 1
	ent_sentuh_balik[id] = 0
}

public fm_addtofullpack_post(es, e, user, host, host_flags, player, p_set)
{
	if(!player)
		return FMRES_IGNORED
		
	if(!is_user_connected(host) || !is_user_alive(user))
		return FMRES_IGNORED
		
	if(!zp_get_user_zombie(user) || headshot_korban[user] != 1)
		return FMRES_IGNORED
		
	if(host == user)
		return FMRES_IGNORED
	
	new Float:PlayerOrigin[3]//, Float:anglesss[3]
	pev(user, pev_origin, PlayerOrigin)
	
	PlayerOrigin[2] += 25.0
	
	//engfunc(EngFunc_GetBonePosition, user, 8, PlayerOrigin, anglesss)
   
	engfunc(EngFunc_SetOrigin, guillotine_korban[user], PlayerOrigin)
   
	return FMRES_HANDLED
}

public fw_Think(Ent)
{
	if(!pev_valid(Ent)) 
		return
	
	//new id; id = pev(Ent, pev_owner)
	static Float:pulang[3], Float:StartOriginz[3], pemilix, Float:brangkat[3], Float:jarak_max[3], Float:origin_asli[3], korban
	pemilix = pev(Ent, pev_iuser1)
	pev(Ent, pev_origin, StartOriginz)
	korban = pev(Ent, pev_iuser2)
	
	if(headshot_korban[korban] == 1)
	{
		action_thanatos(Ent, korban, pemilix)
		if(get_gametime() - 0.2 > pev(Ent, pev_fuser3))
		{
			Damage_guillotine(Ent, korban)
		}
	}
	
	if(ent_sentuh_balik[pemilix] == 0 && shoot_ent_mode[pemilix] == 1)
	{
		ent_sentuh_balik[pemilix] = 1
		pev(pemilix, pev_origin, origin_asli)
		origin_asli[2] += 0.1
	}
	
	if(ent_sentuh[pemilix] == 1)
	{
		ent_sentuh[pemilix] = 0
		pev(Ent, pev_vuser2, jarak_max)
		pev(Ent, pev_vuser1, brangkat)
		get_speed_vector(StartOriginz, origin_asli, 1400.0, pulang)
					
		if(shoot_ent_mode[pemilix] == 1)
		{
			set_pev(Ent, pev_velocity, pulang)
		}
		else set_pev(Ent, pev_velocity, brangkat)
	}
	
	if(shoot_ent_mode[pemilix] == 0 && get_distance_f(StartOriginz, jarak_max) <= 10.0)
	{
		shoot_ent_mode[pemilix] = 1
		ent_sentuh[pemilix] = 1
		set_pev(Ent, pev_owner, 0)
	}
	
	if(shoot_ent_mode[pemilix] == 1 && get_distance_f(StartOriginz, origin_asli) <= 40.0)
	{
		if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
		else ancur(Ent)
		//balik(Ent)
	}
	else if(headshot_korban[korban] == 1) set_pev(Ent, pev_nextthink, get_gametime() + 0.2)
	else set_pev(Ent, pev_nextthink, halflife_time() + 0.001)
}

stock get_speed_vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
{
   new_velocity[0] = origin2[0] - origin1[0]
   new_velocity[1] = origin2[1] - origin1[1]
   new_velocity[2] = origin2[2] - origin1[2]
   static Float:num; num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
   new_velocity[0] *= num
   new_velocity[1] *= num
   new_velocity[2] *= num
   
   return 1;
}

stock hook_ent(victim, attacker, Float:speed)
{
   if(!pev_valid(victim) || !pev_valid(attacker))
      return
   
   static Float:fl_Velocity[3]
   static Float:EntOrigin[3], Float:VicOrigin[3]
   
   pev(victim, pev_origin, EntOrigin)
   pev(attacker, pev_origin, VicOrigin)
   
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   
   if (distance_f > 60.0)
   {
      new Float:fl_Time = distance_f / speed
      
      fl_Velocity[0] = (VicOrigin[0] - EntOrigin[0]) / fl_Time
      fl_Velocity[1] = (VicOrigin[1] - EntOrigin[1]) / fl_Time
      fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time
      } else {
      fl_Velocity[0] = 0.0
      fl_Velocity[1] = 0.0
      fl_Velocity[2] = 0.0
   }
   
   entity_set_vector(victim, EV_VEC_velocity, fl_Velocity)
}

stock hook_ent2(ent, Float:VicOrigin[3], Float:speed, type)
{
   static Float:fl_Velocity[3]
   static Float:EntOrigin[3]
   static Float:EntVelocity[3]
   
   pev(ent, pev_velocity, EntVelocity)
   pev(ent, pev_origin, EntOrigin)
   static Float:distance_f
   distance_f = get_distance_f(EntOrigin, VicOrigin)
   
   static Float:fl_Time; fl_Time = distance_f / speed
   
   if(type == 1)
   {
      fl_Velocity[0] = ((VicOrigin[0] - EntOrigin[0]) / fl_Time) * 1.5
      fl_Velocity[1] = ((VicOrigin[1] - EntOrigin[1]) / fl_Time)
      fl_Velocity[2] = (VicOrigin[2] - EntOrigin[2]) / fl_Time      
      } else if(type == 2) {
      fl_Velocity[0] = ((EntOrigin[0] - VicOrigin[0]) / fl_Time) * 1.5
      fl_Velocity[1] = ((EntOrigin[1] - VicOrigin[1]) / fl_Time) 
      fl_Velocity[2] = (EntOrigin[2] - VicOrigin[2]) / fl_Time
   }
   
   xs_vec_add(EntVelocity, fl_Velocity, fl_Velocity)
   set_pev(ent, pev_velocity, fl_Velocity)
}

public fw_touch(Ent, Id)
{
	// If ent is valid
	if(!pev_valid(Ent))
		return
	if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
		return
	static classnameptd[32]
	pev(Id, pev_classname, classnameptd, 31)
	if (equali(classnameptd, "func_breakable")) ExecuteHamB( Ham_TakeDamage, Id, 0, 0, 80.0, DMG_GENERIC )
	
	// Get it's origin
	new Float:originF[3], pemilix
	pemilix = pev(Ent, pev_iuser1)
	pev(Ent, pev_origin, originF)
	// Alive...
	
	if(is_user_alive(Id) && ze_is_user_zombie(Id))
	{
		Damage_guillotine(Ent, Id)
		set_pev(Ent, pev_owner, Id)
		ent_sentuh[pemilix] = 1
		create_blood(originF)
		create_blood(originF)
	}
	
	else if(shoot_ent_mode[pemilix] == 1 && Id == pemilix)
	{
		if(is_user_alive(pemilix) && is_user_connected(pemilix) && get_user_weapon(pemilix) == CSW_BDRIPPER && g_had_guillotine[pemilix]) balik(Ent)
		else ancur(Ent)
	}
	
	else if(is_user_alive(Id) && !ze_is_user_zombie(Id))
	{
		set_pev(Ent, pev_owner, Id)
		ent_sentuh[pemilix] = 1
	}
	
	else
	{
		set_pev(Ent, pev_owner, 0)

		if(shoot_ent_mode[pemilix] == 0)
		{
			shoot_ent_mode[pemilix] = 1
			engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall, 1.0, ATTN_STATIC, 0, PITCH_NORM)
			ent_sentuh[pemilix] = 1
		}
		else ancur(Ent)
	}
}

public ancur(Ent)
{
	if(!pev_valid(Ent))
		return
	static Float:origin2[3], pemilix, Float:origin3[3]
	pemilix = pev(Ent, pev_iuser1)
	entity_get_vector(Ent, EV_VEC_origin, origin2)
	pev(Ent, pev_origin, origin3)
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2, 0)
	write_byte(TE_BREAKMODEL)
	engfunc(EngFunc_WriteCoord, origin2[0])
	engfunc(EngFunc_WriteCoord, origin2[1])
	engfunc(EngFunc_WriteCoord, origin2[2])
	engfunc(EngFunc_WriteCoord, 25)
	engfunc(EngFunc_WriteCoord, 25)
	engfunc(EngFunc_WriteCoord, 25)
	engfunc(EngFunc_WriteCoord, random_num(-25, 25))
	engfunc(EngFunc_WriteCoord, random_num(-25, 25))
	engfunc(EngFunc_WriteCoord, 5)
	write_byte(5)
	write_short(g_pecah)
	write_byte(10)
	write_byte(17)
	write_byte(0x00)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin2, 0)
	write_byte(TE_BREAKMODEL)
	engfunc(EngFunc_WriteCoord, origin2[0])
	engfunc(EngFunc_WriteCoord, origin2[1])
	engfunc(EngFunc_WriteCoord, origin2[2])
	engfunc(EngFunc_WriteCoord, 25)
	engfunc(EngFunc_WriteCoord, 25)
	engfunc(EngFunc_WriteCoord, 25)
	engfunc(EngFunc_WriteCoord, random_num(-25, 25))
	engfunc(EngFunc_WriteCoord, random_num(-25, 25))
	engfunc(EngFunc_WriteCoord, 5)
	write_byte(5)
	write_short(g_pecah)
	write_byte(10)
	write_byte(17)
	write_byte(0x00)
	message_end()
	
	//fake_smokes(origin3)
	engfunc(EngFunc_EmitSound, Ent, CHAN_WEAPON, hit_wall2, 1.0, ATTN_STATIC, 0, PITCH_NORM)
	shoot_mode[pemilix] = 0
	remove_entity(Ent)
	
	if(!is_user_alive(pemilix) || !is_user_connected(pemilix) || get_user_weapon(pemilix) != CSW_BDRIPPER || !g_had_guillotine[pemilix])
		return
	
	set_weapon_anim(pemilix, ANIM_LOST)
	set_weapons_timeidle(pemilix, CSW_BDRIPPER, 2.5)
	set_player_nextattackx(pemilix, 2.5)
	set_task(1.3, "reload2", pemilix)
	set_task(1.4, "reload", pemilix)
}

public geri_tepme2(Owner, Id)
{ 
   static Float:StartOrigin[3], Float:TargetOrigin[3]
   get_position(Owner, 0.0, 0.0, 0.0, StartOrigin)
   static Float:Velocity[3]
   fm_get_aim_origin(Owner, TargetOrigin)
   get_speed_vector(StartOrigin, TargetOrigin, 2000.0, Velocity)
   set_pev(Id, pev_velocity, Velocity)
}

public action_thanatos(Ent, victim, id)
{         
   if(!pev_valid(Ent))   
      return
   
   if(headshot_mode[id] == 1)
   {
      
      //geri_tepme2(id, victim)
      
      set_task(0.01, "action_thanatos", Ent)
   }
}

public reload(id)
{
	if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
		return
	
	set_weapon_anim(id, ANIM_DRAW)
}

public reload2(id)
{
	if(!is_user_alive(id) || !is_user_connected(id) || get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id] || g_guillotine_ammo[id] == 0)
		return
	
	set_weapon_anim(id, ANIM_IDLE_SHOOT2)
}

public balik(Ent)
{
	if(!pev_valid(Ent))
		return
	static id
	id = pev(Ent, pev_iuser1)
	
	set_weapons_timeidle(id, CSW_BDRIPPER, 1.0)
	set_player_nextattackx(id, 1.0)
	shoot_mode[id] = 0
	g_guillotine_ammo[id]++
	update_ammo(id)
	set_weapon_anim(id, ANIM_CATCH)
	emit_sound(id, CHAN_WEAPON, weapon_sound[0], 1.0, ATTN_NORM, 0, PITCH_NORM) 
	remove_entity(Ent)
}

/*new Float:g_fDamageMulti[] = 
{
1.0,
1.1,
1.2,
1.3,
1.4,
1.5,
1.6,
1.7,
1.8,
1.9,
2.0,
2.1,
2.2,
2.3
}*/

public geri_tepme(Owner, Id)
{ 
   static Float:StartOrigin[3], Float:TargetOrigin[3]
   get_position(Owner, 0.0, 0.0, 0.0, StartOrigin)
   static Float:Velocity[3]
   fm_get_aim_origin(Owner, TargetOrigin)
   get_speed_vector(StartOrigin, TargetOrigin, 2000.0, Velocity)
   set_pev(Id, pev_velocity, Velocity)                    
}

public Damage_guillotine(Ent, Id)
{
	static Owner; Owner = pev(Ent, pev_iuser1)
	static Attacker; 
	if(!is_user_alive(Owner)) 
	{
		Attacker = 0
		return
	} else Attacker = Owner
	
	if(g_endround)
		return

	new bool:bIsHeadShot; // never make that one static
	new Float:flAdjustedDamage, bool:death
		
	switch( Get_MissileWeaponHitGroup(Ent) ) 
	{
		case HIT_GENERIC: flAdjustedDamage = DAMAGE * 1.0 
		case HIT_STOMACH: flAdjustedDamage = DAMAGE * 1.2 
		case HIT_LEFTLEG, HIT_RIGHTLEG: flAdjustedDamage = DAMAGE * 1.0
		case HIT_LEFTARM, HIT_RIGHTARM: flAdjustedDamage = DAMAGE * 1.0
		case HIT_HEAD, HIT_CHEST:
		{
			flAdjustedDamage = DAMAGE * 3.0
			bIsHeadShot = true
			if(headshot_mode[Owner] == 0) set_task(2.0, "balik_bro", Ent+1858941 )
			headshot_mode[Owner] = 1
			headshot_korban[Id] = 1
			guillotine_korban[Id] = Ent
			set_pev(Ent, pev_iuser2, Id)
			fakedamage(Id, "Guillotine", 1.0, 256) 
			set_pev(Ent, pev_renderamt, 255)
			set_pev(Ent, pev_solid, SOLID_NOT)
			set_pev(Ent, pev_fuser3, 0.0)
		}
	}
	if(pev(Id, pev_health) <= flAdjustedDamage) death = true 
	
	if(is_user_alive(Id))
	{
		if( bIsHeadShot && death)
		{
			if(task_exists( Ent+1858941 )) remove_task( Ent + 1858941 )
			set_pev(Ent, pev_sequence, 0)
			headshot_korban[pev(Ent, pev_iuser2)] = 0
			headshot_mode[Owner] = 0
			shoot_ent_mode[Owner] = 1
			ent_sentuh[Owner] = 1
			ent_sentuh_balik[Owner] = 0
			set_pev(Ent, pev_solid, SOLID_BBOX)
			set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
	
			kill(Attacker, Id, 1)
			
			death = false			
		}
		if(death)
		{
			kill(Attacker, Id, 0)
			
			death = false			
		}
		else ExecuteHamB(Ham_TakeDamage, Id, Ent, Attacker, flAdjustedDamage, DMG_BULLET)
	}
}

stock turn_to_target(ent, Float:Ent_Origin[3], target, Float:Vic_Origin[3]) 
{
   if(target) 
   {
      new Float:newAngle[3]
      entity_get_vector(ent, EV_VEC_angles, newAngle)
      new Float:x = Vic_Origin[0] - Ent_Origin[0]
      new Float:z = Vic_Origin[1] - Ent_Origin[1]
      
      new Float:radians = floatatan(z/x, radian)
      newAngle[1] = radians * (180 / 3.14)
      if (Vic_Origin[0] < Ent_Origin[0])
         newAngle[1] -= 180.0
      
      entity_set_vector(ent, EV_VEC_angles, newAngle)
   }
}

public balik_bro(Ent)
{
	Ent -= 1858941
	
	if(!pev_valid(Ent))
		return
	
	static pemilix; pemilix = pev(Ent, pev_iuser1)
	set_pev(Ent, pev_sequence, 0)
	headshot_korban[pev(Ent, pev_iuser2)] = 0
	headshot_mode[pemilix] = 0
	shoot_ent_mode[pemilix] = 1
	ent_sentuh[pemilix] = 1
	ent_sentuh_balik[pemilix] = 0
	set_pev(Ent, pev_solid, SOLID_BBOX)
	set_pev(Ent, pev_nextthink, halflife_time() + 0.01)
}

public fw_SetModel(entity, model[])
{
	if(!pev_valid(entity))
		return FMRES_IGNORED
	
	static Classname[64]
	pev(entity, pev_classname, Classname, sizeof(Classname))
	
	if(!equal(Classname, "weaponbox"))
		return FMRES_IGNORED
	
	static id
	id = pev(entity, pev_owner)
	
	if(equal(model, old_w_model))
	{
		static weapon
		weapon = fm_get_user_weapon_entity(entity, CSW_BDRIPPER)
		
		if(!pev_valid(weapon))
			return FMRES_IGNORED
		
		if(g_had_guillotine[id])
		{
			set_pev(weapon, pev_impulse, WEAPON_SECRETCODE)
			set_pev(weapon, pev_iuser4, g_guillotine_ammo[id])
			engfunc(EngFunc_SetModel, entity, w_model)
			
			g_had_guillotine[id] = 0
			g_guillotine_ammo[id] = 0
			
			return FMRES_SUPERCEDE
		}
	}

	return FMRES_IGNORED;
}

public fw_AddToPlayer_Post(ent, id)
{
	if(pev(ent, pev_impulse) == WEAPON_SECRETCODE)
	{
		g_had_guillotine[id] = 1
		g_guillotine_ammo[id] = pev(ent, pev_iuser4)
		
		set_pev(ent, pev_impulse, 0)
	}			
	
	/* 
	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
	write_string((g_had_guillotine[id] == 1 ? "weapon_guillotine" : "weapon_mac10"))
	write_byte(6)
	write_byte(100)
	write_byte(-1)
	write_byte(-1)
	write_byte(0)
	write_byte(13)
	write_byte(CSW_BDRIPPER)
	write_byte(0)*/
}

public update_ammo(id)
{
	if(!is_user_alive(id))
		return

	static weapon_ent; weapon_ent = fm_get_user_weapon_entity(id, CSW_BDRIPPER)
	if(!pev_valid(weapon_ent)) return
	
	cs_set_weapon_ammo(weapon_ent, g_guillotine_ammo[id])	
	//cs_set_user_bpammo(id, CSW_BDRIPPER, g_guillotine_ammo[id])
	
	engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
	write_byte(1)
	write_byte(CSW_BDRIPPER)
	write_byte(-1)
	message_end()
	
	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("AmmoX"), _, id)
	write_byte(1)
	write_byte(g_guillotine_ammo[id])
	message_end()
}

public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id,ptr)
{
	if(!is_user_alive(id))
		return HAM_IGNORED	
	if(get_user_weapon(id) != CSW_BDRIPPER || !g_had_guillotine[id])
		return HAM_IGNORED

	// get crosshair aim
	static Float:aim[3];
	get_aim(id,v1,aim);
	
	// do another trace to this spot
	new trace = create_tr2();
	engfunc(EngFunc_TraceLine,v1,aim,noMonsters,id,trace);
	
	// copy ints
	set_tr2(ptr,TR_AllSolid,get_tr2(trace,TR_AllSolid));
	set_tr2(ptr,TR_StartSolid,get_tr2(trace,TR_StartSolid));
	set_tr2(ptr,TR_InOpen,get_tr2(trace,TR_InOpen));
	set_tr2(ptr,TR_InWater,get_tr2(trace,TR_InWater));
	set_tr2(ptr,TR_pHit,get_tr2(trace,TR_pHit));
	set_tr2(ptr,TR_iHitgroup,get_tr2(trace,TR_iHitgroup));

	// copy floats
	get_tr2(trace,TR_flFraction,aim[0]);
	set_tr2(ptr,TR_flFraction,aim[0]);
	get_tr2(trace,TR_flPlaneDist,aim[0]);
	set_tr2(ptr,TR_flPlaneDist,aim[0]);
	
	// copy vecs
	get_tr2(trace,TR_vecEndPos,aim);
	set_tr2(ptr,TR_vecEndPos,aim);
	get_tr2(trace,TR_vecPlaneNormal,aim);
	set_tr2(ptr,TR_vecPlaneNormal,aim);

	// get rid of new trace
	free_tr2(trace);

	return FMRES_IGNORED;
}

get_aim(id,Float:source[3],Float:ret[3])
{
	static Float:vAngle[3], Float:pAngle[3], Float:dir[3], Float:temp[3];

	// get aiming direction from forward global based on view angle and punch angle
	pev(id,pev_v_angle,vAngle);
	pev(id,pev_punchangle,pAngle);
	xs_vec_add(vAngle,pAngle,temp);
	engfunc(EngFunc_MakeVectors,temp);
	global_get(glb_v_forward,dir);
	
	/* vecEnd = vecSrc + vecDir * flDistance; */
	xs_vec_mul_scalar(dir,8192.0,temp);
	xs_vec_add(source,temp,ret);
}

public fake_smokes(Float:Origin[3])
{
	static TE_FLAG
	
	TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
	TE_FLAG |= TE_EXPLFLAG_NOSOUND
	TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
	
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, Origin, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, Origin[0])
	engfunc(EngFunc_WriteCoord, Origin[1])
	engfunc(EngFunc_WriteCoord, Origin[2])
	write_short(g_smokepuff_id)
	write_byte(6)
	write_byte(25)
	write_byte(TE_FLAG)
	message_end()
}

stock set_weapon_anim(id, anim)
{
	if(!is_user_alive(id))
		return
	
	set_pev(id, pev_weaponanim, anim)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
	write_byte(anim)
	write_byte(pev(id, pev_body))
	message_end()
}

stock kill(k, v, headshot)
{
	//cs_set_user_money(k, cs_get_user_money(k) + 500)
	
	set_user_frags(k, get_user_frags(k) + 1)
	
	set_msg_block(g_MsgDeathMsg,BLOCK_ONCE)
	set_msg_block(gmsgScoreInfo,BLOCK_ONCE)
	user_kill(v,1)
	
	new kteam = get_user_team(k);
	new vteam = get_user_team(v);
	
	new kfrags = get_user_frags(k);
	new kdeaths = get_user_deaths(k);
	
	new vfrags = get_user_frags(v);12
	new vdeaths = get_user_deaths(v);
	
	emessage_begin(MSG_ALL, gmsgScoreInfo);
	ewrite_byte(k);
	ewrite_short(kfrags);
	ewrite_short(kdeaths);
	ewrite_short(0);
	ewrite_short(kteam);
	emessage_end();
	
	emessage_begin(MSG_ALL, gmsgScoreInfo);
	ewrite_byte(v);
	ewrite_short(vfrags);
	ewrite_short(vdeaths);
	ewrite_short(0);
	ewrite_short(vteam);
	emessage_end();
	
	emessage_begin(MSG_BROADCAST, g_MsgDeathMsg)
	ewrite_byte(k)
	ewrite_byte(v)
	ewrite_byte(headshot)
	ewrite_string("Blood Dripper")
	emessage_end()
}


stock create_blood(const Float:origin[3])
{
	// Show some blood :)
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(TE_BLOODSPRITE)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2])
	write_short(m_iBlood[1])
	write_short(m_iBlood[0])
	write_byte(75)
	write_byte(8)
	message_end()
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(TE_BLOODSPRITE)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2])
	write_short(m_iBlood[1])
	write_short(m_iBlood[0])
	write_byte(75)
	write_byte(12)
	message_end()
}

stock drop_weapons(id, dropwhat)
{
	static weapons[32], num, i, weaponid
	num = 0
	get_user_weapons(id, weapons, num)
	 
	for (i = 0; i < num; i++)
	{
		weaponid = weapons[i]
		  
		if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
		{
			static wname[32]
			get_weaponname(weaponid, wname, sizeof wname - 1)
			engclient_cmd(id, "drop", wname)
		}
	}
}

stock Get_MissileWeaponHitGroup( iEnt )
{
	new Float:flStart[ 3 ], Float:flEnd[ 3 ];
	
	pev( iEnt, pev_origin, flStart );
	pev( iEnt, pev_velocity, flEnd );
	xs_vec_add( flStart, flEnd, flEnd );
	
	new ptr = create_tr2();
	engfunc( EngFunc_TraceLine, flStart, flEnd, 0, iEnt, ptr );
	
	new iHitGroup, Owner, nOhead, head
	Owner = pev(iEnt, pev_iuser1)
	nOhead = get_tr2( ptr, TR_iHitgroup )
	head = set_tr2( ptr, TR_iHitgroup, HIT_HEAD )
	
	iHitGroup = headshot_mode[Owner] ? head : nOhead
	
	free_tr2( ptr );
	
	return iHitGroup;
}

stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
{
   static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
   
   pev(id, pev_origin, vOrigin)
   pev(id, pev_view_ofs, vUp) //for player
   xs_vec_add(vOrigin, vUp, vOrigin)
   pev(id, pev_v_angle, vAngle) // if normal entity ,use pev_angles
   
   angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward) //or use EngFunc_AngleVectors
   angle_vector(vAngle, ANGLEVECTOR_RIGHT, vRight)
   angle_vector(vAngle, ANGLEVECTOR_UP, vUp)
   
   vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
   vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
   vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
}

stock set_weapons_timeidle(id, WeaponId ,Float:TimeIdle)
{
	if(!is_user_alive(id))
		return
		
	static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
	if(!pev_valid(entwpn)) 
		return
		
	set_pdata_float(entwpn, 48, TimeIdle + 0.2, OFFSET_LINUX_WEAPONS)
}

stock set_player_nextattackx(id, Float:nexttime)
{
	if(!is_user_alive(id))
		return
		
	set_pdata_float(id, m_flNextAttack, nexttime, 5)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
Last edited by ngamerz on 05 Jan 2021, 19:03, edited 3 times in total.
My Steam:
Image

ngamerz
Member
Member
Philippines
Posts: 21
Joined: 4 Months Ago
Location: Philippines From South Korea
Has thanked: 1 time
Been thanked: 3 times
Contact:

#9

Post by ngamerz » 1 Month Ago

Raheem wrote:
3 Months Ago
Post your version, you can change the weapon base to "weapon_knife".
You will get bugs if you do that lol.
My Steam:
Image

PunisheR
Member
Member
Pakistan
Posts: 3
Joined: 2 Months Ago
Has thanked: 1 time
Been thanked: 1 time
Contact:

#10

Post by PunisheR » 1 Month Ago

Try This
Guillotine Ammo is unlimited
ze_guillotine.sma
(30.96 KiB) Downloaded 39 times
ze_guillotine.sma
(30.96 KiB) Downloaded 39 times

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests