Raised This Month: $27 Target: $400
 6% 

How to edit some codes in blookak plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Supremache
Senior Member
Join Date: Sep 2019
Old 03-29-2020 , 02:07   How to edit some codes in blookak plugin
Reply With Quote #1

Hello Guys...I need help..
I have "bLoodAK" plugin but this plugin had made for extra items so i want to edit it for money shop
I tried to add this code
PHP Code:
cvar_cost register_cvar("goldenak_cost""10000"
but it didn't work And i added this code
// Register The Buy Cmd
PHP Code:
register_clcmd("say /goldenak""CmdBuyak")
    
register_clcmd("say_team /goldenak""CmdBuyak")
    
register_concmd("amx_goldenak""CmdGiveak"ADMIN_BAN"<name>"
Also didn't worked

File .sma
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <xs>
//#include <zombieplague>

#define PLUGIN "[ZP] AK47 Palladin Bloodmoon"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

// CONFIGURATION WEAPON
#define system_name        "bak47p"
#define system_base        "ak47"

#define DRAW_TIME        0.66
#define RELOAD_TIME        2.1

#define CSW_BAK47P        CSW_AK47
#define WEAPON_KEY         110918273

#define OLD_MODEL        "models/w_ak47.mdl"
#define ANIMEXT            "carbine"

/*
Support For Human And Survivor
Not Supported For Zombie || Madafaka!!
- ZP_TEAM HUMAN = HUMAN
- ZP_TEAM_SURVIVOR = SURVIVOR
*/

// ALL MACRO
#define ENG_NULLENT        -1
#define EV_INT_WEAPONKEY    EV_INT_impulse
#define TASK_MUZZLEFLASH    102291

#define USE_STOPPED         0
#define OFFSET_LINUX_WEAPONS     4
#define OFFSET_LINUX         5
#define OFFSET_WEAPONOWNER     41
#define OFFSET_ACTIVE_ITEM     373

#define m_fKnown        44
#define m_flNextPrimaryAttack     46
#define m_flTimeWeaponIdle    48
#define m_iClip            51
#define m_fInReload        54
#define m_flNextAttack        83
#define write_coord_f(%1)    engfunc(EngFunc_WriteCoord,%1)

// ALL ANIM
#define ANIM_RELOAD        1
#define ANIM_DRAW        2
#define ANIM_SHOOT1        3
#define ANIM_SHOOT2        4
#define ANIM_SHOOT3        5

#define MODE_A            0
#define MODE_B            1

// All Models Of The Weapon
new V_MODEL[64] = "models/v_bak47p.mdl"
new W_MODEL[64] = "models/w_bak47p.mdl"
new P_MODEL[64] = "models/p_bak47p.mdl"
new S_MODEL[64] = "sprites/bak47p/ef_buffak_hit.spr"

new const WeaponResources[][] =
{
    
"sprites/bak47p/bak47p.spr",
    
"sprites/bak47p/bak47p.spr"
}

new const 
MuzzleFlash[][] =
{
    
"sprites/bak47p/muzzleflash60.spr",
    
"sprites/bak47p/muzzleflash65.spr",
    
"sprites/bak47p/muzzleflash70.spr"
}

// You Can Add Fire Sound Here
new const Fire_Sounds[][] = { "weapons/bak47p-1.wav""weapons/bak47p-2.wav" }

// All Vars Here
new const GUNSHOT_DECALS[] = { 4142434445 }
new 
cvar_dmgcvar_recoilcvar_clipcvar_spdcvar_ammocvar_radiuscvar_dmg_2cvar_trace_colorg_bak47p
new g_MaxPlayersg_orig_eventg_IsInPrimaryAttackg_attack_type[33], Float:cl_pushangle[33][3]
new 
g_had_bak47p[33], g_clip_ammo[33], g_weapon_TmpClip[33], oldweap[33], sBuffakHit
new g_Muzzleflash_Ent[2], g_Muzzleflash[33][2], g_Mode[33], g_itemg_list_variables[10]

// Macros Again :v
new weapon_name_buffer[512]
new 
weapon_base_buffer[512]
        
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)
new const 
WEAPONENTNAMES[][] = { """weapon_p228""""weapon_scout""weapon_hegrenade""weapon_xm1014""weapon_c4""weapon_mac10",
            
"weapon_aug""weapon_smokegrenade""weapon_elite""weapon_fiveseven""weapon_ump45""weapon_sg550",
            
"weapon_galil""weapon_famas""weapon_usp""weapon_glock18""weapon_awp""weapon_mp5navy""weapon_m249",
            
"weapon_m3""weapon_m4a1""weapon_tmp""weapon_g3sg1""weapon_flashbang""weapon_deagle""weapon_sg552",
            
"weapon_ak47""weapon_knife""weapon_p90" }

// START TO CREATE PLUGINS || AMXMODX FORWARD
public plugin_init()
{
    
formatex(weapon_name_buffersizeof(weapon_name_buffer), "weapon_%s_asep"system_name)
    
formatex(weapon_base_buffersizeof(weapon_base_buffer), "weapon_%s"system_base)
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Event And Message
    
register_event("CurWeapon""Forward_CurrentWeapon""be""1=1")
    
register_message(get_user_msgid("DeathMsg"), "Forward_DeathMsg")
    
register_message(get_user_msgid("WeaponList"), "Forward_MessageWeapList")
    
    
// Ham Forward (Entity) || Ham_Use
    
RegisterHam(Ham_Use"func_tank""Forward_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tankmortar""Forward_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tankrocket""Forward_UseStationary_Post"1)
    
RegisterHam(Ham_Use"func_tanklaser""Forward_UseStationary_Post"1)
    
    
// Ham Forward (Entity) || Ham_TraceAttack
    
RegisterHam(Ham_TraceAttack"player""Forward_TraceAttack"1)
    
RegisterHam(Ham_TraceAttack"worldspawn""Forward_TraceAttack"1)
    
RegisterHam(Ham_TraceAttack"func_wall""Forward_TraceAttack"1)
    
RegisterHam(Ham_TraceAttack"func_breakable""Forward_TraceAttack"1)
    
RegisterHam(Ham_TraceAttack"func_door""Forward_TraceAttack"1)
    
RegisterHam(Ham_TraceAttack"func_door_rotating""Forward_TraceAttack"1)
    
RegisterHam(Ham_TraceAttack"func_rotating""Forward_TraceAttack"1)
    
RegisterHam(Ham_TraceAttack"func_plat""Forward_TraceAttack"1)
    
    
// Ham Forward (Weapon)
    
RegisterHam(Ham_Weapon_PrimaryAttackweapon_base_buffer"Weapon_PrimaryAttack")
    
RegisterHam(Ham_Weapon_PrimaryAttackweapon_base_buffer"Weapon_PrimaryAttack_Post"1)
    
RegisterHam(Ham_Item_PostFrameweapon_base_buffer"Weapon_ItemPostFrame")
    
RegisterHam(Ham_Weapon_Reloadweapon_base_buffer"Weapon_Reload")
    
RegisterHam(Ham_Weapon_Reloadweapon_base_buffer"Weapon_Reload_Post"1)
    
RegisterHam(Ham_Item_AddToPlayerweapon_base_buffer"Weapon_AddToPlayer")
    
    for(new 
1sizeof WEAPONENTNAMESi++)
        if(
WEAPONENTNAMES[i][0]) RegisterHam(Ham_Item_DeployWEAPONENTNAMES[i], "Weapon_Deploy_Post"1)
        
    
// Ham Forward (Player)
    
RegisterHam(Ham_Killed"player""Forward_PlayerKilled")
    
    
// Fakemeta Forward
    
register_forward(FM_SetModel"Forward_SetModel")
    
register_forward(FM_PlaybackEvent"Forward_PlaybackEvent")
    
register_forward(FM_UpdateClientData"Forward_UpdateClientData_Post"1)
    
register_forward(FM_AddToFullPack"Forward_AddToFullPack"1)
    
register_forward(FM_CheckVisibility"Forward_CheckVisibility")
    
    
// All Some Cvar
    
cvar_clip register_cvar("bak47p_clip""50")
    
cvar_spd register_cvar("bak47p_speed""1.15")
    
cvar_ammo register_cvar("bak47p_ammo""240")
    
cvar_dmg register_cvar("bak47p_damage""2.1")
    
cvar_recoil register_cvar("bak47p_recoil""0.62")
    
cvar_dmg_2 register_cvar("bak47p_buff_damage""350")
    
cvar_radius register_cvar("bak47p_buff_radius""75")
    
cvar_trace_color register_cvar("bak47p_trace_color""7")
    
    
g_MaxPlayers get_maxplayers()
    
//g_bak47p = zp_register_extra_item("bak47p", 50, ZP_TEAM_HUMAN)
}

public 
plugin_precache()
{
    
formatex(weapon_name_buffersizeof(weapon_name_buffer), "weapon_%s"system_name)
    
formatex(weapon_base_buffersizeof(weapon_base_buffer), "weapon_%s"system_base)
    
    
precache_model(V_MODEL)
    
precache_model(P_MODEL)
    
precache_model(W_MODEL)
    
sBuffakHit precache_model(S_MODEL)
    
    new 
Buffer[512]
    
formatex(Buffersizeof(Buffer), "sprites/%s.txt"weapon_name_buffer)
    
precache_generic(Buffer// EG: Output "sprites/weapon_bak47p.txt"
    
    
for(new 0sizeof Fire_Soundsi++)
        
precache_sound(Fire_Sounds[i])
    for(new 
0sizeof MuzzleFlashi++)
        
precache_model(MuzzleFlash[i])
    for(new 
0sizeof WeaponResourcesi++)
        
precache_model(WeaponResources[i])
        
    
precache_viewmodel_sound(V_MODEL)
    
formatex(Buffersizeof(Buffer), "test_%s"system_name)
    
    
register_clcmd(Buffer"get_bak47p"// EG: Output "test_bak47p"
    
register_clcmd(weapon_name_buffer"weapon_hook")
    
register_forward(FM_PrecacheEvent"Forward_PrecacheEvent_Post"1)
    
    
g_Muzzleflash_Ent[0] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
engfunc(EngFunc_SetModelg_Muzzleflash_Ent[0], MuzzleFlash[0])
    
set_pev(g_Muzzleflash_Ent[0], pev_scale0.08)
    
set_pev(g_Muzzleflash_Ent[0], pev_rendermodekRenderTransTexture)
    
set_pev(g_Muzzleflash_Ent[0], pev_renderamt0.0)

    
g_Muzzleflash_Ent[1] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
engfunc(EngFunc_SetModelg_Muzzleflash_Ent[1], MuzzleFlash[1])
    
set_pev(g_Muzzleflash_Ent[1], pev_scale0.07)
    
set_pev(g_Muzzleflash_Ent[1], pev_rendermodekRenderTransTexture)
    
set_pev(g_Muzzleflash_Ent[1], pev_renderamt0.0)
}

/*public plugin_natives()
{
    register_native("get_bak47p", "native_get_bak47p", 1)
    register_native("remove_bak47p", "native_remove_bak47p", 1)
}

public native_get_bak47p(id)
{
    get_bak47p(id)
}

public zp_extra_item_selected(id, wpnid)
{
    if(wpnid == g_bak47p) get_bak47p(id)
}*/

// Reset Bitvar (Fix Bug) If You Connect Or Disconnect Server
public client_connect(idremove_bak47p(id)
public 
client_disconnect(idremove_bak47p(id)
//public zp_user_infected_post(id) remove_bak47p(id)
//public zp_user_humanized_post(id) remove_bak47p(id)
/* ========= START OF REGISTER HAM TO SUPPORT BOTS FUNC ========= */
new g_HamBot
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_Killedid"Forward_PlayerKilled")
    
RegisterHamFromEntity(Ham_TraceAttackid"Forward_TraceAttack"1)
}

/* ======== END OF REGISTER HAM TO SUPPORT BOTS FUNC ============= */
/* ============ START OF ALL FORWARD (FAKEMETA) ================== */
public Forward_AddToFullPack(esStateiEiEntiHostiHostFlagsiPlayerpSet)
{
    if(
iEnt == g_Muzzleflash_Ent[0])
    {
        if(
g_Muzzleflash[iHost][0] == 3)
        {
            
set_es(esStateES_RenderModekRenderTransAdd)
            
set_es(esStateES_RenderAmtrandom_float(200.0255.0))
            
set_es(esStateES_Scalerandom_float(0.060.1))
            
            
g_Muzzleflash[iHost][0] = 2
        
}
        else if(
g_Muzzleflash[iHost][0] == 2)
        {
            
set_es(esStateES_RenderModekRenderTransAdd)
            
set_es(esStateES_RenderAmtrandom_float(200.0255.0))
            
set_es(esStateES_Scalerandom_float(0.060.1))
            
            
g_Muzzleflash[iHost][0] = 1
            g_Muzzleflash
[iHost][1] = 1
        
}
        else if(
g_Muzzleflash[iHost][0] == 1)
        {
            
set_es(esStateES_RenderModekRenderTransAdd)
            
set_es(esStateES_RenderAmtrandom_float(200.0255.0))
            
set_es(esStateES_Scalerandom_float(0.060.1))
            
            
g_Muzzleflash[iHost][0] = 0
        
}
            
        
set_es(esStateES_SkiniHost)
        
set_es(esStateES_Body1)
        
set_es(esStateES_AimEntiHost)
        
set_es(esStateES_MoveTypeMOVETYPE_FOLLOW)
    }
    else if(
iEnt == g_Muzzleflash_Ent[1])
    {
        if(
g_Muzzleflash[iHost][1])
        {
            
set_es(esStateES_RenderModekRenderTransAdd)
            
set_es(esStateES_RenderAmt240.0)
            
            
g_Muzzleflash[iHost][1] = 0
        
}
            
        
set_es(esStateES_SkiniHost)
        
set_es(esStateES_Body1)
        
set_es(esStateES_AimEntiHost)
        
set_es(esStateES_MoveTypeMOVETYPE_FOLLOW)
    }

}

public 
Forward_CheckVisibility(iEntitypSet)
{
    if(
iEntity == g_Muzzleflash_Ent[0] || iEntity == g_Muzzleflash_Ent[1])
    {
        
forward_return(FMV_CELL1)
        return 
FMRES_SUPERCEDE
    
}
    
    return 
FMRES_IGNORED
}

public 
Forward_PrecacheEvent_Post(type, const name[])
{
    new 
Buffer[512]
    
formatex(Buffersizeof(Buffer), "events/%s.sc"system_base)
    if(
equal(Buffername0))
    {
        
g_orig_event get_orig_retval()
        return 
FMRES_HANDLED
    
}
    return 
FMRES_IGNORED
}

public 
Forward_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity))
        return 
FMRES_IGNORED
    
    
static szClassName[33]
    
entity_get_string(entityEV_SZ_classnameszClassNamecharsmax(szClassName))
        
    if(!
equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED
    
    
static iOwner
    iOwner 
entity_get_edict(entityEV_ENT_owner)
    
    if(
equal(modelOLD_MODEL))
    {
        static 
iStoredAugID
        iStoredAugID 
find_ent_by_owner(ENG_NULLENTweapon_base_bufferentity)
            
        if(!
is_valid_ent(iStoredAugID))
            return 
FMRES_IGNORED

        
if(g_had_bak47p[iOwner])
        {
            
entity_set_int(iStoredAugIDEV_INT_WEAPONKEYWEAPON_KEY)
            
g_had_bak47p[iOwner] = 0
            entity_set_model
(entityW_MODEL)
            
            return 
FMRES_SUPERCEDE
        
}
    }
    return 
FMRES_IGNORED
}

public 
Forward_UseStationary_Post(entitycalleractivatoruse_type)
{
    if(
use_type == USE_STOPPED && is_user_connected(caller))
        
replace_weapon_models(callerget_user_weapon(caller))
}

public 
Forward_UpdateClientData_Post(PlayerSendWeaponsCD_Handle)
{
    if(!
is_user_alive(Player) || (get_user_weapon(Player) != CSW_BAK47P || !g_had_bak47p[Player]))
        return 
FMRES_IGNORED
    
    set_cd
(CD_HandleCD_flNextAttackhalflife_time () + 0.001)
    return 
FMRES_HANDLED
}

public 
Forward_PlaybackEvent(flagsinvokereventidFloat:delayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iParam1iParam2bParam1bParam2)
{
    if((
eventid != g_orig_event) || !g_IsInPrimaryAttack)
        return 
FMRES_IGNORED
    
if(!(<= invoker <= g_MaxPlayers))
        return 
FMRES_IGNORED

    playback_event
(flags FEV_HOSTONLYinvokereventiddelayoriginanglesfparam1fparam2iParam1iParam2bParam1bParam2)
    return 
FMRES_SUPERCEDE
}

/* ================= END OF ALL FAKEMETA FORWARD ================= */
/* ================= START OF ALL MESSAGE FORWARD ================ */
public Forward_DeathMsg(msg_idmsg_destid)
{
    static 
szTruncatedWeapon[33], iAttackeriVictim
    
    get_msg_arg_string
(4szTruncatedWeaponcharsmax(szTruncatedWeapon))
    
    
iAttacker get_msg_arg_int(1)
    
iVictim get_msg_arg_int(2)
    
    if(!
is_user_connected(iAttacker) || iAttacker == iVictim)
        return 
PLUGIN_CONTINUE
    
    
if(equal(szTruncatedWeaponsystem_base) && get_user_weapon(iAttacker) == CSW_BAK47P)
    {
        if(
g_had_bak47p[iAttacker])
            
set_msg_arg_string(4system_name)
    }
    return 
PLUGIN_CONTINUE
}
/* ================== END OF ALL MESSAGE FORWARD ================ */
/* ================== START OF ALL EVENT FORWARD ================ */
public Forward_MessageWeapList(msg_idmsg_destid)
{
    if(
get_msg_arg_int(8) != CSW_BAK47P)
        return
     
    
g_list_variables[2] = get_msg_arg_int(2)
    
g_list_variables[3] = get_msg_arg_int(3)
    
g_list_variables[4] = get_msg_arg_int(4)
    
g_list_variables[5] = get_msg_arg_int(5)
    
g_list_variables[6] = get_msg_arg_int(6)
    
g_list_variables[7] = get_msg_arg_int(7)
    
g_list_variables[8] = get_msg_arg_int(8)
    
g_list_variables[9] = get_msg_arg_int(9)
}

public 
Forward_CurrentWeapon(id)
{
    
replace_weapon_models(idread_data(2))
     
    if(!
is_user_alive(id))
        return
    if(
read_data(2) != CSW_BAK47P || !g_had_bak47p[id])
        return
     
    static 
Float:Speed
    
if(g_had_bak47p[id])
        
Speed get_pcvar_float(cvar_spd)
    
    static 
weapon[32], Ent
    get_weaponname
(read_data(2), weapon31)
    
Ent find_ent_by_owner(-1weaponid)
    if(
pev_valid(Ent))
    {
        static 
Float:Delay
        Delay 
get_pdata_float(Ent464) * Speed
        
if(Delay 0.0set_pdata_float(Ent46Delay4)
    }
}
/* ================== END OF ALL EVENT FORWARD =================== */
/* ================== START OF ALL HAM FORWARD ============== */
public Forward_PlayerKilled(idremove_bak47p(id)
public 
Forward_TraceAttack(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    if(!
is_user_alive(iAttacker) || !is_user_connected(iAttacker))
        return
    if(
get_user_weapon(iAttacker) != CSW_BAK47P || !g_had_bak47p[iAttacker])
        return

    static 
Float:flEnd[3], Float:WallVector[3], trace_color
    get_tr2
(ptrTR_vecEndPosflEnd)
    
get_tr2(ptrTR_vecPlaneNormalWallVector)
    
    if(
iEnt)
    {
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_DECAL)
        
write_coord_f(flEnd[0])
        
write_coord_f(flEnd[1])
        
write_coord_f(flEnd[2])
        
write_byte(GUNSHOT_DECALS[random_num (0sizeof GUNSHOT_DECALS -1)])
        
write_short(iEnt)
        
message_end()
    }
    else
    {
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_WORLDDECAL)
        
write_coord_f(flEnd[0])
        
write_coord_f(flEnd[1])
        
write_coord_f(flEnd[2])
        
write_byte(GUNSHOT_DECALS[random_num (0sizeof GUNSHOT_DECALS -1)])
        
message_end()
    }
    
    if(
g_Mode[iAttacker] == MODE_A)
    {
        if(!
is_user_alive(iEnt)) trace_color get_pcvar_num(cvar_trace_color)
        else if(
is_user_alive(iEnt)) trace_color 2000 // NO STREAK COLOR or Disabled
        
ExecuteHamB(Ham_TakeDamageiEntiAttackeriAttackerflDamage get_pcvar_float(cvar_dmg), DMG_BULLET)
    }
    
    if(
pev(iEntpev_takedamage) != DAMAGE_NO)
    {
        
set_hudmessage(25500, -1.00.4600.20.2)
        
show_hudmessage(iAttacker"\         /^n+^n/         \")
    }
    
    if(trace_color < 2000)
    {
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_STREAK_SPLASH)
        engfunc(EngFunc_WriteCoord, flEnd[0])
        engfunc(EngFunc_WriteCoord, flEnd[1])
        engfunc(EngFunc_WriteCoord, flEnd[2])
        engfunc(EngFunc_WriteCoord, WallVector[0] * random_float(25.0,30.0))
        engfunc(EngFunc_WriteCoord, WallVector[1] * random_float(25.0,30.0))
        engfunc(EngFunc_WriteCoord, WallVector[2] * random_float(25.0,30.0))
        write_byte(trace_color)
        write_short(50)
        write_short(3)
        write_short(90)    
        message_end()
        
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
        write_byte(TE_GUNSHOTDECAL)
        write_coord_f(flEnd[0])
        write_coord_f(flEnd[1])
        write_coord_f(flEnd[2])
        write_short(iAttacker)
        write_byte(GUNSHOT_DECALS[random_num (0, sizeof GUNSHOT_DECALS -1)])
        message_end()
    }
}

public Weapon_Deploy_Post(weapon_entity)
{
    static owner
    owner = fm_cs_get_weapon_ent_owner(weapon_entity)
    
    static weaponid
    weaponid = cs_get_weapon_id(weapon_entity)
    
    replace_weapon_models(owner, weaponid)
}

public Weapon_AddToPlayer(weapon_entity, id)
{
    if(!is_valid_ent(weapon_entity) || !is_user_connected(id))
        return HAM_IGNORED
    
    if(entity_get_int(weapon_entity, EV_INT_WEAPONKEY) == WEAPON_KEY)
    {
        g_had_bak47p[id] = true
        entity_set_int(weapon_entity, EV_INT_WEAPONKEY, 0)
        set_weapon_list(id, weapon_name_buffer)
        
        return HAM_HANDLED
    }
    else
    {
        set_weapon_list(id, weapon_base_buffer)
    }
    
    return HAM_IGNORED
}

public Weapon_PrimaryAttack(weapon_entity)
{
    new Player = get_pdata_cbase(weapon_entity, 41, 4)
    
    if(!g_had_bak47p[Player])
        return
    
    g_IsInPrimaryAttack = 1
    pev(Player,pev_punchangle,cl_pushangle[Player])
    
    g_clip_ammo[Player] = cs_get_weapon_ammo(weapon_entity)
}

public Weapon_PrimaryAttack_Post(weapon_entity)
{
    g_IsInPrimaryAttack = 0
    new Player = get_pdata_cbase(weapon_entity, 41, 4)
    
    new szClip, szAmmo
    get_user_weapon(Player, szClip, szAmmo)
    
    if(!is_user_alive(Player))
        return
        
    if(g_had_bak47p[Player])
    {
        if(!g_clip_ammo[Player])
        {
            ExecuteHam(Ham_Weapon_PlayEmptySound, weapon_entity)
            return
        }
        
        new Float:push[3]
        pev(Player,pev_punchangle,push)
        xs_vec_sub(push,cl_pushangle[Player],push)
        xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil),push)
        xs_vec_add(push,cl_pushangle[Player],push)
        set_pev(Player,pev_punchangle,push)
        
        set_weapon_shoot_anim(Player)
        emit_sound(Player, CHAN_WEAPON, Fire_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
        set_task(random_float(0.001, 0.005), "
Re_MuzzleFlash", Player+TASK_MUZZLEFLASH)
    }
}

public Weapon_ItemPostFrame(weapon_entity) 
{
    new id = pev(weapon_entity, pev_owner)
    if(!is_user_connected(id))
        return HAM_IGNORED
    if(!g_had_bak47p[id])
        return HAM_IGNORED

    static iClipExtra
    iClipExtra = get_pcvar_num(cvar_clip)
    new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, OFFSET_LINUX)

    new iBpAmmo = cs_get_user_bpammo(id, CSW_BAK47P)
    new iClip = get_pdata_int(weapon_entity, m_iClip, OFFSET_LINUX_WEAPONS)

    new fInReload = get_pdata_int(weapon_entity, m_fInReload, OFFSET_LINUX_WEAPONS) 
    if(fInReload && flNextAttack <= 0.0)
    {
        new j = min(iClipExtra - iClip, iBpAmmo)
    
        set_pdata_int(weapon_entity, m_iClip, iClip + j, OFFSET_LINUX_WEAPONS)
        cs_set_user_bpammo(id, CSW_BAK47P, iBpAmmo-j)
        
        set_pdata_int(weapon_entity, m_fInReload, 0, OFFSET_LINUX_WEAPONS)
        fInReload = 0
    }
    else if(!fInReload && !get_pdata_int(weapon_entity, 74, 4))
    {
        if(!iClip)
            return HAM_IGNORED
            
        if(get_pdata_float(id, 83, 5) <= 0.0 && get_pdata_float(weapon_entity, 46, 4) <= 0.0 ||
        get_pdata_float(weapon_entity, 47, 4) <= 0.0 || get_pdata_float(weapon_entity, 48, 4) <= 0.0)
        {
            if(pev(id, pev_button) & IN_ATTACK)
            {
                if(g_Mode[id] == MODE_B)
                    Shoot_Special(id)
            }
            else if(pev(id, pev_button) & IN_ATTACK2)
            {
                set_buffak_zoom(id, 0)
                set_weapons_timeidle(id, CSW_BAK47P, 0.4)
                set_player_nextattackx(id, 0.4)
            }
        }
    }
    
    return HAM_IGNORED
}

public Weapon_Reload(weapon_entity) 
{
    new id = pev(weapon_entity, pev_owner)
    if(!is_user_connected(id))
        return HAM_IGNORED
    if(!g_had_bak47p[id])
        return HAM_IGNORED
    static iClipExtra
    if(g_had_bak47p[id])
        iClipExtra = get_pcvar_num(cvar_clip)

    g_weapon_TmpClip[id] = -1

    new iBpAmmo = cs_get_user_bpammo(id, CSW_BAK47P)
    new iClip = get_pdata_int(weapon_entity, m_iClip, OFFSET_LINUX_WEAPONS)

    if(iBpAmmo <= 0)
        return HAM_SUPERCEDE

    if(iClip >= iClipExtra)
        return HAM_SUPERCEDE

    g_weapon_TmpClip[id] = iClip

    return HAM_IGNORED
}

public Weapon_Reload_Post(weapon_entity) 
{
    new id = pev(weapon_entity, pev_owner)
    if (!is_user_connected(id))
        return HAM_IGNORED

    if(!g_had_bak47p[id])
        return HAM_IGNORED
    if(g_weapon_TmpClip[id] == -1)
        return HAM_IGNORED
    
    set_pdata_int(weapon_entity, m_iClip, g_weapon_TmpClip[id], OFFSET_LINUX_WEAPONS)
    set_pdata_float(weapon_entity, m_flTimeWeaponIdle, RELOAD_TIME, OFFSET_LINUX_WEAPONS)
    set_pdata_float(id, m_flNextAttack, RELOAD_TIME, OFFSET_LINUX)
    set_pdata_int(weapon_entity, m_fInReload, 1, OFFSET_LINUX_WEAPONS)
    
    set_weapon_anim(id, ANIM_RELOAD)
    set_pdata_string(id, (492) * 4, ANIMEXT, -1 , 20)
    set_buffak_zoom(id, 1)
    
    return HAM_IGNORED
}

/* ===================== END OF ALL HAM FORWARD ====================== */
/* ================= START OF OTHER PUBLIC FUNCTION  ================= */
public get_bak47p(id)
{
    drop_weapons(id, 1)
    new iWeapon = fm_give_item(id, weapon_base_buffer)
    if(iWeapon > 0)
    {
        cs_set_weapon_ammo(iWeapon, get_pcvar_num(cvar_clip))
        cs_set_user_bpammo(id, CSW_BAK47P, get_pcvar_num(cvar_ammo))
        emit_sound(id, CHAN_ITEM, "
items/gunpickup2.wav", VOL_NORM, ATTN_NORM,0,PITCH_NORM)
        
        set_weapon_anim(id, ANIM_DRAW)
        set_pdata_float(id, m_flNextAttack, DRAW_TIME, OFFSET_LINUX)
        
        set_weapon_list(id, weapon_name_buffer)
        set_pdata_string(id, (492) * 4, ANIMEXT, -1 , 20)
        set_pdata_int(iWeapon, 74, MODE_A)
    }
    
    g_had_bak47p[id] = true
    g_Mode[id] = MODE_A
    remove_bitvar(id)
}

public remove_bak47p(id)
{
    g_had_bak47p[id] = false
    g_Mode[id] = MODE_A
    remove_bitvar(id)
}

public remove_bitvar(id)
{
    g_attack_type[id] = 0
    g_Muzzleflash[id][0] = 0
    g_Muzzleflash[id][1] = 0
}

public weapon_hook(id)
{
    engclient_cmd(id, weapon_base_buffer)
    return PLUGIN_HANDLED
}

public replace_weapon_models(id, weaponid)
{
    if(weaponid != CSW_BAK47P)
    {
        if(g_had_bak47p[id])
        {
            remove_bitvar(id)
            set_buffak_zoom(id, 1)
        }
    }
    
    switch(weaponid)
    {
        case CSW_BAK47P:
        {
            if(g_had_bak47p[id])
            {
                set_pev(id, pev_viewmodel2, V_MODEL)
                set_pev(id, pev_weaponmodel2, P_MODEL)
                
                if(oldweap[id] != CSW_BAK47P) 
                {
                    set_weapon_anim(id, ANIM_DRAW)
                    set_player_nextattackx(id, DRAW_TIME)
                    set_weapons_timeidle(id, CSW_BAK47P, DRAW_TIME)
                    set_weapon_list(id, weapon_name_buffer)
                    set_pdata_string(id, (492) * 4, ANIMEXT, -1 , 20)
                }
            }
        }
    }
    
    oldweap[id] = weaponid
}

public Shoot_Special(id)
{
    if(!is_user_alive(id) || !is_user_connected(id))
        return
        
    new szClip, szWeapId
    szWeapId = get_user_weapon(id, szClip)
    if(szWeapId != CSW_BAK47P || !g_had_bak47p[id] || !szClip)
        return
    
    g_Muzzleflash[id][0] = 3
    set_task(random_float(0.001, 0.005), "
Re_MuzzleFlash", id+TASK_MUZZLEFLASH)
    
    static Float:PunchAngles[3]
    PunchAngles[0] = -5.0
    PunchAngles[1] = -2.5
    PunchAngles[2] = -2.5
    set_pev(id, pev_punchangle, PunchAngles)
    
    set_weapon_shoot_anim(id)
    emit_sound(id, CHAN_WEAPON, Fire_Sounds[1], 1.0, ATTN_NORM, 0, PITCH_NORM)
    
    new Float:fStart[3], Float:originF[3]
    new target, body
    
    fm_get_aim_origin(id, originF)
    get_user_aiming(id, target, body)
    
    pev(id, pev_origin, fStart)
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fStart, 0)
    write_byte(TE_SPRITE)
    engfunc(EngFunc_WriteCoord, originF[0])
    engfunc(EngFunc_WriteCoord, originF[1])
    engfunc(EngFunc_WriteCoord, originF[2] + 20.0)
    write_short(sBuffakHit)
    write_byte(10)
    write_byte(240)
    message_end()
    
    new a = FM_NULLENT
    while((a = find_ent_in_sphere(a, originF, float(get_pcvar_num(cvar_radius)))) != 0)
    {
        if(id == a)
            continue
    
        if(pev(a, pev_takedamage) != DAMAGE_NO)
            ExecuteHamB(Ham_TakeDamage, a, 0, id, float(get_pcvar_num(cvar_dmg_2)), DMG_BULLET)
    }
    
    if(!is_user_alive(target))
    {
        static Classname[32]
        pev(target, pev_classname, Classname, sizeof(Classname))
        
        if(equal(Classname, "
func_breakable"))
            ExecuteHamB(Ham_TakeDamage, target, 0, 0, float(get_pcvar_num(cvar_dmg_2)), DMG_GENERIC)
    }
    else if(is_user_alive(target) && is_user_connected(target))
    {
        static Float:MyOrigin[3]
        pev(id, pev_origin, MyOrigin)
        hook_ent2(target, MyOrigin, 400.0, 2)
        ExecuteHamB(Ham_TakeDamage, target, 0, id, float(get_pcvar_num(cvar_dmg_2))*0.75, DMG_BULLET)
    }
    
    static entity_weapon
    entity_weapon = find_ent_by_owner(ENG_NULLENT, weapon_base_buffer, id)
    
    if(!pev_valid(entity_weapon))
        return
    
    cs_set_weapon_ammo(entity_weapon, szClip - 1)
    set_player_nextattackx(id, 0.7)
    set_weapons_timeidle(id, CSW_BAK47P, 0.7)
}

public set_weapon_shoot_anim(id)
{
    if(!g_attack_type[id])
    {
        set_weapon_anim(id, ANIM_SHOOT1)
        g_attack_type[id] = 1
    }
    else if(g_attack_type[id] == 1)
    {
        set_weapon_anim(id, ANIM_SHOOT2)
        g_attack_type[id] = 2
    }
    else if(g_attack_type[id] == 2)
    {
        set_weapon_anim(id, ANIM_SHOOT3)
        g_attack_type[id] = 0
    }
}

public Re_MuzzleFlash(id)
{
    id -= TASK_MUZZLEFLASH

    if(!is_user_alive(id) || !is_user_connected(id))
        return
    if(get_user_weapon(id) != CSW_BAK47P || !g_had_bak47p[id])
        return
    
    if(g_Mode[id] == MODE_A) g_Muzzleflash[id][0] = true
    else if(g_Mode[id] == MODE_B) g_Muzzleflash[id][1] = true
}

/* ============= END OF OTHER PUBLIC FUNCTION (Weapon) ============= */
/* ================= START OF ALL STOCK TO MACROS ================== */
stock set_buffak_zoom(id, const reset = 0)
{
    if(reset == 1)
    {
        set_fov(id)
        g_Mode[id] = MODE_A
    }
    else if(reset == 0)
    {
        if(g_Mode[id] == MODE_A)
        {
            set_fov(id, 80)
            g_Mode[id] = MODE_B
        }
        else if(g_Mode[id] == MODE_B)
        {
            set_fov(id)
            g_Mode[id] = MODE_A
        }
    }
}

stock set_fov(id, fov = 90)
{
    message_begin(MSG_ONE, get_user_msgid("
SetFOV"), {0,0,0}, id)
    write_byte(fov)
    message_end()
}

stock set_weapon_list(id, const weapon_name[])
{
    message_begin(MSG_ONE, get_user_msgid("
WeaponList"), {0,0,0}, id)
    write_string(weapon_name)
    write_byte(g_list_variables[2])
    write_byte(g_list_variables[3])
    write_byte(g_list_variables[4])
    write_byte(g_list_variables[5])
    write_byte(g_list_variables[6])
    write_byte(g_list_variables[7])
    write_byte(g_list_variables[8])
    write_byte(g_list_variables[9])
    message_end()
}

stock hook_ent2(ent, Float:VicOrigin[3], Float:speed, type)
{
    static Float:fl_Velocity[3]
    static Float:EntOrigin[3]
    
    pev(ent, pev_origin, EntOrigin)
    static Float:distance_f
    distance_f = 100.0
    
    new Float: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) * 1.5
        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) * 1.5
        fl_Velocity[2] = (EntOrigin[2] - VicOrigin[2]) / fl_Time
    }
    
    entity_set_vector(ent, EV_VEC_velocity, fl_Velocity)
}

stock drop_weapons(id, dropwhat)
{
    static weapons[32], num = 0, i, weaponid
    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 set_player_nextattackx(id, Float:nexttime)
{
    if(!is_user_alive(id))
        return
        
    set_pdata_float(id, m_flNextAttack, nexttime, 5)
}

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, 46, TimeIdle, OFFSET_LINUX_WEAPONS)
    set_pdata_float(entwpn, 47, TimeIdle, OFFSET_LINUX_WEAPONS)
    set_pdata_float(entwpn, 48, TimeIdle + 1.0, OFFSET_LINUX_WEAPONS)
}

stock set_weapons_timeidlex(id, Float:TimeIdle, Float:Idle)
{
    new entwpn = fm_get_user_weapon_entity(id, CSW_BASE)
    if(!pev_valid(entwpn)) 
        return
    
    set_pdata_float(entwpn, 46, TimeIdle, 4)
    set_pdata_float(entwpn, 47, TimeIdle, 4)
    set_pdata_float(entwpn, 48, Idle, 4)
}

stock set_weapon_anim(const Player, const Sequence)
{
    set_pev(Player, pev_weaponanim, Sequence)
    
    message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
    write_byte(Sequence)
    write_byte(pev(Player, pev_body))
    message_end()
}

stock precache_viewmodel_sound(const model[]) // I Get This From BTE
{
    new file, i, k
    if((file = fopen(model, "
rt")))
    {
        new szsoundpath[64], NumSeq, SeqID, Event, NumEvents, EventID
        fseek(file, 164, SEEK_SET)
        fread(file, NumSeq, BLOCK_INT)
        fread(file, SeqID, BLOCK_INT)
        
        for(i = 0; i < NumSeq; i++)
        {
            fseek(file, SeqID + 48 + 176 * i, SEEK_SET)
            fread(file, NumEvents, BLOCK_INT)
            fread(file, EventID, BLOCK_INT)
            fseek(file, EventID + 176 * i, SEEK_SET)
            
            // The Output Is All Sound To Precache In ViewModels (GREAT :V)
            for(k = 0; k < NumEvents; k++)
            {
                fseek(file, EventID + 4 + 76 * k, SEEK_SET)
                fread(file, Event, BLOCK_INT)
                fseek(file, 4, SEEK_CUR)
                
                if(Event != 5004)
                    continue
                
                fread_blocks(file, szsoundpath, 64, BLOCK_CHAR)
                
                if(strlen(szsoundpath))
                {
                    strtolower(szsoundpath)
                    engfunc(EngFunc_PrecacheSound, szsoundpath)
                }
            }
        }
    }
    fclose(file)
}

stock fm_cs_get_weapon_ent_owner(ent)
{
    return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS)
}

/* ================= END OF ALL STOCK AND PLUGINS CREATED ================== */
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1057\\ f0\\ fs16 \n\\ par }
*/ 
Attached Files
File Type: sma Get Plugin or Get Source (normal_bak47p.sma - 14 views - 30.3 KB)

Last edited by Supremache; 03-29-2020 at 02:09.
Supremache is offline
Nutu_
Veteran Member
Join Date: Mar 2016
Location: Germany
Old 03-29-2020 , 08:17   Re: How to edit some codes in blookak plugin
Reply With Quote #2

this is for ZP (Zombie Plague)
use default GoldenAK plugin and just change the models if you dont want anything special
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Carrion
Member
Join Date: Mar 2020
Old 03-29-2020 , 12:05   Re: How to edit some codes in blookak plugin
Reply With Quote #3

agree with @Nutu_

try - https://forums.alliedmods.net/showthread.php?p=827532

NOTE: its not approved
Carrion is offline
Supremache
Senior Member
Join Date: Sep 2019
Old 03-29-2020 , 13:23   Re: How to edit some codes in blookak plugin
Reply With Quote #4

But i saw someone did that in his server with same plugin
I Made this reqest for who have good expriance to do that
If no one can do that then it's okey
But i want extra items menu plugin and i will add this plugin to extra items
Supremache is offline
Nutu_
Veteran Member
Join Date: Mar 2016
Location: Germany
Old 03-29-2020 , 14:16   Re: How to edit some codes in blookak plugin
Reply With Quote #5

Extra Items? Is it a separated plugin like shop or is something like ZP?
what mode do you have in your server?
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Supremache
Senior Member
Join Date: Sep 2019
Old 03-29-2020 , 16:47   Re: How to edit some codes in blookak plugin
Reply With Quote #6

Quote:
Originally Posted by Nutu_ View Post
Extra Items? Is it a separated plugin like shop or is something like ZP?
what mode do you have in your server?
Zombie basebuilder mod
Supremache is offline
Nutu_
Veteran Member
Join Date: Mar 2016
Location: Germany
Old 03-29-2020 , 17:06   Re: How to edit some codes in blookak plugin
Reply With Quote #7

use the default goldenak plugin, put your wanted models
go to your shop(extra items plugin) and in the case of this ak use client_cmd say /goldenak, and that's all
otherwise you need to make natives
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Supremache
Senior Member
Join Date: Sep 2019
Old 03-29-2020 , 20:16   Re: How to edit some codes in blookak plugin
Reply With Quote #8

Quote:
Originally Posted by Nutu_ View Post
use the default goldenak plugin, put your wanted models
go to your shop(extra items plugin) and in the case of this ak use client_cmd say /goldenak, and that's all
otherwise you need to make natives
I know , But i mean this plugins have nice look and new style that name is bloodak
https://www.youtube.com/watch?v=ml8BD3O0LwI
Supremache is offline
Nutu_
Veteran Member
Join Date: Mar 2016
Location: Germany
Old 03-30-2020 , 17:58   Re: How to edit some codes in blookak plugin
Reply With Quote #9

let me repeat "change the models, name whatever you want" and everything's fine
__________________
a simple act of caring creates an endless ripple.
Nutu_ is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:33.


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