Resolved Extra Items (fix)

Coding Help/Re-API Supported
Post Reply
User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

Extra Items (fix)

#1

Post by Spir0x » 9 Months Ago

Hey all, i wanna convert 5 extra items it show errors for all of these guns on the compiler help me please !!

Image

Image

Image

Image

Image

Balrog Etheral:

Code: Select all

/*================================================================================
 
            --------------------------------
            [ZE] Extra Item: Balrog Ethereal
            --------------------------------
 
        Balrog Ethereal
        Copyright (C) 2017 by Crazy + ZE DEV TEAM
 
        -------------------
        -*- Description -*-
        -------------------
 
        This plugin add a new weapon into your zombie plague mod with
        the name of Balrog Ethereal. That weapon launch a powerfull beams!
        When the laser hit any object, a explosion effect with red color appers.
 
        ----------------
        -*- Commands -*-
        ----------------
 
        * zp_give_balrog_ethereal <target> - Give the item to target.
 
        -------------
        -*- Cvars -*-
        -------------
 
        * ze_balrog_ethereal_ammo <number> - Ammo amout.
        * ze_balrog_ethereal_clip <number> - Clip amout. (Max: 100)
        * ze_balrog_ethereal_one_round <0/1> - Only one round.
        * ze_balrog_ethereal_damage <number> - Damage multiplier.
        * ze_balrog_ethereal_unlimited <0/1> - Unlimited ammunition.
 
        ------------------
        -*- Change Log -*-
        ------------------
 
        * v1.5: (Mar 2017)
            - Updated all the code, added explosion effect, added new cvars;
 
        * v1.6: (Mar 2017)
            - Added custom weapon hud;
 
        ---------------
        -*- Credits -*-
        ---------------
 
        * MeRcyLeZZ: for the nice zombie plague mod.
        * Crazy: created the extra item code.
        * deanamx: for the nice weapon model.
        * And all zombie-mod players that use this weapon.
        * ZE DEV TEAM : For converting this Item
 
 
=================================================================================*/
#include <zombie_escape>
#include <cstrike>
 
/*================================================================================
 [Plugin Customization]
=================================================================================*/
 
// Item Name
#define ITEM_NAME "Balrog Ethereal"
 
 
/*================================================================================
 Customization ends here! Yes, that's it. Editing anything beyond
 here is not officially supported. Proceed at your own risk...
=================================================================================*/
 
new const PLUGIN_VERSION[] = "v1.6";
 
new const V_BALROG_MDL[64] = "models/Premuim_ZE/v_balrog_ethereal.mdl";
new const P_BALROG_MDL[64] = "models/Premuim_ZE/p_balrog_ethereal.mdl";
new const W_BALROG_MDL[64] = "models/Premuim_ZE/w_balrog_ethereal.mdl";
 
new const BALROG_SOUNDS[][] = { "weapons/ethereal_shoot.wav", "weapons/ethereal_reload.wav", "weapons/ethereal_idle1.wav", "weapons/ethereal_draw.wav" };
 
new g_has_balrog[33], g_laser_sprite, g_balrog_exp, g_balrog, g_event_balrog, g_playername[33][32], g_maxplayers, g_primary_attack, g_balrog_reload_clip[33], cvar_balrog_clip, cvar_balrog_ammo, cvar_balrog_damage, cvar_balrog_oneround, cvar_balrog_unlimited;
 
const BALROG_KEY = 0982478;
 
const m_iClip = 51;
const m_flNextAttack = 83;
const m_fInReload = 54;
 
const OFFSET_WEAPON_OWNER = 41;
const OFFSET_LINUX_WEAPONS = 4;
const OFFSET_LINUX = 5;
const OFFSET_ACTIVE_ITEM = 373;
 
const WEAPON_BITSUM = ((1<<CSW_SCOUT) | (1<<CSW_XM1014) | (1<<CSW_MAC10) | (1<<CSW_AUG) | (1<<CSW_UMP45) | (1<<CSW_SG550) | (1<<CSW_P90) | (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_GALIL));
 
enum
{
    idle = 0,
    reload,
    draw,
    shoot1,
    shoot2,
    shoot3
}
 
public plugin_init()
{
    /* Plugin register */
    register_plugin("[ZE] Extra Item: Balrog Ethereal", PLUGIN_VERSION, "Crazy");
 
    /* Item register */
    g_balrog = ze_register_item("Balrog Ethereal", 10, 0);
 
    /* Events */
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
 
    /* Messages */
    register_message(get_user_msgid("CurWeapon"), "message_cur_weapon");
 
    /* Forwards */
    register_forward(FM_UpdateClientData, "fw_UpdateData_Post", 1);
    register_forward(FM_SetModel, "fw_SetModel");
    register_forward(FM_PlaybackEvent, "fw_PlaybackEvent");
 
    /* Ham Forwards */
    RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack_Post", 1);
    RegisterHam(Ham_TraceAttack, "func_breakable", "fw_TraceAttack_Post", 1);
    RegisterHam(Ham_TraceAttack, "func_wall", "fw_TraceAttack_Post", 1);
    RegisterHam(Ham_TraceAttack, "func_door", "fw_TraceAttack_Post", 1);
    RegisterHam(Ham_TraceAttack, "func_door_rotating", "fw_TraceAttack_Post", 1);
    RegisterHam(Ham_TraceAttack, "func_plat", "fw_TraceAttack_Post", 1);
    RegisterHam(Ham_TraceAttack, "func_rotating", "fw_TraceAttack_Post", 1);
    RegisterHam(Ham_Item_Deploy, "weapon_ump45", "fw_Item_Deploy_Post", 1);
    RegisterHam(Ham_Item_AddToPlayer, "weapon_ump45", "fw_Item_AddToPlayer_Post", 1);
    RegisterHam(Ham_Item_PostFrame, "weapon_ump45", "fw_Item_PostFrame");
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "fw_PrimaryAttack");
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ump45", "fw_PrimaryAttack_Post", 1);
    RegisterHam(Ham_Weapon_Reload, "weapon_ump45", "fw_Reload");
    RegisterHam(Ham_Weapon_Reload, "weapon_ump45", "fw_Reload_Post", 1);
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
 
    /* Cvars */
    cvar_balrog_clip = register_cvar("ze_balrog_ethereal_clip", "50");
    cvar_balrog_ammo = register_cvar("ze_balrog_ethereal_ammo", "200");
    cvar_balrog_damage = register_cvar("ze_balrog_ethereal_damage 3.0", "3.0");
    cvar_balrog_oneround = register_cvar("ze_balrog_ethereal_one_round 0", "0");
    cvar_balrog_unlimited = register_cvar("ze_balrog_ethereal_unlimited 0", "0");
 
    /* Max Players */
    g_maxplayers = get_maxplayers()
}
 
public plugin_precache()
{
    engfunc(EngFunc_PrecacheModel, V_BALROG_MDL);
    engfunc(EngFunc_PrecacheModel, P_BALROG_MDL);
    engfunc(EngFunc_PrecacheModel, W_BALROG_MDL);
 
    engfunc(EngFunc_PrecacheGeneric, "sprites/weapon_bethereal.txt");
    engfunc(EngFunc_PrecacheGeneric, "sprites/640hud2_bethereal.spr");
    engfunc(EngFunc_PrecacheGeneric, "sprites/640hud10_bethereal.spr");
    engfunc(EngFunc_PrecacheGeneric, "sprites/640hud74_bethereal.spr");
 
    for (new i = 0; i < sizeof BALROG_SOUNDS; i++)
    engfunc(EngFunc_PrecacheSound, BALROG_SOUNDS[i]);
 
    g_laser_sprite = precache_model("sprites/laserbeam.spr");
    g_balrog_exp = precache_model("sprites/zombie_plague/balrog_ethereal_exp.spr");
 
    register_forward(FM_PrecacheEvent, "fw_PrecacheEvent_Post", 1);
    register_clcmd("weapon_bethereal", "cmd_balrog_selected");
}
 
public ze_user_infected(id)
{
    g_has_balrog[id] = false;
}
 
public ze_user_humanized(id)
{
    g_has_balrog[id] = false;
}
 
public client_putinserver(id)
{
    g_has_balrog[id] = false;
 
    get_user_name(id, g_playername[id], charsmax(g_playername[]));
}
 
public event_round_start()
{
    for (new id = 0; id <= g_maxplayers; id++)
    {
        if (get_pcvar_num(cvar_balrog_oneround))
        g_has_balrog[id] = false;
    }
}
 
public cmd_balrog_selected(client)
{
    engclient_cmd(client, "weapon_ump45");
    return PLUGIN_HANDLED;
}
 
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
    if (!is_user_alive(msg_entity))
        return;
 
    if (!g_has_balrog[msg_entity])
        return;
 
    if (get_user_weapon(msg_entity) != CSW_UMP45)
        return;
 
    if (get_msg_arg_int(1) != 1)
        return;
 
    if (get_pcvar_num(cvar_balrog_unlimited))
    {
        static ent;
        ent = fm_cs_get_current_weapon_ent(msg_entity);
 
        if (!pev_valid(ent))
            return;
 
        cs_set_weapon_ammo(ent, get_pcvar_num(cvar_balrog_clip));
        set_msg_arg_int(3, get_msg_argtype(3), get_pcvar_num(cvar_balrog_clip));
    }
}
 
public ze_select_item_pre(id, itemid)
{
    // This not our item?
    if (itemid != g_balrog)
        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)
{
    if (itemid != g_balrog)
        return;
 
    if (g_has_balrog[id])
    {
        client_print(id, print_chat, "[ZE] You already have the %s.", ITEM_NAME);
        return;
    }
 
    give_balrog(id);
 
    client_print(id, print_chat, "[ZE] You bought the %s.", ITEM_NAME);
}
 
public fw_UpdateData_Post(id, sendweapons, cd_handle)
{
    if (!is_user_alive(id))
        return FMRES_IGNORED;
 
    if (!g_has_balrog[id])
        return FMRES_IGNORED;
 
    if (get_user_weapon(id) != CSW_UMP45)
        return FMRES_IGNORED;
 
    set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001);
 
    return FMRES_IGNORED;
}
 
public fw_SetModel(ent, const model[])
{
    if (!pev_valid(ent))
        return FMRES_IGNORED;
 
    if (!equal(model, "models/w_ump45.mdl"))
        return HAM_IGNORED;
 
    static class_name[33];
    pev(ent, pev_classname, class_name, charsmax(class_name));
 
    if (!equal(class_name, "weaponbox"))
        return FMRES_IGNORED;
 
    static owner, weapon;
    owner = pev(ent, pev_owner);
    weapon = find_ent_by_owner(-1, "weapon_ump45", ent);
 
    if (!g_has_balrog[owner] || !pev_valid(weapon))
        return FMRES_IGNORED;
 
    g_has_balrog[owner] = false;
 
    set_pev(weapon, pev_impulse, BALROG_KEY);
 
    engfunc(EngFunc_SetModel, ent, W_BALROG_MDL);
 
    return FMRES_SUPERCEDE;
}
 
public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
    if ((eventid != g_event_balrog) || !g_primary_attack)
        return FMRES_IGNORED;
 
    if (!(1 <= invoker <= g_maxplayers))
        return FMRES_IGNORED;
 
    playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);
 
    return FMRES_SUPERCEDE;
}
 
public fw_PrecacheEvent_Post(type, const name[])
{
    if (!equal("events/ump45.sc", name))
        return HAM_IGNORED;
 
    g_event_balrog = get_orig_retval()
 
    return FMRES_HANDLED;
}
 
public fw_Item_Deploy_Post(ent)
{
    if (!pev_valid(ent))
        return HAM_IGNORED;
 
    new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, OFFSET_LINUX_WEAPONS);
 
    if (!is_user_alive(id))
        return HAM_IGNORED;
 
    if (!g_has_balrog[id])
        return HAM_IGNORED;
 
    set_pev(id, pev_viewmodel2, V_BALROG_MDL);
    set_pev(id, pev_weaponmodel2, P_BALROG_MDL);
 
    play_weapon_anim(id, draw);
 
    return HAM_IGNORED;
}
 
public fw_Item_AddToPlayer_Post(ent, id)
{
    if (!pev_valid(ent))
        return HAM_IGNORED;
 
    if (!is_user_alive(id))
        return HAM_IGNORED;
 
    if (pev(ent, pev_impulse) == BALROG_KEY)
    {
        g_has_balrog[id] = true;
        set_pev(ent, pev_impulse, 0);
    }
 
    message_begin(MSG_ONE, get_user_msgid("WeaponList"), _, id)
    write_string((g_has_balrog[id] ? "weapon_bethereal" : "weapon_ump45"))
    write_byte(6)
    write_byte(100)
    write_byte(-1)
    write_byte(-1)
    write_byte(0)
    write_byte(15)
    write_byte(CSW_UMP45)
    write_byte(0)
    message_end()
 
    return HAM_IGNORED;
}
 
public fw_Item_PostFrame(ent)
{
    if (!pev_valid(ent))
        return HAM_IGNORED;
 
    new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, OFFSET_LINUX_WEAPONS);
 
    if (!is_user_alive(id))
        return HAM_IGNORED;
 
    if (!g_has_balrog[id])
        return HAM_IGNORED;
 
    static cvar_clip; cvar_clip = get_pcvar_num(cvar_balrog_clip);
 
    new clip = get_pdata_int(ent, m_iClip, OFFSET_LINUX_WEAPONS);
    new bpammo = cs_get_user_bpammo(id, CSW_UMP45);
 
    new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, OFFSET_LINUX);
    new fInReload = get_pdata_int(ent, m_fInReload, OFFSET_LINUX_WEAPONS);
 
    if (fInReload && flNextAttack <= 0.0)
    {
        new temp_clip = min(cvar_clip - clip, bpammo);
 
        set_pdata_int(ent, m_iClip, clip + temp_clip, OFFSET_LINUX_WEAPONS);
 
        cs_set_user_bpammo(id, CSW_UMP45, bpammo-temp_clip);
 
        set_pdata_int(ent, m_fInReload, 0, OFFSET_LINUX_WEAPONS);
 
        fInReload = 0;
    }
 
    return HAM_IGNORED;
}
 
public fw_PrimaryAttack(ent)
{
    if (!pev_valid(ent))
        return HAM_IGNORED;
 
    new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, OFFSET_LINUX_WEAPONS);
 
    if (!is_user_alive(id))
        return HAM_IGNORED;
 
    if (!g_has_balrog[id])
        return HAM_IGNORED;
 
    if (!cs_get_weapon_ammo(ent))
        return HAM_IGNORED;
 
    g_primary_attack = true;
 
    return HAM_IGNORED;
}
 
public fw_PrimaryAttack_Post(ent)
{
    if (!pev_valid(ent))
        return HAM_IGNORED;
 
    new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, OFFSET_LINUX_WEAPONS);
 
    if (!is_user_alive(id))
        return HAM_IGNORED;
 
    if (!g_has_balrog[id])
        return HAM_IGNORED;
 
    if (!cs_get_weapon_ammo(ent))
        return HAM_IGNORED;
 
    g_primary_attack = false;
 
    play_weapon_anim(id, random_num(shoot1, shoot3));
 
    emit_sound(id, CHAN_WEAPON, BALROG_SOUNDS[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
 
    make_laser_beam(id, 7, 100, 0, 0);
 
    return HAM_IGNORED;
}
 
public fw_Reload(ent)
{
    if (!pev_valid(ent))
        return HAM_IGNORED;
 
    new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, OFFSET_LINUX_WEAPONS);
 
    if (!is_user_alive(id))
        return HAM_IGNORED;
 
    if (!g_has_balrog[id])
        return HAM_IGNORED;
 
    static cvar_clip;
 
    if (g_has_balrog[id])
        cvar_clip = get_pcvar_num(cvar_balrog_clip);
 
    g_balrog_reload_clip[id] = -1;
 
    new clip = get_pdata_int(ent, m_iClip, OFFSET_LINUX_WEAPONS);
    new bpammo = cs_get_user_bpammo(id, CSW_UMP45);
 
    if (bpammo <= 0)
        return HAM_SUPERCEDE;
 
    if (clip >= cvar_clip)
        return HAM_SUPERCEDE;
   
    g_balrog_reload_clip[id] = clip;
 
    return HAM_IGNORED;
}
 
public fw_Reload_Post(ent)
{
    if (!pev_valid(ent))
        return HAM_IGNORED;
 
    new id = get_pdata_cbase(ent, OFFSET_WEAPON_OWNER, OFFSET_LINUX_WEAPONS);
 
    if (!is_user_alive(id))
        return HAM_IGNORED;
 
    if (!g_has_balrog[id])
        return HAM_IGNORED;
 
    if (g_balrog_reload_clip[id] == -1)
        return HAM_IGNORED;
 
    set_pdata_int(ent, m_iClip, g_balrog_reload_clip[id], OFFSET_LINUX_WEAPONS);
    set_pdata_int(ent, m_fInReload, 1, OFFSET_LINUX_WEAPONS);
 
    play_weapon_anim(id, reload);
 
    return HAM_IGNORED;
}
 
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, dmg_bits)
{
    if (!is_user_alive(attacker))
        return HAM_IGNORED;
 
    if (!g_has_balrog[attacker])
        return HAM_IGNORED;
 
    if (get_user_weapon(attacker) != CSW_UMP45)
        return HAM_IGNORED;
 
    SetHamParamFloat(OFFSET_LINUX_WEAPONS, damage * get_pcvar_float(cvar_balrog_damage));
 
    make_explosion_effect(attacker);
 
    return HAM_IGNORED;
}
 
public fw_TraceAttack_Post(ent, attacker, Float:damage, Float:dir[3], ptr, dmg_bits)
{
    if (!is_user_alive(attacker))
        return HAM_IGNORED;
 
    if (get_user_weapon(attacker) != CSW_UMP45)
        return HAM_IGNORED;
 
    if (!g_has_balrog[attacker])
        return HAM_IGNORED;
 
    make_explosion_effect(attacker);
 
    return HAM_IGNORED;
}
 
give_balrog(id)
{
    drop_primary(id);
 
    g_has_balrog[id] = true;
 
    new weapon = fm_give_item(id, "weapon_ump45");
 
    cs_set_weapon_ammo(weapon, get_pcvar_num(cvar_balrog_clip));
    cs_set_user_bpammo(id, CSW_UMP45, get_pcvar_num(cvar_balrog_ammo));
}
 
play_weapon_anim(id, frame)
{
    set_pev(id, pev_weaponanim, frame);
 
    message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = id)
    write_byte(frame)
    write_byte(pev(id, pev_body))
    message_end()
}
 
make_laser_beam(id, Size, R, G, B)
{
    static End[3];
    get_user_origin(id, End, 3);
   
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte (TE_BEAMENTPOINT)
    write_short( id |0x1000 )
    write_coord(End[0])
    write_coord(End[1])
    write_coord(End[2])
    write_short(g_laser_sprite)
    write_byte(0)
    write_byte(1)
    write_byte(1)
    write_byte(Size)
    write_byte(4)
    write_byte(R)
    write_byte(G)
    write_byte(B)
    write_byte(255)
    write_byte(0)
    message_end()
}
 
make_explosion_effect(id)
{
    static end[3];
    get_user_origin(id, end, 3);
 
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(3)
    write_coord(end[0])
    write_coord(end[1])
    write_coord(end[2])
    write_short(g_balrog_exp)
    write_byte(10)
    write_byte(15)
    write_byte(4)
    message_end()
}
 
drop_primary(id)
{
    static weapons[32], num;
    get_user_weapons(id, weapons, num);
 
    for (new i = 0; i < num; i++)
    {
        if (WEAPON_BITSUM & (1<<weapons[i]))
        {
            static wname[32];
            get_weaponname(weapons[i], wname, sizeof wname - 1);
 
            engclient_cmd(id, "drop", wname);
        }
    }
}
 
stock fm_give_item(index, const item[])
{
    if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
        return 0;
 
    new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
    if (!pev_valid(ent))
        return 0;
 
    new Float:origin[3];
    pev(index, pev_origin, origin);
    set_pev(ent, pev_origin, origin);
    set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
    dllfunc(DLLFunc_Spawn, ent);
 
    new save = pev(ent, pev_solid);
    dllfunc(DLLFunc_Touch, ent, index);
    if (pev(ent, pev_solid) != save)
        return ent;
 
    engfunc(EngFunc_RemoveEntity, ent);
 
    return -1;
}
 
stock fm_cs_get_current_weapon_ent(id)
{
    if (pev_valid(id) != 2)
        return -1;
   
    return get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, OFFSET_LINUX);
}
Coilgun:

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <cstrike>
#include <xs>
#include <fun>
 
#define PLUGIN "[CSO] Coilgun"
#define VERSION "1.0"
#define AUTHOR "Dias + ZE DEV TEAM"
 
#define DAMAGE 30 // 62 for zombie
#define CLIP 100
#define BPAMMO 200
#define TIME_RELOAD 3.5
#define TIME_SHOOT 1.0
 
#define MODEL_V "models/Premuim_ZE/v_coil_gun.mdl"
#define MODEL_P "models/Premuim_ZE/p_coil_gun.mdl"
#define MODEL_W "models/Premuim_ZE/w_coil_gun.mdl"
 
#define DARTPISTOL_OLDMODEL "models/w_m249.mdl"
 
new const WeaponSounds[5][] =
{
    "weapons/coilmg-1.wav",
    "weapons/coilmg_exp1.wav",
    "weapons/coilmg_exp2.wav",
    "weapons/coilmg_clipin.wav",
    "weapons/coilmg_clipout.wav"
}
 
new const WeaponResources[3][] =
{
    "sprites/weapon_coilmg.txt",
    "sprites/640hud8_2.spr",
    "sprites/640hud129_2.spr"
}
 
new const Muzzleflash[] = "sprites/muzzleflash19.spr"
new const Electric_Sprite[] = "sprites/ef_coilmg.spr"
 
enum
{
    ANIME_IDLE = 0,
    ANIME_RELOAD,
    ANIME_DRAW,
    ANIME_SHOOT,
    ANIME_SHOOT2,
    ANIME_SHOOT3
}
 
// MACROS
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))
 
// Vars
new g_Had_Coilgun, g_Clip[33]
new g_SprID, g_Event_Coilgun, g_SmokePuff_SprId
new g_MaxPlayers, g_MsgWeaponList, g_MsgCurWeapon
new g_Muzzleflash_Ent[33], g_Muzzleflash, g_iItemID
 
 
// Safety
new g_IsConnected, g_IsAlive, g_PlayerWeapon[33], g_HamBot
 
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    g_iItemID = ze_register_item("Coil Gun", 40, 0)
   
    // Safety
    Register_SafetyFunc()
   
    register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
   
    // Forward
    register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
    register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")
    register_forward(FM_CmdStart, "fw_CmdStart")
    register_forward(FM_SetModel, "fw_SetModel")   
   
    register_forward(FM_AddToFullPack, "fw_AddToFullPack_Post", 1)
    register_forward(FM_CheckVisibility, "fw_CheckVisibility")
   
    // Ham
    RegisterHam(Ham_Item_Deploy, "weapon_m249", "fw_Item_Deploy_Post", 1)  
    RegisterHam(Ham_Item_AddToPlayer, "weapon_m249", "fw_Item_AddToPlayer_Post", 1)
    RegisterHam(Ham_Weapon_WeaponIdle, "weapon_m249", "fw_Weapon_WeaponIdle_Post", 1)
    RegisterHam(Ham_Item_PostFrame, "weapon_m249", "fw_Item_PostFrame")
    RegisterHam(Ham_Weapon_Reload, "weapon_m249", "fw_Weapon_Reload")
    RegisterHam(Ham_Weapon_Reload, "weapon_m249", "fw_Weapon_Reload_Post", 1)  
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m249", "fw_Weapon_PrimaryAttack_Post", 1)
   
    RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack_World")
    RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack_Player")
   
    g_MaxPlayers = get_maxplayers()
    g_MsgCurWeapon = get_user_msgid("CurWeapon")
    g_MsgWeaponList = get_user_msgid("WeaponList")
   
    register_clcmd("weapon_coilmg", "Hook_Weapon")
}
 
public plugin_precache()
{
    precache_model(MODEL_V)
    precache_model(MODEL_P)
    precache_model(MODEL_W)
 
    for(new i = 0; i < sizeof(WeaponSounds); i++)
        precache_sound(WeaponSounds[i])
       
    precache_generic(WeaponResources[0])
    precache_model(WeaponResources[1])
    precache_model(WeaponResources[2])
       
    g_SprID = precache_model(Electric_Sprite)
    precache_model(Muzzleflash)
    g_SmokePuff_SprId = engfunc(EngFunc_PrecacheModel, "sprites/wall_puff1.spr")
   
    register_forward(FM_PrecacheEvent, "fw_PrecacheEvent_Post", 1)
}
 
public fw_PrecacheEvent_Post(type, const name[])
{
    if(equal("events/m249.sc", name)) g_Event_Coilgun = get_orig_retval()      
}
 
public client_putinserver(id)
{
    Safety_Connected(id)
   
    if(!g_HamBot && is_user_bot(id))
    {
        g_HamBot = 1
        set_task(0.1, "Do_Register_HamBot", id)
    }
}
 
public Do_Register_HamBot(id)
{
    Register_SafetyFuncBot(id)
    RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack_Player")
}
 
public client_disconnected(id)
{
    Safety_Disconnected(id)
    Muzzleflash_Reset(id)
}
 
public Hook_Weapon(id)
{
    engclient_cmd(id, "weapon_m249")
    return PLUGIN_HANDLED
}
 
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_Coilgun(id)
}
 
public Get_Coilgun(id)
{
    Set_BitVar(g_Had_Coilgun, id)
    give_item(id, "weapon_m249")
   
    // Clip & Ammo
    static Ent; Ent = fm_get_user_weapon_entity(id, CSW_M249)
    if(!pev_valid(Ent)) return
   
    cs_set_weapon_ammo(Ent, CLIP)
    cs_set_user_bpammo(id, CSW_M249, BPAMMO)
   
    message_begin(MSG_ONE_UNRELIABLE, g_MsgCurWeapon, _, id)
    write_byte(1)
    write_byte(CSW_M249)
    write_byte(CLIP)
    message_end()
   
    MuzzleFlash_Set(id, Muzzleflash, 0.1)
}
 
public Remove_Coilgun(id)
{
    UnSet_BitVar(g_Had_Coilgun, id)
}
 
public Event_CurWeapon(id)
{
    static CSW; CSW = read_data(2)
    if(CSW != CSW_M249)
        return
    if(!Get_BitVar(g_Had_Coilgun, id)) 
        return
 
    static Float:Delay, Float:Delay2
    static Ent; Ent = fm_get_user_weapon_entity(id, CSW_M249)
    if(!pev_valid(Ent)) return
   
    Delay = get_pdata_float(Ent, 46, 4) * TIME_SHOOT
    Delay2 = get_pdata_float(Ent, 47, 4) * TIME_SHOOT
   
    if(Delay > 0.0)
    {
        set_pdata_float(Ent, 46, Delay, 4)
        set_pdata_float(Ent, 47, Delay2, 4)
    }
}
 
public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
    if(!is_alive(id))
        return FMRES_IGNORED   
    if(get_user_weapon(id) == CSW_M249 && Get_BitVar(g_Had_Coilgun, id))
        set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001)
   
    return FMRES_HANDLED
}
 
public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
    if (!is_connected(invoker))
        return FMRES_IGNORED   
    if(get_player_weapon(invoker) != CSW_M249 || !Get_BitVar(g_Had_Coilgun, invoker))
        return FMRES_IGNORED
    if(eventid != g_Event_Coilgun)
        return FMRES_IGNORED
   
    engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
 
    Set_WeaponAnim(invoker, ANIME_SHOOT)
    emit_sound(invoker, CHAN_WEAPON, WeaponSounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
   
    return FMRES_SUPERCEDE
}
 
public fw_SetModel(entity, model[])
{
    if(!pev_valid(entity))
        return FMRES_IGNORED
   
    static Classname[32]
    pev(entity, pev_classname, Classname, sizeof(Classname))
   
    if(!equal(Classname, "weaponbox"))
        return FMRES_IGNORED
   
    static iOwner
    iOwner = pev(entity, pev_owner)
   
    if(equal(model, DARTPISTOL_OLDMODEL))
    {
        static weapon; weapon = find_ent_by_owner(-1, "weapon_m249", entity)
       
        if(!pev_valid(weapon))
            return FMRES_IGNORED;
       
        if(Get_BitVar(g_Had_Coilgun, iOwner))
        {
            set_pev(weapon, pev_impulse, 1372015)
            engfunc(EngFunc_SetModel, entity, MODEL_W)
       
            Remove_Coilgun(iOwner)
           
            return FMRES_SUPERCEDE
        }
    }
 
    return FMRES_IGNORED;
}
 
public fw_CmdStart(id, uc_handle, seed)
{
    if(!is_alive(id))
        return FMRES_IGNORED
    if(get_user_weapon(id) != CSW_M249 || !Get_BitVar(g_Had_Coilgun, id))
        return FMRES_IGNORED
       
   
    return FMRES_HANDLED
}
 
public fw_AddToFullPack_Post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
{
    if(iEnt != g_Muzzleflash_Ent[iHost])
        return
       
    if(Get_BitVar(g_Muzzleflash, iHost))
    {
        set_es(esState, ES_Frame, float(random_num(0, 2)))
           
        set_es(esState, ES_RenderMode, kRenderTransAdd)
        set_es(esState, ES_RenderAmt, 255.0)
       
        UnSet_BitVar(g_Muzzleflash, iHost)
    }
       
    set_es(esState, ES_Skin, iHost)
    set_es(esState, ES_Body, 1)
    set_es(esState, ES_AimEnt, iHost)
    set_es(esState, ES_MoveType, MOVETYPE_FOLLOW)
}
 
public fw_CheckVisibility(iEntity, pSet)
{
    if(pev(iEntity, pev_impulse) != 2015)
        return FMRES_IGNORED
   
    forward_return(FMV_CELL, 1)
   
    return FMRES_SUPERCEDE
}
 
public fw_Item_Deploy_Post(Ent)
{
    if(pev_valid(Ent) != 2)
        return
    static Id; Id = get_pdata_cbase(Ent, 41, 4)
    if(get_pdata_cbase(Id, 373) != Ent)
        return
    if(!Get_BitVar(g_Had_Coilgun, Id))
        return
   
    set_pev(Id, pev_viewmodel2, MODEL_V)
    set_pev(Id, pev_weaponmodel2, MODEL_P)
   
    Set_WeaponAnim(Id, ANIME_DRAW)
}
 
public fw_Item_AddToPlayer_Post(Ent, id)
{
    if(!pev_valid(Ent))
        return HAM_IGNORED
       
    if(pev(Ent, pev_impulse) == 1372015)
    {
        Set_BitVar(g_Had_Coilgun, id)
        set_pev(Ent, pev_impulse, 0)
    }
   
    if(Get_BitVar(g_Had_Coilgun, id))
    {
        message_begin(MSG_ONE_UNRELIABLE, g_MsgWeaponList, _, id)
        write_string("weapon_coilmg")
        write_byte(3)
        write_byte(200)
        write_byte(-1)
        write_byte(-1)
        write_byte(0)
        write_byte(4)
        write_byte(CSW_M249)
        write_byte(0)
        message_end()          
    }
   
    return HAM_HANDLED 
}
 
public fw_Item_PostFrame(ent)
{
    static id; id = pev(ent, pev_owner)
    if(!is_user_alive(id))
        return HAM_IGNORED
    if(!Get_BitVar(g_Had_Coilgun, id))
        return HAM_IGNORED 
   
    static Float:flNextAttack; flNextAttack = get_pdata_float(id, 83, 5)
    static bpammo; bpammo = cs_get_user_bpammo(id, CSW_M249)
   
    static iClip; iClip = get_pdata_int(ent, 51, 4)
    static fInReload; fInReload = get_pdata_int(ent, 54, 4)
   
    if(fInReload && flNextAttack <= 0.0)
    {
        static temp1
        temp1 = min(CLIP - iClip, bpammo)
 
        set_pdata_int(ent, 51, iClip + temp1, 4)
        cs_set_user_bpammo(id, CSW_M249, bpammo - temp1)       
       
        set_pdata_int(ent, 54, 0, 4)
       
        fInReload = 0
    }      
   
    return HAM_IGNORED
}
 
public fw_Weapon_Reload(ent)
{
    static id; id = pev(ent, pev_owner)
    if(!is_user_alive(id))
        return HAM_IGNORED
    if(!Get_BitVar(g_Had_Coilgun, id))
        return HAM_IGNORED 
 
    g_Clip[id] = -1
       
    static BPAmmo; BPAmmo = cs_get_user_bpammo(id, CSW_M249)
    static iClip; iClip = get_pdata_int(ent, 51, 4)
       
    if(BPAmmo <= 0)
        return HAM_SUPERCEDE
    if(iClip >= CLIP)
        return HAM_SUPERCEDE       
           
    g_Clip[id] = iClip 
   
    return HAM_HANDLED
}
 
public fw_Weapon_Reload_Post(ent)
{
    static id; id = pev(ent, pev_owner)
    if(!is_user_alive(id))
        return HAM_IGNORED
    if(!Get_BitVar(g_Had_Coilgun, id))
        return HAM_IGNORED 
   
    if((get_pdata_int(ent, 54, 4) == 1))
    { // Reload
        if(g_Clip[id] == -1)
            return HAM_IGNORED
       
        set_pdata_int(ent, 51, g_Clip[id], 4)
        Set_WeaponAnim(id, ANIME_RELOAD)
       
        Set_PlayerNextAttack(id, TIME_RELOAD)
    }
   
    return HAM_HANDLED
}
 
public fw_Weapon_WeaponIdle_Post( iEnt )
{
    if(pev_valid(iEnt) != 2)
        return
    static Id; Id = get_pdata_cbase(iEnt, 41, 4)
    if(get_pdata_cbase(Id, 373) != iEnt)
        return
    if(!Get_BitVar(g_Had_Coilgun, Id))
        return
       
    //if(get_pdata_float(iEnt, 48, 4) <= 0.25)
    //{
        //Set_WeaponAnim(Id, g_Ammo[Id] > 0 ? ANIME_IDLE : ANIME_IDLE_EMPTY)
        //set_pdata_float(iEnt, 48, 20.0, 4)
    //}
}
 
public fw_TraceAttack_World(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
    if(!is_connected(Attacker))
        return HAM_IGNORED 
    if(get_player_weapon(Attacker) != CSW_M249 || !Get_BitVar(g_Had_Coilgun, Attacker))
        return HAM_IGNORED
       
    static Float:flEnd[3], Float:vecPlane[3]
       
    get_tr2(Ptr, TR_vecEndPos, flEnd)
    get_tr2(Ptr, TR_vecPlaneNormal, vecPlane)      
           
    Make_BulletHole(Attacker, flEnd, Damage)
    Make_BulletSmoke(Attacker, Ptr)
 
    SetHamParamFloat(3, float(DAMAGE))
    return HAM_HANDLED
}
 
public fw_TraceAttack_Player(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
    if(!is_connected(Attacker))
        return HAM_IGNORED 
    if(get_player_weapon(Attacker) != CSW_M249 || !Get_BitVar(g_Had_Coilgun, Attacker))
        return HAM_IGNORED
 
    SetHamParamFloat(3, float(DAMAGE))
   
    static Float:Origin[3]; pev(Victim, pev_origin, Origin)
   
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    write_byte(TE_EXPLOSION)
    engfunc(EngFunc_WriteCoord, Origin[0])
    engfunc(EngFunc_WriteCoord, Origin[1])
    engfunc(EngFunc_WriteCoord, Origin[2])
    write_short(g_SprID)
    write_byte(6)
    write_byte(15)
    write_byte(TE_EXPLFLAG_NODLIGHTS | TE_EXPLFLAG_NOPARTICLES | TE_EXPLFLAG_NOSOUND)
    message_end()
   
    emit_sound(Victim, CHAN_STATIC, WeaponSounds[random_num(1, 2)], VOL_NORM, ATTN_NONE, 0, PITCH_NORM)
    Check_Damage(Attacker, Victim, Origin, Attacker)
           
    return HAM_HANDLED
}
 
public Check_Damage(Atk, id, Float:Origin[3], Except)
{
    for(new i = 0; i < g_MaxPlayers; i++)
    {
        if(!is_alive(i))
            continue
        if(entity_range(id, i) > 48.0)
            continue
        if(Except == i)
            continue
           
        if(id != i) ExecuteHamB(Ham_TakeDamage, i, 0, id, float(DAMAGE), DMG_BURN)
    }
}
 
public fw_Weapon_PrimaryAttack_Post(Ent)
{
    if(pev_valid(Ent) != 2)
        return
    static Id; Id = get_pdata_cbase(Ent, 41, 4)
    if(get_pdata_cbase(Id, 373) != Ent)
        return
    if(!Get_BitVar(g_Had_Coilgun, Id))
        return
 
    if(cs_get_weapon_ammo(Ent) > 0) Muzzleflash_Activate(Id)
}
 
public MuzzleFlash_Set(id, const Muzzleflash[], Float:Scale)
{
    if(!is_user_connected(id))
        return
   
    if(!pev_valid(g_Muzzleflash_Ent[id]))
        g_Muzzleflash_Ent[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
 
    engfunc(EngFunc_SetModel, g_Muzzleflash_Ent[id], Muzzleflash)
    set_pev(g_Muzzleflash_Ent[id], pev_scale, Scale)
       
    set_pev(g_Muzzleflash_Ent[id], pev_rendermode, kRenderTransTexture)
    set_pev(g_Muzzleflash_Ent[id], pev_renderamt, 0.0)
   
    set_pev(g_Muzzleflash_Ent[id], pev_impulse, 2015)
}
 
public Muzzleflash_Reset(id)
{
    if(1 > id || id > 32)
        return
   
    if(pev_valid(g_Muzzleflash_Ent[id])) set_pev(id, pev_flags, FL_KILLME)
}
 
public Muzzleflash_Activate(id) Set_BitVar(g_Muzzleflash, id)
 
/* ===============================
------------- SAFETY -------------
=================================*/
public Register_SafetyFunc()
{
    register_event("CurWeapon", "Safety_CurWeapon", "be", "1=1")
   
    RegisterHam(Ham_Spawn, "player", "fw_Safety_Spawn_Post", 1)
    RegisterHam(Ham_Killed, "player", "fw_Safety_Killed_Post", 1)
}
 
public Register_SafetyFuncBot(id)
{
    RegisterHamFromEntity(Ham_Spawn, id, "fw_Safety_Spawn_Post", 1)
    RegisterHamFromEntity(Ham_Killed, id, "fw_Safety_Killed_Post", 1)
}
 
public Safety_Connected(id)
{
    Set_BitVar(g_IsConnected, id)
    UnSet_BitVar(g_IsAlive, id)
   
    g_PlayerWeapon[id] = 0
}
 
public Safety_Disconnected(id)
{
    UnSet_BitVar(g_IsConnected, id)
    UnSet_BitVar(g_IsAlive, id)
   
    g_PlayerWeapon[id] = 0
}
 
public Safety_CurWeapon(id)
{
    if(!is_alive(id))
        return
       
    static CSW; CSW = read_data(2)
    if(g_PlayerWeapon[id] != CSW) g_PlayerWeapon[id] = CSW
}
 
public fw_Safety_Spawn_Post(id)
{
    if(!is_user_alive(id))
        return
       
    Set_BitVar(g_IsAlive, id)
}
 
public fw_Safety_Killed_Post(id)
{
    UnSet_BitVar(g_IsAlive, id)
}
 
public is_alive(id)
{
    if(!(1 <= id <= 32))
        return 0
    if(!Get_BitVar(g_IsConnected, id))
        return 0
    if(!Get_BitVar(g_IsAlive, id))
        return 0
   
    return 1
}
 
public is_connected(id)
{
    if(!(1 <= id <= 32))
        return 0
    if(!Get_BitVar(g_IsConnected, id))
        return 0
   
    return 1
}
 
public get_player_weapon(id)
{
    if(!is_alive(id))
        return 0
   
    return g_PlayerWeapon[id]
}
 
/* ===============================
--------- End of SAFETY ----------
=================================*/
 
stock Set_WeaponAnim(id, anim)
{
    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 Make_BulletHole(id, Float:Origin[3], Float:Damage)
{
    // Find target
    static Decal; Decal = random_num(41, 45)
    static LoopTime;
   
    if(Damage > 100.0) LoopTime = 2
    else LoopTime = 1
   
    for(new i = 0; i < LoopTime; i++)
    {
        // Put decal on "world" (a wall)
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_WORLDDECAL)
        engfunc(EngFunc_WriteCoord, Origin[0])
        engfunc(EngFunc_WriteCoord, Origin[1])
        engfunc(EngFunc_WriteCoord, Origin[2])
        write_byte(Decal)
        message_end()
       
        // Show sparcles
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_GUNSHOTDECAL)
        engfunc(EngFunc_WriteCoord, Origin[0])
        engfunc(EngFunc_WriteCoord, Origin[1])
        engfunc(EngFunc_WriteCoord, Origin[2])
        write_short(id)
        write_byte(Decal)
        message_end()
    }
}
 
stock Make_BulletSmoke(id, TrResult)
{
    static Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
   
    get_weapon_attachment(id, vecSrc)
    global_get(glb_v_forward, vecEnd)
   
    xs_vec_mul_scalar(vecEnd, 8192.0, vecEnd)
    xs_vec_add(vecSrc, vecEnd, vecEnd)
 
    get_tr2(TrResult, TR_vecEndPos, vecSrc)
    get_tr2(TrResult, TR_vecPlaneNormal, vecEnd)
   
    xs_vec_mul_scalar(vecEnd, 2.5, vecEnd)
    xs_vec_add(vecSrc, vecEnd, vecEnd)
   
    TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
    TE_FLAG |= TE_EXPLFLAG_NOSOUND
    TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
   
    engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, vecEnd, 0)
    write_byte(TE_EXPLOSION)
    engfunc(EngFunc_WriteCoord, vecEnd[0])
    engfunc(EngFunc_WriteCoord, vecEnd[1])
    engfunc(EngFunc_WriteCoord, vecEnd[2] - 10.0)
    write_short(g_SmokePuff_SprId)
    write_byte(2)
    write_byte(50)
    write_byte(TE_FLAG)
    message_end()
}
 
stock get_weapon_attachment(id, Float:output[3], Float:fDis = 40.0)
{
    static Float:vfEnd[3], viEnd[3]
    get_user_origin(id, viEnd, 3)  
    IVecFVec(viEnd, vfEnd)
   
    static Float:fOrigin[3], Float:fAngle[3]
   
    pev(id, pev_origin, fOrigin)
    pev(id, pev_view_ofs, fAngle)
   
    xs_vec_add(fOrigin, fAngle, fOrigin)
   
    static Float:fAttack[3]
   
    xs_vec_sub(vfEnd, fOrigin, fAttack)
    xs_vec_sub(vfEnd, fOrigin, fAttack)
   
    static Float:fRate
   
    fRate = fDis / vector_length(fAttack)
    xs_vec_mul_scalar(fAttack, fRate, fAttack)
   
    xs_vec_add(fOrigin, fAttack, output)
}
 
stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
{
    new 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 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]
    new Float: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 Set_WeaponIdleTime(id, WeaponId ,Float:TimeIdle)
{
    static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
    if(!pev_valid(entwpn))
        return
       
    set_pdata_float(entwpn, 46, TimeIdle, 4)
    set_pdata_float(entwpn, 47, TimeIdle, 4)
    set_pdata_float(entwpn, 48, TimeIdle + 0.5, 4)
}
 
stock Set_PlayerNextAttack(id, Float:nexttime)
{
    set_pdata_float(id, 83, nexttime, 5)
}
 
 
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
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1042\\ f0\\ fs16 \n\\ par }
*/
Dark m4a1:

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <cstrike>
#include <xs>
#include <fun>

#define PLUGIN "[CSO] M4A1 Dark Knight"
#define VERSION "1.0"
#define AUTHOR "Dias Pendragon"

// Data Config
#define MODEL_V "models/Premuim_ZE/v_dark_m4a1.mdl"
#define MODEL_P "models/Premuim_ZE/p_dark_m4a1.mdl"
#define MODEL_W "models/Premuim_ZE/w_dark_m4a1.mdl"
#define MODEL_W_OLD "models/w_m4a1.mdl"

#define CSW_BASE CSW_M4A1
#define weapon_base "weapon_m4a1"

#define SUBMODEL -1 // can -1
#define WEAPON_CODE 2692015
#define WEAPON_EVENT "events/m4a1.sc"

#define ANIME_SHOOT 3
#define ANIME_RELOAD 1 // can -1
#define ANIME_DRAW 2 // can -1
#define ANIME_IDLE 0 // can -1

new const WeaponSounds[6][] =
{
	"weapons/m4a1buff-1.wav",
	"weapons/m4a1buff-2.wav",
	"weapons/m4a1buff_idle.wav",
	"weapons/m4a1buff_clipin1.wav",
	"weapons/m4a1buff_clipin2.wav",
	"weapons/m4a1buff_clipout.wav"
}

// Weapon Config
#define DAMAGE_A 30 // 60 for Zombie
#define DAMAGE_B 43 // 200 for Zombie
#define ACCURACY 70 // 0 - 100 ; -1 Default
#define CLIP 50
#define BPAMMO 250
#define SPEED_A 0.0875
#define SPEED_B 0.25
#define RECOIL 0.75
#define RELOAD_TIME 2.0

// Muzzleflash
#define MUZZLEFLASH1 "sprites/muzzleflash43.spr"
#define MUZZLEFLASH2 "sprites/muzzleflash44.spr"

// MACROS
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

//new g_Base
new g_Had_Base, g_Clip[33], g_OldWeapon[33], Float:g_Recoil[33][3]
new g_Event_Base, g_SmokePuff_SprId, g_MsgCurWeapon, m_spriteTexture
new g_Muzzleflash_Ent, g_Muzzleflash
new g_Muzzleflash_Ent2, g_Muzzleflash2

// Safety
new g_HamBot
new g_IsConnected, g_IsAlive, g_PlayerWeapon[33]
new  g_iItemID
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	// Safety
	Register_SafetyFunc()
	
	// Event
	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
	g_iItemID = ze_register_item("Dark M4A1", 80, 0) 
	
	// Forward
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")
	register_forward(FM_SetModel, "fw_SetModel")	
	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_AddToFullPack, "fw_AddToFullPack_Post", 1)
	register_forward(FM_CheckVisibility, "fw_CheckVisibility")
	
	// Ham
	RegisterHam(Ham_Item_Deploy, weapon_base, "fw_Item_Deploy_Post", 1)	
	RegisterHam(Ham_Item_AddToPlayer, weapon_base, "fw_Item_AddToPlayer_Post", 1)
	RegisterHam(Ham_Weapon_WeaponIdle, weapon_base, "fw_Weapon_WeaponIdle_Post", 1)
	RegisterHam(Ham_Item_PostFrame, weapon_base, "fw_Item_PostFrame")	
	RegisterHam(Ham_Weapon_Reload, weapon_base, "fw_Weapon_Reload")
	RegisterHam(Ham_Weapon_Reload, weapon_base, "fw_Weapon_Reload_Post", 1)	
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_base, "fw_Weapon_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_base, "fw_Weapon_PrimaryAttack_Post", 1)
	
	RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack_World")
	RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack_Player")	
	
	// Cache
	g_MsgCurWeapon = get_user_msgid("CurWeapon")
	
	// Get
	
}

public plugin_precache()
{
	precache_model(MODEL_V)
	precache_model(MODEL_P)
	precache_model(MODEL_W)
	
	for(new i = 0; i < sizeof(WeaponSounds); i++)
		precache_sound(WeaponSounds[i])
	
	m_spriteTexture = precache_model( "sprites/lgtning.spr" )
	g_SmokePuff_SprId = engfunc(EngFunc_PrecacheModel, "sprites/wall_puff1.spr")
	register_forward(FM_PrecacheEvent, "fw_PrecacheEvent_Post", 1)
	
	// Muzzleflash
	g_Muzzleflash_Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	g_Muzzleflash_Ent2 = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	
	precache_model(MUZZLEFLASH1)
	precache_model(MUZZLEFLASH2)
	
	engfunc(EngFunc_SetModel, g_Muzzleflash_Ent, MUZZLEFLASH1)
	engfunc(EngFunc_SetModel, g_Muzzleflash_Ent2, MUZZLEFLASH2)
	
	set_pev(g_Muzzleflash_Ent, pev_scale, 0.075)
	set_pev(g_Muzzleflash_Ent2, pev_scale, 0.1)
	
	set_pev(g_Muzzleflash_Ent, pev_rendermode, kRenderTransTexture)
	set_pev(g_Muzzleflash_Ent, pev_renderamt, 0.0)
	set_pev(g_Muzzleflash_Ent2, pev_rendermode, kRenderTransTexture)
	set_pev(g_Muzzleflash_Ent2, pev_renderamt, 0.0)
}

public fw_PrecacheEvent_Post(type, const name[])
{
	if(equal(WEAPON_EVENT, name)) g_Event_Base = get_orig_retval()		
}

public client_putinserver(id)
{
        Safety_Connected(id)
	
	if(!g_HamBot && is_user_bot(id))
	{
		g_HamBot = 1
		set_task(0.1, "Register_HamBot", id)
	}
}
 
public Register_HamBot(id)
{
	Register_SafetyFuncBot(id)
	RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack_Player")	
}
 
public client_disconnected(id)
{
        Safety_Disconnected(id)
}
/*
public Mileage_WeaponGet(id, ItemID)
{
	if(ItemID == g_Base) Get_Base(id)
}

public Mileage_WeaponRefillAmmo(id, ItemID)
{
	if(ItemID == g_Base) cs_set_user_bpammo(id, CSW_BASE, BPAMMO)
}

public Mileage_WeaponRemove(id, ItemID)
{
	if(ItemID == g_Base) Remove_Base(id)
}*/

public Get_Base(id)
{
	Set_BitVar(g_Had_Base, id)
	give_item(id, weapon_base)
	
	// Clip & Ammo
	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_BASE)
	if(!pev_valid(Ent)) return
	
	cs_set_weapon_ammo(Ent, CLIP)
	cs_set_user_bpammo(id, CSW_BASE, BPAMMO)
	
	message_begin(MSG_ONE_UNRELIABLE, g_MsgCurWeapon, _, id)
	write_byte(1)
	write_byte(CSW_BASE)
	write_byte(CLIP)
	message_end()
	
	cs_set_weapon_silen(Ent, 0, 0)
}

public ze_user_infected(id) 
{
	Remove_Base(id)
}

public ze_user_humanized(id)
{ 
	Remove_Base(id)
}
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_Base(id);        
}

public Remove_Base(id)
{
	UnSet_BitVar(g_Had_Base, id)
}

public Event_CurWeapon(id)
{
	static CSWID; CSWID = read_data(2)
	static SubModel; SubModel = SUBMODEL
	
	if((CSWID == CSW_BASE && g_OldWeapon[id] != CSW_BASE) && Get_BitVar(g_Had_Base, id))
	{
		if(SubModel != -1) Draw_NewWeapon(id, CSWID)
	} else if((CSWID == CSW_BASE && g_OldWeapon[id] == CSW_BASE) && Get_BitVar(g_Had_Base, id)) {
		static Ent; Ent = fm_get_user_weapon_entity(id, CSW_BASE)
		if(!pev_valid(Ent))
		{
			g_OldWeapon[id] = get_user_weapon(id)
			return
		}
		
		static Float:Speed
		if(cs_get_user_zoom(id) != CS_SET_AUGSG552_ZOOM) Speed = SPEED_A
		else Speed = SPEED_B
		
		set_pdata_float(Ent, 46, Speed, 4)
		set_pdata_float(Ent, 47, Speed, 4)
	} else if(CSWID != CSW_BASE && g_OldWeapon[id] == CSW_BASE) {
		if(SubModel != -1) Draw_NewWeapon(id, CSWID)
	}
	
	g_OldWeapon[id] = get_user_weapon(id)
}

public Draw_NewWeapon(id, CSW_ID)
{
	if(CSW_ID == CSW_BASE)
	{
		static ent
		ent = fm_get_user_weapon_entity(id, CSW_BASE)
		
		if(pev_valid(ent) && Get_BitVar(g_Had_Base, id))
		{
			set_pev(ent, pev_effects, pev(ent, pev_effects) &~ EF_NODRAW) 
			engfunc(EngFunc_SetModel, ent, MODEL_P)	
			set_pev(ent, pev_body, SUBMODEL)
		}
	} else {
		static ent
		ent = fm_get_user_weapon_entity(id, CSW_BASE)
		
		if(pev_valid(ent)) set_pev(ent, pev_effects, pev(ent, pev_effects) | EF_NODRAW) 			
	}
}

public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
	if(!is_alive(id))
		return FMRES_IGNORED	
	if(get_user_weapon(id) == CSW_BASE && Get_BitVar(g_Had_Base, id))
		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001) 
	
	return FMRES_HANDLED
}

public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if (!is_connected(invoker))
		return FMRES_IGNORED	
	if(get_player_weapon(invoker) != CSW_BASE || !Get_BitVar(g_Had_Base, invoker))
		return FMRES_IGNORED
	if(eventid != g_Event_Base)
		return FMRES_IGNORED
	
	engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)

	Set_WeaponAnim(invoker, ANIME_SHOOT)
	if(cs_get_user_zoom(invoker) != CS_SET_AUGSG552_ZOOM) emit_sound(invoker, CHAN_WEAPON, WeaponSounds[0], 1.0, 0.4, 0, 94 + random_num(0, 15))
	else emit_sound(invoker, CHAN_WEAPON, WeaponSounds[1], 1.0, 0.4, 0, 94 + random_num(0, 15))
	
	return FMRES_SUPERCEDE
}

public fw_SetModel(entity, model[])
{
	if(!pev_valid(entity))
		return FMRES_IGNORED
	
	static Classname[32]
	pev(entity, pev_classname, Classname, sizeof(Classname))
	
	if(!equal(Classname, "weaponbox"))
		return FMRES_IGNORED
	
	static iOwner
	iOwner = pev(entity, pev_owner)
	
	if(equal(model, MODEL_W_OLD))
	{
		static weapon; weapon = find_ent_by_owner(-1, weapon_base, entity)
		
		if(!pev_valid(weapon))
			return FMRES_IGNORED;
		
		if(Get_BitVar(g_Had_Base, iOwner))
		{
			set_pev(weapon, pev_impulse, WEAPON_CODE)
			engfunc(EngFunc_SetModel, entity, MODEL_W)
			set_pev(entity, pev_body, SUBMODEL)
		
			Remove_Base(iOwner)
			
			return FMRES_SUPERCEDE
		}
	}

	return FMRES_IGNORED;
}

public fw_CmdStart(id, uc_handle, seed)
{
	if (!is_alive(id))
		return FMRES_IGNORED	
	if(get_player_weapon(id) != CSW_BASE || !Get_BitVar(g_Had_Base, id))
		return FMRES_IGNORED
		
	static Button; Button = get_uc(uc_handle, UC_Buttons)	
	
	if(Button & IN_ATTACK2)
	{
		static Float:Time; Time = get_pdata_float(id, 83, 5)
		if(Time > 0.0) return FMRES_IGNORED
		
		if(cs_get_user_zoom(id) != CS_SET_AUGSG552_ZOOM) cs_set_user_zoom(id, CS_SET_AUGSG552_ZOOM, 1)
		else cs_set_user_zoom(id, CS_RESET_ZOOM, 0)
		
		Time = 0.25
		set_pdata_float(id, 83, Time, 5)
	}
	
	return FMRES_IGNORED
}

public fw_AddToFullPack_Post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
{
	if(iEnt == g_Muzzleflash_Ent)
	{
		if(Get_BitVar(g_Muzzleflash, iHost))
		{
			set_es(esState, ES_Frame, float(random_num(0, 2)))
				
			set_es(esState, ES_RenderMode, kRenderTransAdd)
			set_es(esState, ES_RenderAmt, 255.0)
			
			UnSet_BitVar(g_Muzzleflash, iHost)
			//remove_task(iHost+WEAPON_CODE)
			set_task(0.001, "Set_NextMuzzleflash", iHost+WEAPON_CODE)
		}
			
		set_es(esState, ES_Skin, iHost)
		set_es(esState, ES_Body, 1)
		set_es(esState, ES_AimEnt, iHost)
		set_es(esState, ES_MoveType, MOVETYPE_FOLLOW)
	} else if(iEnt == g_Muzzleflash_Ent2) {
		if(Get_BitVar(g_Muzzleflash2, iHost))
		{
			set_es(esState, ES_Frame, float(random_num(0, 2)))
				
			set_es(esState, ES_RenderMode, kRenderTransAdd)
			set_es(esState, ES_RenderAmt, 255.0)
			
			UnSet_BitVar(g_Muzzleflash2, iHost)
		}
			
		set_es(esState, ES_Skin, iHost)
		set_es(esState, ES_Body, 1)
		set_es(esState, ES_AimEnt, iHost)
		set_es(esState, ES_MoveType, MOVETYPE_FOLLOW)
	}
}

public Set_NextMuzzleflash(id) Set_BitVar(g_Muzzleflash2, id-WEAPON_CODE)

public fw_CheckVisibility(iEntity, pSet)
{
	if(iEntity == g_Muzzleflash_Ent || iEntity == g_Muzzleflash_Ent2)
	{
		forward_return(FMV_CELL, 1)
		return FMRES_SUPERCEDE
	}
	
	return FMRES_IGNORED
}

public fw_Item_Deploy_Post(Ent)
{
	if(pev_valid(Ent) != 2)
		return
	static Id; Id = get_pdata_cbase(Ent, 41, 4)
	if(get_pdata_cbase(Id, 373) != Ent)
		return
	if(!Get_BitVar(g_Had_Base, Id))
		return
		
	static SubModel; SubModel = SUBMODEL
	
	set_pev(Id, pev_viewmodel2, MODEL_V)
	set_pev(Id, pev_weaponmodel2, SubModel != -1 ? "" : MODEL_P)
	
	static Draw; Draw = ANIME_DRAW
	if(Draw != -1) Set_WeaponAnim(Id, ANIME_DRAW)
}

public fw_Item_AddToPlayer_Post(Ent, id)
{
	if(!pev_valid(Ent))
		return HAM_IGNORED
		
	if(pev(Ent, pev_impulse) == WEAPON_CODE)
	{
		Set_BitVar(g_Had_Base, id)
		set_pev(Ent, pev_impulse, 0)
	}
	
	return HAM_HANDLED	
}

public fw_Item_PostFrame(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_Base, id))
		return HAM_IGNORED	
	
	static Float:flNextAttack; flNextAttack = get_pdata_float(id, 83, 5)
	static bpammo; bpammo = cs_get_user_bpammo(id, CSW_BASE)
	
	static iClip; iClip = get_pdata_int(ent, 51, 4)
	static fInReload; fInReload = get_pdata_int(ent, 54, 4)
	
	if(fInReload && flNextAttack <= 0.0)
	{
		static temp1
		temp1 = min(CLIP - iClip, bpammo)

		set_pdata_int(ent, 51, iClip + temp1, 4)
		cs_set_user_bpammo(id, CSW_BASE, bpammo - temp1)		
		
		set_pdata_int(ent, 54, 0, 4)
		
		fInReload = 0
	}		
	
	return HAM_IGNORED
}

public fw_Weapon_Reload(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_Base, id))
		return HAM_IGNORED	

	g_Clip[id] = -1
		
	static BPAmmo; BPAmmo = cs_get_user_bpammo(id, CSW_BASE)
	static iClip; iClip = get_pdata_int(ent, 51, 4)
		
	if(BPAmmo <= 0)
		return HAM_SUPERCEDE
	if(iClip >= CLIP)
		return HAM_SUPERCEDE		
			
	g_Clip[id] = iClip	
	
	return HAM_HANDLED
}

public fw_Weapon_Reload_Post(ent)
{
	static id; id = pev(ent, pev_owner)
	if(!is_user_alive(id))
		return HAM_IGNORED
	if(!Get_BitVar(g_Had_Base, id))
		return HAM_IGNORED	
	
	if((get_pdata_int(ent, 54, 4) == 1))
	{ // Reload
		if(g_Clip[id] == -1)
			return HAM_IGNORED
		
		set_pdata_int(ent, 51, g_Clip[id], 4)
		
		static Reload; Reload = ANIME_RELOAD
		if(Reload != -1) Set_WeaponAnim(id, ANIME_RELOAD)
		Set_PlayerNextAttack(id, RELOAD_TIME)
	}
	
	return HAM_HANDLED
}

public fw_Weapon_WeaponIdle_Post( iEnt )
{
	if(pev_valid(iEnt) != 2)
		return
	static Id; Id = get_pdata_cbase(iEnt, 41, 4)
	if(get_pdata_cbase(Id, 373) != iEnt)
		return
	if(!Get_BitVar(g_Had_Base, Id))
		return
		
	static Idle; Idle = ANIME_IDLE
	
	if(Idle != -1 && get_pdata_float(iEnt, 48, 4) <= 0.25)
	{
		Set_WeaponAnim(Id, ANIME_IDLE)
		set_pdata_float(iEnt, 48, 20.0, 4)
	}	
}

public fw_TraceAttack_World(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
	if(!is_connected(Attacker))
		return HAM_IGNORED	
	if(get_player_weapon(Attacker) != CSW_BASE || !Get_BitVar(g_Had_Base, Attacker))
		return HAM_IGNORED
		
	static Float:flEnd[3], Float:vecPlane[3]
		
	get_tr2(Ptr, TR_vecEndPos, flEnd)
	get_tr2(Ptr, TR_vecPlaneNormal, vecPlane)		
			
	Make_BulletHole(Attacker, flEnd, Damage)
	Make_BulletSmoke(Attacker, Ptr)

	if(cs_get_user_zoom(Attacker) != CS_SET_AUGSG552_ZOOM) SetHamParamFloat(3, float(DAMAGE_A))
	else {
		SetHamParamFloat(3, float(DAMAGE_B))
		Create_Tracer(Attacker, flEnd)
	}
	
	return HAM_HANDLED
}

public fw_TraceAttack_Player(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
	if(!is_connected(Attacker))
		return HAM_IGNORED	
	if(get_player_weapon(Attacker) != CSW_BASE || !Get_BitVar(g_Had_Base, Attacker))
		return HAM_IGNORED

	static Float:flEnd[3]
	get_tr2(Ptr, TR_vecEndPos, flEnd)	
		
	if(cs_get_user_zoom(Attacker) != CS_SET_AUGSG552_ZOOM) SetHamParamFloat(3, float(DAMAGE_A))
	else {
		SetHamParamFloat(3, float(DAMAGE_B))
		Create_Tracer(Attacker, flEnd)
	}
	
	return HAM_HANDLED
}

public Create_Tracer(id, Float:Target[3])
{
	static Float:Start[3]; 
	Get_Position(id, 48.0, 6.0, -6.0, Start)
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_BEAMPOINTS)
	write_coord(Start[0]) 
	write_coord(Start[1]) 
	write_coord(Start[2]) 
	write_coord(Target[0]) 
	write_coord(Target[1]) 
	write_coord(Target[2]) 
	write_short(m_spriteTexture)
	write_byte(0) // framerate
	write_byte(0) // framerate
	write_byte(5) // life
	write_byte(2)  // width
	write_byte(0)   // noise
	write_byte(255)   // r, g, b
	write_byte(255)   // r, g, b
	write_byte(255)   // r, g, b
	write_byte(175)	// brightness
	write_byte(1)		// speed
	message_end()
}

public fw_Weapon_PrimaryAttack(Ent)
{
	static id; id = pev(Ent, pev_owner)
	if(!is_alive(id))
		return
	if(!Get_BitVar(g_Had_Base, id))
		return

	pev(id, pev_punchangle, g_Recoil[id])
}

public fw_Weapon_PrimaryAttack_Post(Ent)
{
	static id; id = pev(Ent, pev_owner)
	if(!is_alive(id))
		return
	if(!Get_BitVar(g_Had_Base, id))
		return

	static Float:Push[3]
	pev(id, pev_punchangle, Push)
	xs_vec_sub(Push, g_Recoil[id], Push)
	
	xs_vec_mul_scalar(Push, RECOIL, Push)
	xs_vec_add(Push, g_Recoil[id], Push)
	
	set_pev(id, pev_punchangle, Push)
	Set_BitVar(g_Muzzleflash, id)
	
	// Acc
	static Accena; Accena = ACCURACY
	if(Accena != -1)
	{
		static Float:Accuracy
		Accuracy = (float(100 - ACCURACY) * 1.5) / 100.0

		set_pdata_float(Ent, 62, Accuracy, 4);
	}
}

/* ===============================
------------- SAFETY -------------
=================================*/
public Register_SafetyFunc()
{
	register_event("CurWeapon", "Safety_CurWeapon", "be", "1=1")
	
	RegisterHam(Ham_Spawn, "player", "fw_Safety_Spawn_Post", 1)
	RegisterHam(Ham_Killed, "player", "fw_Safety_Killed_Post", 1)
}

public Register_SafetyFuncBot(id)
{
	RegisterHamFromEntity(Ham_Spawn, id, "fw_Safety_Spawn_Post", 1)
	RegisterHamFromEntity(Ham_Killed, id, "fw_Safety_Killed_Post", 1)
}

public Safety_Connected(id)
{
	Set_BitVar(g_IsConnected, id)
	UnSet_BitVar(g_IsAlive, id)
	
	g_PlayerWeapon[id] = 0
}

public Safety_Disconnected(id)
{
	UnSet_BitVar(g_IsConnected, id)
	UnSet_BitVar(g_IsAlive, id)
	
	g_PlayerWeapon[id] = 0
}

public Safety_CurWeapon(id)
{
	if(!is_alive(id))
		return
		
	static CSW; CSW = read_data(2)
	if(g_PlayerWeapon[id] != CSW) g_PlayerWeapon[id] = CSW
}

public fw_Safety_Spawn_Post(id)
{
	if(!is_user_alive(id))
		return
		
	Set_BitVar(g_IsAlive, id)
}

public fw_Safety_Killed_Post(id)
{
	UnSet_BitVar(g_IsAlive, id)
}

public is_connected(id)
{
	if(!(1 <= id <= 32))
		return 0
	if(!Get_BitVar(g_IsConnected, id))
		return 0

	return 1
}

public is_alive(id)
{
	if(!is_connected(id))
		return 0
	if(!Get_BitVar(g_IsAlive, id))
		return 0
		
	return 1
}

public get_player_weapon(id)
{
	if(!is_alive(id))
		return 0
	
	return g_PlayerWeapon[id]
}

/* ===============================
--------- END OF SAFETY  ---------
=================================*/

stock Set_WeaponAnim(id, anim)
{
	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 Make_BulletHole(id, Float:Origin[3], Float:Damage)
{
	// Find target
	static Decal; Decal = random_num(41, 45)
	static LoopTime; 
	
	if(Damage > 100.0) LoopTime = 2
	else LoopTime = 1
	
	for(new i = 0; i < LoopTime; i++)
	{
		// Put decal on "world" (a wall)
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_WORLDDECAL)
		engfunc(EngFunc_WriteCoord, Origin[0])
		engfunc(EngFunc_WriteCoord, Origin[1])
		engfunc(EngFunc_WriteCoord, Origin[2])
		write_byte(Decal)
		message_end()
		
		// Show sparcles
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_GUNSHOTDECAL)
		engfunc(EngFunc_WriteCoord, Origin[0])
		engfunc(EngFunc_WriteCoord, Origin[1])
		engfunc(EngFunc_WriteCoord, Origin[2])
		write_short(id)
		write_byte(Decal)
		message_end()
	}
}

stock Make_BulletSmoke(id, TrResult)
{
	static Float:vecSrc[3], Float:vecEnd[3], TE_FLAG
	
	get_weapon_attachment(id, vecSrc)
	global_get(glb_v_forward, vecEnd)
    
	xs_vec_mul_scalar(vecEnd, 8192.0, vecEnd)
	xs_vec_add(vecSrc, vecEnd, vecEnd)

	get_tr2(TrResult, TR_vecEndPos, vecSrc)
	get_tr2(TrResult, TR_vecPlaneNormal, vecEnd)
    
	xs_vec_mul_scalar(vecEnd, 2.5, vecEnd)
	xs_vec_add(vecSrc, vecEnd, vecEnd)
    
	TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
	TE_FLAG |= TE_EXPLFLAG_NOSOUND
	TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
	
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, vecEnd, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, vecEnd[0])
	engfunc(EngFunc_WriteCoord, vecEnd[1])
	engfunc(EngFunc_WriteCoord, vecEnd[2] - 10.0)
	write_short(g_SmokePuff_SprId)
	write_byte(2)
	write_byte(50)
	write_byte(TE_FLAG)
	message_end()
}

stock get_weapon_attachment(id, Float:output[3], Float:fDis = 40.0)
{ 
	static Float:vfEnd[3], viEnd[3] 
	get_user_origin(id, viEnd, 3)  
	IVecFVec(viEnd, vfEnd) 
	
	static Float:fOrigin[3], Float:fAngle[3]
	
	pev(id, pev_origin, fOrigin) 
	pev(id, pev_view_ofs, fAngle)
	
	xs_vec_add(fOrigin, fAngle, fOrigin) 
	
	static Float:fAttack[3]
	
	xs_vec_sub(vfEnd, fOrigin, fAttack)
	xs_vec_sub(vfEnd, fOrigin, fAttack) 
	
	static Float:fRate
	
	fRate = fDis / vector_length(fAttack)
	xs_vec_mul_scalar(fAttack, fRate, fAttack)
	
	xs_vec_add(fOrigin, fAttack, output)
}

stock get_position(id,Float:forw, Float:right, Float:up, Float:vStart[])
{
	new 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 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]
	new Float: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 Set_WeaponIdleTime(id, WeaponId ,Float:TimeIdle)
{
	static entwpn; entwpn = fm_get_user_weapon_entity(id, WeaponId)
	if(!pev_valid(entwpn)) 
		return
		
	set_pdata_float(entwpn, 46, TimeIdle, 4)
	set_pdata_float(entwpn, 47, TimeIdle, 4)
	set_pdata_float(entwpn, 48, TimeIdle + 0.5, 4)
}

stock Set_PlayerNextAttack(id, Float:nexttime)
{
	set_pdata_float(id, 83, nexttime, 5)
}

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
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1042\\ f0\\ fs16 \n\\ par }
*/
Frost m4a1:

Code: Select all

#include <zombie_escape>

native ze_set_vip_discount(iItemid, bool:bSet, Float:flDiscount);

new const V_M4A1_MODEL[] = "models/Premuim_ZE/v_frost_m4a1.mdl"
new const P_M4A1_MODEL[] = "models/Premuim_ZE/p_frost_m4a1.mdl"
new const W_M4A1_MODEL[] = "models/Premuim_ZE/w_frost_m4a1.mdl"
new const W_OLD_M4A1_MODEL[] = "models/w_m4a1.mdl"

new g_iItemID, g_iHudSync, g_iSpriteLaser, g_iFreezeDmg, g_iDmgMultiplier
new bool:g_bHasFrostM4A1[33]
new g_iDmg[33]

public plugin_init()
{
	register_plugin("[ZE] Extra Item: Frost M4A1", "1.1", "Spi")
	
	// Cvars
	g_iFreezeDmg = register_cvar("ze_freezing_m4a1_damage", "2000") // Damage Requried So Zombie got Frozen
	g_iDmgMultiplier = register_cvar("ze_multiplier_m4a1_damage", "2") // Multiplie Weapon Damage

	// Message IDS
	g_iHudSync = CreateHudSyncObj()
	
	// ITEM NAME & COST
	g_iItemID = ze_register_item("Frost M4A1", 100, 0) // It's cost 30 Ammo Pack
	ze_set_vip_discount(g_iItemID, true, 0.5)
	
	// Events
	register_event("WeapPickup", "CheckModel", "b", "1=19")
	register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
	
	// Forwards
	register_forward(FM_SetModel, "Fw_SetModel")
	
	// HookChains
	RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
	
	// Hams
	RegisterHam(Ham_TraceAttack, "player", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_TraceAttack, "worldspawn", "Fw_TraceAttack_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, "weapon_m4a1", "Fw_AddFrostM4A1ToPlayer")
}

public plugin_precache() 
{
	// Models
	precache_model(V_M4A1_MODEL)
	precache_model(P_M4A1_MODEL)
	precache_model(W_M4A1_MODEL)
	
	// Sprites
	g_iSpriteLaser = precache_model( "sprites/Newlightning.spr")
}

public client_disconnected(id)
{
	g_bHasFrostM4A1[id] = false
}

public ze_select_item_pre(id, itemid)
{
    // Return Available and we will block it in Post, So it dosen't affect other plugins
    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
   
    return ZE_ITEM_AVAILABLE
}

public ze_select_item_post(player, itemid)
{
    if (itemid != g_iItemID)
        return

    g_bHasFrostM4A1[player] = true

    rg_remove_item(player, "weapon_m4a1")
    rg_give_item(player, "weapon_m4a1", GT_APPEND)
    rg_set_user_bpammo(player, WeaponIdType:get_weaponid("weapon_m4a1"), 90)
	
    new szName[32]
    get_user_name(player, szName, charsmax(szName))
    
    set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
    show_hudmessage(0, "%s Has bought Frost M4A1!", szName)
    
    ze_colored_print(player, "!tYou Have bought Frost M4A1!y!")
}

public Fw_TraceAttack_Post(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
	if(!is_user_alive(iAttacker))
		return 
	
	if(get_user_weapon(iAttacker) != CSW_M4A1 || !g_bHasFrostM4A1[iAttacker])
		return
	
	set_hudmessage(34, 138, 255, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
	ShowSyncHudMsg(iAttacker, g_iHudSync, "Freeze Damage^n%d/%d", g_iDmg[iAttacker], get_pcvar_num(g_iFreezeDmg))
	
	new vec1[3], vec2[3]
	get_user_origin(iAttacker, vec1, 1) 
	get_user_origin(iAttacker, vec2, 4)

	make_beam(vec1, vec2, g_iSpriteLaser, 0, 50, 200, 200)
}

public ze_user_infected(infected)
{
	if (g_bHasFrostM4A1[infected])
	{
		g_bHasFrostM4A1[infected] = false
	}
}

public ze_user_humanized(id)
{
	g_bHasFrostM4A1[id] = false
	g_iDmg[id] = 0
}

public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
	// Not Vaild Victim or Attacker
	if (!is_user_connected(iVictim) || !is_user_connected(iAttacker))
		return HC_CONTINUE
	
	if (g_bHasFrostM4A1[iAttacker] && (get_user_weapon(iAttacker) == CSW_M4A1))
	{
		SetHookChainArg(4 , ATYPE_FLOAT, fDamage * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		g_iDmg[iAttacker] += (floatround(fDamage) * get_pcvar_num(g_iDmgMultiplier))
	}
	
	if((g_iDmg[iAttacker] >= get_pcvar_num(g_iFreezeDmg)) && (get_user_weapon(iAttacker) == CSW_M4A1) && g_bHasFrostM4A1[iAttacker])
	{
		new szName[32]
		get_user_name(iVictim, szName, charsmax(szName))
		
		ze_set_frost_grenade(iVictim, true)
		
		g_iDmg[iAttacker] = 0
		
		set_dhudmessage(34, 138, 255, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5)
		show_dhudmessage(iAttacker, "%s Has been Freezed!", szName)
	}
	return HC_CONTINUE
}

public CheckModel(id)
{
	if (is_user_alive(id))
	{
		set_pev(id, pev_viewmodel2, V_M4A1_MODEL)
		set_pev(id, pev_weaponmodel2, P_M4A1_MODEL)
	}
	return PLUGIN_CONTINUE
}

public CurrentWeapon(id)
{
	if ((get_user_weapon(id) == CSW_M4A1) && g_bHasFrostM4A1[id] == true)
	{
		CheckModel(id)
	}
	else
	{
		ClearSyncHud(id, g_iHudSync)
	}
	return PLUGIN_CONTINUE
}

make_beam(const origin2[3], const origin[3], sprite, red, green, blue, alpha)
{
	//BEAMENTPOINTS
	message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte (0) //TE_BEAMENTPOINTS 0
	write_coord(origin2[0])
	write_coord(origin2[1])
	write_coord(origin2[2])
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_short(sprite) // sprite
	write_byte(1) // framestart
	write_byte(5) // framerate
	write_byte(2) // life
	write_byte(20) // width
	write_byte(0) // noise 
	write_byte(red) // r, g, b
	write_byte(green) // r, g, b 
	write_byte(blue) // r, g, b 
	write_byte(alpha) // brightness
	write_byte(150) // speed
	message_end()
}

public Fw_SetModel(entity, model[])
{
	
	if(!is_valid_ent(entity)) 
		return FMRES_IGNORED

	if(!equali(model, W_OLD_M4A1_MODEL)) 
		return FMRES_IGNORED

	new className[33]
	entity_get_string(entity, EV_SZ_classname, className, 32)

	static iOwner, iStoredM4A1ID

	// Frost M4A1 Owner
	iOwner = entity_get_edict(entity, EV_ENT_owner)

	// Get drop weapon index (Frost M4A1) to use in fw_FrostM4A1AddToPlayer forward
	iStoredM4A1ID = find_ent_by_owner(-1, "weapon_m4a1", entity)

	// If Player Has Frost M4A1 and It's weapon_m4a1
	if(g_bHasFrostM4A1[iOwner] && is_valid_ent(iStoredM4A1ID))
	{
		// Setting weapon options
		entity_set_int(iStoredM4A1ID, EV_INT_impulse, 1997)

		// Rest Var
		g_bHasFrostM4A1[iOwner] = false
		
		// Set weaponbox new model
		entity_set_model(entity, W_M4A1_MODEL)
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED
}

public Fw_AddFrostM4A1ToPlayer(FrostM4A1, id)
{
	// Make sure that this is M4A1
	if(is_valid_ent(FrostM4A1) && is_user_connected(id) && entity_get_int(FrostM4A1, EV_INT_impulse) == 1997)
	{
		// Update Var
		g_bHasFrostM4A1[id] = true

		// Reset weapon options
		entity_set_int(FrostM4A1, EV_INT_impulse, 0)
		return HAM_HANDLED
	}
	return HAM_IGNORED
}
Plasma Gun:

Code: Select all

#include <zombie_escape>
#include <fakemeta_util>
#include <cstrike>

native ze_set_vip_discount(iItemid, bool:bSet, Float:flDiscount);


#define PLUGIN "[CSO] PlasmaGun"
#define VERSION "1.0"
#define AUTHOR "Dias Leon"

// ================= Config =================
// ZP Config
#define COST 30

// Level 1 Config
#define V_MODEL "models/Premuim_ZE/v_plasma_gun.mdl"
#define P_MODEL "models/Premuim_ZE/p_plasma_gun.mdl"
#define W_MODEL "models/Premuim_ZE/w_plasma_gun.mdl" 

new const WeaponSounds[7][] =
{
	"weapons/plasmagun-1.wav",
	"weapons/plasmagun_exp.wav",
	"weapons/plasmagun_idle.wav",
	"weapons/plasmagun_draw.wav",
	"weapons/plasmagun_clipin1.wav",
	"weapons/plasmagun_clipin2.wav",
	"weapons/plasmagun_clipout.wav"
}

new const WeaponResources[3][] =
{
	"sprites/weapon_plasmagun.txt",
	"sprites/640hud3_2.spr",
	"sprites/640hud91_2.spr"
}

new const WeaponFiles[2][] =
{
	"sprites/plasmaball.spr",
	"sprites/plasmabomb.spr"
}

new const MuzzleFlash[] = "sprites/muzzleflash27.spr"

// Level 2 Config
#define DAMAGE 86
#define CLIP 45
#define BPAMMO 250
#define SPEED 1.5
#define RECOIL 0.75

#define PLASMA_SPEED 1000.0
#define PLASMA_RADIUS 100.0

// Level 3 Config
#define CSW_PLASMA CSW_AK47
#define weapon_plasma "weapon_ak47"

#define WEAPON_EVENT "events/ak47.sc"
#define WEAPON_ANIMEXT "carbine"
#define WEAPON_OLD_WMODEL "models/w_ak47.mdl"
#define WEAPON_SECRETCODE 1946

#define WEAPONANIM_SHOOT random_num(3, 5)
#define WEAPONANIM_RELOAD 1

#define WEAPONTIME_DRAW 0.75
#define WEAPONTIME_RELOAD 3.5

// Level 4 Config
#define PLASMABALL_CLASSNAME "plasmaball"
// ============== End of Config ==============

// MACROS
#define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31)))
#define Set_BitVar(%1,%2) %1 |= (1 << (%2 & 31))
#define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31))

enum
{
	TEAM_T = 1,
	TEAM_CT
}

// Vars
new g_iItemID 
new g_Had_Plasma, g_WeaponClip[33], Float:g_WeaponRecoil[33][3]
new g_Msg_WeaponList, g_Msg_CurWeapon, g_Msg_AmmoX
new g_MuzzleFlash_SprId, g_PlasmaExp_SprId, g_weapon_event, g_HamBot, g_MaxPlayers

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
	g_iItemID = ze_register_item("Plasma Gun", 120, 0) 
	ze_set_vip_discount(g_iItemID, true, 0.5)
	
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)	
	register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")	
	register_forward(FM_SetModel, "fw_SetModel")		
	
	register_think(PLASMABALL_CLASSNAME, "fw_Think_Plasma")
	register_touch(PLASMABALL_CLASSNAME, "*", "fw_Touch_Plasma")
	
	RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack_World")
	RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack_Player")	
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_plasma, "fw_Weapon_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, weapon_plasma, "fw_Weapon_PrimaryAttack_Post", 1)
	RegisterHam(Ham_Item_Deploy, weapon_plasma, "fw_Item_Deploy_Post", 1)
	RegisterHam(Ham_Item_PostFrame, weapon_plasma, "fw_Item_PostFrame")	
	RegisterHam(Ham_Weapon_Reload, weapon_plasma, "fw_Weapon_Reload")
	RegisterHam(Ham_Weapon_Reload, weapon_plasma, "fw_Weapon_Reload_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, weapon_plasma, "fw_Item_AddToPlayer_Post", 1)
	
	g_Msg_WeaponList = get_user_msgid("WeaponList")
	g_Msg_CurWeapon = get_user_msgid("CurWeapon")
	g_Msg_AmmoX = get_user_msgid("AmmoX")
	g_MaxPlayers = get_maxplayers()
	
	//register_clcmd("admin_get_plasmagun", "Get_Plasma", ADMIN_KICK)
	register_clcmd("weapon_plasmagun", "Hook_WeaponHud")
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheModel, V_MODEL)
	engfunc(EngFunc_PrecacheModel, P_MODEL)
	engfunc(EngFunc_PrecacheModel, W_MODEL)
	
	new i
	for(i = 0; i < sizeof(WeaponSounds); i++)
		engfunc(EngFunc_PrecacheSound, WeaponSounds[i])
	for(i = 0; i < sizeof(WeaponResources); i++)
	{
		if(i == 0) engfunc(EngFunc_PrecacheGeneric, WeaponResources[i])
		else engfunc(EngFunc_PrecacheModel, WeaponResources[i])
	}
	for(i = 0; i < sizeof(WeaponFiles); i++)
	{
		if(i == 1) g_PlasmaExp_SprId = engfunc(EngFunc_PrecacheModel, WeaponFiles[i])
		else engfunc(EngFunc_PrecacheModel, WeaponFiles[i])
	}
		
	g_MuzzleFlash_SprId = engfunc(EngFunc_PrecacheModel, MuzzleFlash)
	register_forward(FM_PrecacheEvent, "fw_PrecacheEvent_Post", 1)
}

public fw_PrecacheEvent_Post(type, const name[])
{
	if(equal(WEAPON_EVENT, name)) g_weapon_event = get_orig_retval()		
}

public client_putinserver(id)
{
	if(!g_HamBot && is_user_bot(id))
	{
		g_HamBot = 1
		set_task(0.1, "Do_RegisterHam", id)
	}
}

public Do_RegisterHam(id)
{
	RegisterHamFromEntity(Ham_TraceAttack, id, "fw_TraceAttack_Player")	
} 

public ze_user_infected(id) Remove_Plasma(id)
public ze_user_humanized(id) Remove_Plasma(id)

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_Plasma(id)        
}

public Get_Plasma(id)
{
	if(!is_user_alive(id))
		return
		
	Set_BitVar(g_Had_Plasma, id)
	fm_give_item(id, weapon_plasma)
	
	// Set Weapon
	engclient_cmd(id, weapon_plasma)
	
	set_pev(id, pev_viewmodel2, V_MODEL)
	set_pev(id, pev_weaponmodel2, P_MODEL)
	
	set_pdata_string(id, (492) * 4, WEAPON_ANIMEXT, -1 , 20)	
	
	// Set Weapon Base
	static Ent; Ent = fm_get_user_weapon_entity(id, CSW_PLASMA)
	if(!pev_valid(Ent)) return
	
	cs_set_weapon_ammo(Ent, CLIP)
	cs_set_user_bpammo(id, CSW_PLASMA, BPAMMO)
	
	Update_AmmoHud(id, CSW_PLASMA, CLIP, BPAMMO)
}

public Remove_Plasma(id)
{
	UnSet_BitVar(g_Had_Plasma, id)
}

public Hook_WeaponHud(id)
{
	engclient_cmd(id, weapon_plasma)
	return PLUGIN_HANDLED
}

public Event_NewRound() remove_entity_name(PLASMABALL_CLASSNAME)

public fw_Think_Plasma(Ent)
{
	if(!pev_valid(Ent))
		return
		
	static Float:RenderAmt; pev(Ent, pev_renderamt, RenderAmt)
	
	RenderAmt += 50.0
	RenderAmt = float(clamp(floatround(RenderAmt), 0, 255))
	
	set_pev(Ent, pev_renderamt, RenderAmt)
	set_pev(Ent, pev_nextthink, halflife_time() + 0.1)
}

public fw_Touch_Plasma(Ent, Id)
{
	if(!pev_valid(Ent))
		return
	if(pev(Ent, pev_movetype) == MOVETYPE_NONE)
		return
		
	// Exp Sprite
	static Float:Origin[3], TE_FLAG
	pev(Ent, pev_origin, Origin)
	
	TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
	TE_FLAG |= TE_EXPLFLAG_NOSOUND
	TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, Origin[0])
	engfunc(EngFunc_WriteCoord, Origin[1])
	engfunc(EngFunc_WriteCoord, Origin[2])
	write_short(g_PlasmaExp_SprId)
	write_byte(7)
	write_byte(30)
	write_byte(TE_FLAG)
	message_end()	
	
	// Exp Sound
	emit_sound(Ent, CHAN_BODY, WeaponSounds[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	
	// Damage
	Damage_Plasma(Ent, Id)
	
	// Remove Ent
	set_pev(Ent, pev_movetype, MOVETYPE_NONE)
	set_task(0.1, "Remove_PlasmaBall", Ent)
}

public Damage_Plasma(Ent, Id)
{
	static Owner; Owner = pev(Ent, pev_iuser1)
	static Attacker; 
	if(!is_user_alive(Owner)) 
	{
		Attacker = 0
		return
	} else Attacker = Owner
	
	if(is_user_alive(Id) && ze_is_user_zombie(Id))
		ExecuteHamB(Ham_TakeDamage, Id, 0, Attacker, float(DAMAGE), DMG_ACID)
	
	for(new i = 0; i < g_MaxPlayers; i++)
	{
		if(!is_user_alive(i))
			continue
		if(entity_range(i, Ent) > PLASMA_RADIUS)
			continue
		if(!ze_is_user_zombie(i)) 
			continue
			
		ExecuteHamB(Ham_TakeDamage, i, 0, Attacker, float(DAMAGE) / random_float(1.25, 1.5), DMG_ACID)
	}
}

public Remove_PlasmaBall(Ent)
{
	if(!pev_valid(Ent)) return
	engfunc(EngFunc_RemoveEntity, Ent)
}

public fw_UpdateClientData_Post(id, sendweapons, cd_handle)
{
	if(!is_user_alive(id))
		return FMRES_IGNORED	
	if(get_user_weapon(id) == CSW_PLASMA && Get_BitVar(g_Had_Plasma, id))
		set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001) 
	
	return FMRES_HANDLED
}

public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if (!is_user_connected(invoker))
		return FMRES_IGNORED	
	if(get_user_weapon(invoker) != CSW_PLASMA || !Get_BitVar(g_Had_Plasma, invoker))
		return FMRES_IGNORED
	if(eventid != g_weapon_event)
		return FMRES_IGNORED
	
	engfunc(EngFunc_PlaybackEvent, flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
	
	return FMRES_SUPERCEDE
}

public fw_SetModel(entity, model[])
{
	if(!pev_valid(entity))
		return FMRES_IGNORED
	
	static Classname[32]
	pev(entity, pev_classname, Classname, sizeof(Classname))
	
	if(!equal(Classname, "weaponbox"))
		return FMRES_IGNORED
	
	static iOwner
	iOwner = pev(entity, pev_owner)
	
	if(equal(model, WEAPON_OLD_WMODEL))
	{
		static weapon; weapon = fm_find_ent_by_owner(-1, weapon_plasma, entity)
		
		if(!pev_valid(weapon))
			return FMRES_IGNORED;
		
		if(Get_BitVar(g_Had_Plasma, iOwner))
		{
			Remove_Plasma(iOwner)
			
			set_pev(weapon, pev_impulse, WEAPON_SECRETCODE)
			engfunc(EngFunc_SetModel, entity, W_MODEL)
			
			return FMRES_SUPERCEDE
		}
	}

	return FMRES_IGNORED;
}

public fw_TraceAttack_World(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
	if(!is_user_connected(Attacker))
		return HAM_IGNORED	
	if(get_user_weapon(Attacker) != CSW_PLASMA || !Get_BitVar(g_Had_Plasma, Attacker))
		return HAM_IGNORED
	
	return HAM_SUPERCEDE
}

public fw_TraceAttack_Player(Victim, Attacker, Float:Damage, Float:Direction[3], Ptr, DamageBits)
{
	if(!is_user_connected(Attacker))
		return HAM_IGNORED	
	if(get_user_weapon(Attacker) != CSW_PLASMA || !Get_BitVar(g_Had_Plasma, Attacker))
		return HAM_IGNORED
		
	return HAM_SUPERCEDE
}

public fw_Weapon_PrimaryAttack(Ent)
{
	if(!pev_valid(Ent))
		return
		
	static Id; Id = pev(Ent, pev_owner)
	if(!Get_BitVar(g_Had_Plasma, Id))
		return
	static Ammo; Ammo = cs_get_weapon_ammo(Ent)
	if(Ammo <= 0) return

	// Weapon Shoot
	Set_Weapon_Anim(Id, WEAPONANIM_SHOOT)
	emit_sound(Id, CHAN_WEAPON, WeaponSounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	
	// MuzzleFlash & Effect
	Make_Muzzleflash(Id)
	
	// Create Plasma Effect
	Create_PlasmaBall(Id)
	
	// Speed & Recoil
	pev(Ent, pev_punchangle, g_WeaponRecoil[Id])
}

public fw_Weapon_PrimaryAttack_Post(Ent)
{
	if(!pev_valid(Ent))
		return
		
	static Id; Id = pev(Ent, pev_owner)
	if(!Get_BitVar(g_Had_Plasma, Id))
		return
	static Ammo; Ammo = cs_get_weapon_ammo(Ent)
	if(Ammo <= 0) return
	
	// Speed & Recoil
	set_pdata_float(Ent, 46, get_pdata_float(Ent, 46, 4) * SPEED, 4)
	
	static Float:Push[3]; pev(Id, pev_punchangle, Push)
	
	xs_vec_sub(Push, g_WeaponRecoil[Id], Push)
	xs_vec_mul_scalar(Push, RECOIL, Push)
	xs_vec_add(Push,  g_WeaponRecoil[Id], Push)

	set_pev(Id, pev_punchangle, Push)
}

public fw_Item_Deploy_Post(Ent)
{
	if(!pev_valid(Ent))
		return
		
	static Id; Id = pev(Ent, pev_owner)
	if(!Get_BitVar(g_Had_Plasma, Id))
		return
		
	set_pev(Id, pev_viewmodel2, V_MODEL)
	set_pev(Id, pev_weaponmodel2, P_MODEL)
	
	set_pdata_string(Id, (492) * 4, WEAPON_ANIMEXT, -1 , 20)
	
	// Set Draw
	Set_Player_NextAttack(Id, WEAPONTIME_DRAW)
	Set_Weapon_TimeIdle(Id, CSW_PLASMA, WEAPONTIME_DRAW)
}

public fw_Item_PostFrame(Ent)
{
	if(!pev_valid(Ent))
		return
		
	static Id; Id = pev(Ent, pev_owner)
	if(!Get_BitVar(g_Had_Plasma, Id))
		return
	
	static Float:flNextAttack; flNextAttack = get_pdata_float(Id, 83, 5)
	static bpammo; bpammo = cs_get_user_bpammo(Id, CSW_PLASMA)
	static iClip; iClip = get_pdata_int(Ent, 51, 4)

	if(get_pdata_int(Ent, 54, 4) && flNextAttack <= 0.0)
	{
		static temp1; temp1 = min(CLIP - iClip, bpammo)

		set_pdata_int(Ent, 51, iClip + temp1, 4)
		cs_set_user_bpammo(Id, CSW_PLASMA, bpammo - temp1)		
		
		set_pdata_int(Ent, 54, 0, 4)
	}		
}

public fw_Weapon_Reload(Ent)
{
	if(!pev_valid(Ent))
		return HAM_IGNORED
		
	static Id; Id = pev(Ent, pev_owner)
	if(!Get_BitVar(g_Had_Plasma, Id))
		return HAM_IGNORED
		
	g_WeaponClip[Id] = -1
	
	static bpammo; bpammo = cs_get_user_bpammo(Id, CSW_PLASMA)
	static iClip; iClip = get_pdata_int(Ent, 51, 4)
	
	if(bpammo <= 0) return HAM_SUPERCEDE
	if(iClip >= CLIP) return HAM_SUPERCEDE
		
	g_WeaponClip[Id] = iClip
	return HAM_IGNORED
}

public fw_Weapon_Reload_Post(Ent)
{
	if(!pev_valid(Ent))
		return
		
	static Id; Id = pev(Ent, pev_owner)
	if(!Get_BitVar(g_Had_Plasma, Id))
		return
	if(g_WeaponClip[Id] == -1)
		return
	
	set_pdata_int(Ent, 51, g_WeaponClip[Id], 4)
	set_pdata_int(Ent, 54, 1, 4)
	
	Set_Weapon_Anim(Id, WEAPONANIM_RELOAD)
	set_pdata_float(Id, 83, WEAPONTIME_RELOAD, 5)
}

public fw_Item_AddToPlayer_Post(Ent, Id)
{
	if(!pev_valid(Ent))
		return
		
	if(pev(Ent, pev_impulse) == WEAPON_SECRETCODE)
	{
		Set_BitVar(g_Had_Plasma, Id)
		set_pev(Ent, pev_impulse, 0)
		
		set_task(0.01, "AddToPlayer_Delay", Id)
	}		

	message_begin(MSG_ONE_UNRELIABLE, g_Msg_WeaponList, _, Id)
	write_string(Get_BitVar(g_Had_Plasma, Id) ? "weapon_plasmagun" : "weapon_ak47")
	write_byte(2)
	write_byte(Get_BitVar(g_Had_Plasma, Id) ? 200 : 90)
	write_byte(-1)
	write_byte(-1)
	write_byte(0)
	write_byte(1)
	write_byte(Get_BitVar(g_Had_Plasma, Id) ? CSW_PLASMA : CSW_AK47)
	write_byte(0)
	message_end()			
	
	return
}

public AddToPlayer_Delay(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)	
}
		
public Create_PlasmaBall(id)
{
	static Float:StartOrigin[3], Float:TargetOrigin[3], Float:MyVelocity[3], Float:VecLength
	
	get_position(id, 48.0, 10.0, -5.0, StartOrigin)
	get_position(id, 1024.0, 0.0, 0.0, TargetOrigin)
	
	pev(id, pev_velocity, MyVelocity)
	VecLength = vector_length(MyVelocity)
	
	if(VecLength) 
	{
		TargetOrigin[0] += random_float(-16.0, 16.0); TargetOrigin[1] += random_float(-16.0, 16.0); TargetOrigin[2] += random_float(-16.0, 16.0)
	} else {
		TargetOrigin[0] += random_float(-8.0, 8.0); TargetOrigin[1] += random_float(-8.0, 8.0); TargetOrigin[2] += random_float(-8.0, 8.0)
	}
	
	static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
	if(!pev_valid(Ent)) return
	
	// Set info for ent
	set_pev(Ent, pev_movetype, MOVETYPE_FLY)
	set_pev(Ent, pev_rendermode, kRenderTransAdd)
	set_pev(Ent, pev_renderamt, 10.0)
	set_pev(Ent, pev_iuser1, id) // Better than pev_owner
	set_pev(Ent, pev_iuser2, Get_SpecialTeam(id, cs_get_user_team(id)))
	set_pev(Ent, pev_fuser1, get_gametime() + 3.0)
	set_pev(Ent, pev_scale, random_float(0.1, 0.25))
	set_pev(Ent, pev_nextthink, halflife_time() + 0.1)
	
	entity_set_string(Ent, EV_SZ_classname, PLASMABALL_CLASSNAME)
	engfunc(EngFunc_SetModel, Ent, WeaponFiles[0])
	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_gravity, 0.01)
	set_pev(Ent, pev_solid, SOLID_TRIGGER)
	set_pev(Ent, pev_frame, 0.0)
	
	static Float:Velocity[3]
	get_speed_vector(StartOrigin, TargetOrigin, PLASMA_SPEED, Velocity)
	set_pev(Ent, pev_velocity, Velocity)
}

public Make_Muzzleflash(id)
{
	static Float:Origin[3], TE_FLAG
	get_position(id, 32.0, 6.0, -15.0, Origin)
	
	TE_FLAG |= TE_EXPLFLAG_NODLIGHTS
	TE_FLAG |= TE_EXPLFLAG_NOSOUND
	TE_FLAG |= TE_EXPLFLAG_NOPARTICLES
	
	engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, Origin, id)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, Origin[0])
	engfunc(EngFunc_WriteCoord, Origin[1])
	engfunc(EngFunc_WriteCoord, Origin[2])
	write_short(g_MuzzleFlash_SprId)
	write_byte(2)
	write_byte(30)
	write_byte(TE_FLAG)
	message_end()
}

public Update_AmmoHud(id, CSWID, Ammo, BpAmmo)
{
	message_begin(MSG_ONE_UNRELIABLE, g_Msg_CurWeapon, _, id)
	write_byte(1)
	write_byte(CSWID)
	write_byte(Ammo)
	message_end()
	
	message_begin(MSG_ONE_UNRELIABLE, g_Msg_AmmoX, _, id)
	write_byte(10)
	write_byte(BpAmmo)
	message_end()
}

public Get_SpecialTeam(Ent, CsTeams:Team)
{
	if(Team == CS_TEAM_T) return TEAM_T
	else if(Team == CS_TEAM_CT) return TEAM_CT
	
	return 0
}

public CsTeams:Get_PlasmaTeam(Ent)
{
	if(pev(Ent, pev_iuser2) == TEAM_T) return CS_TEAM_T
	else if(pev(Ent, pev_iuser2) == TEAM_CT) return CS_TEAM_CT
	
	return CS_TEAM_UNASSIGNED
}

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 Set_Weapon_TimeIdle(id, WeaponId, Float:TimeIdle)
{
	static Ent; Ent = fm_get_user_weapon_entity(id, WeaponId)
	if(!pev_valid(Ent)) return
		
	set_pdata_float(Ent, 46, TimeIdle, 4)
	set_pdata_float(Ent, 47, TimeIdle, 4)
	set_pdata_float(Ent, 48, TimeIdle + 0.5, 4)
}

stock Set_Player_NextAttack(id, Float:nexttime)
{
	set_pdata_float(id, 83, nexttime, 5)
}

stock Set_Weapon_Anim(id, WeaponAnim)
{
	set_pev(id, pev_weaponanim, WeaponAnim)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
	write_byte(WeaponAnim)
	write_byte(pev(id, pev_body))
	message_end()
}

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
}
I trynna make money, not friends.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#2

Post by Spir0x » 8 Months Ago

Up.
I trynna make money, not friends.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#3

Post by Spir0x » 8 Months Ago

Up
I trynna make money, not friends.

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#4

Post by Spir0x » 8 Months Ago

Up
I trynna make money, not friends.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 508
Joined: 2 Years Ago
Has thanked: 19 times
Been thanked: 1 time
Contact:

#5

Post by czirimbolo » 8 Months Ago

Try to add to every gun this:

Code: Select all

#include <engine>
Image

User avatar
Spir0x
Veteran Member
Veteran Member
Tunisia
Posts: 633
Joined: 2 Years Ago
Location: Tunisia
Has thanked: 14 times
Been thanked: 7 times
Age: 19
Contact:

#6

Post by Spir0x » 8 Months Ago

Thanks fixed :)
I trynna make money, not friends.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests