Raised This Month: $ Target: $400
 0% 

Help / Support [SOLVED][ZP 4.3] Damage multiplication does not work with bots ?


Post New Thread Reply   
 
Thread Tools Display Modes
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-23-2015 , 14:43   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #11

Particularly found crap, no other way to run this fucking golden ak?

Last edited by CrazY.; 05-25-2015 at 17:06.
CrazY. is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 05-25-2015 , 06:15   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #12

Post the code here...
Always when you ask for help, post your code

Last edited by Depresie; 05-25-2015 at 07:16.
Depresie is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-25-2015 , 13:40   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #13

PHP Code:
/*
[ZP] Extra Item: Golden Ak 47
Team: Humans

Description: This plugin adds a new weapon for Human Teams.
Weapon Cost: 30

Features:
- This weapon do more damage
- This weapon has zoom
- Launch Lasers
- This weapon has unlimited bullets

Credits:

KaOs - For his Dual MP5 mod

Cvars:


- zp_goldenak_dmg_multiplier <5> - Damage Multiplier for Golden Ak 47
- zp_goldenak_gold_bullets <1|0> - Golden bullets effect ?
- zp_goldenak_custom_model <1|0> - Golden ak Custom Model
- zp_goldenak_unlimited_clip <1|0> - Golden ak Unlimited Clip 

*/



#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>

#define is_valid_player(%1) (1 <= %1 <= 32)

new AK_V_MODEL[64] = "models/zombie_plague/v_golden_ak47.mdl"
new AK_P_MODEL[64] = "models/zombie_plague/p_golden_ak47.mdl"

/* Pcvars */
new cvar_dmgmultipliercvar_goldbullets,  cvar_custommodelcvar_uclip

// Item ID
new g_itemid

new bool:g_HasAk[33]

new 
g_hasZoom33 ]
new 
bullets33 ]

// Sprite
new m_spriteTexture

const Wep_ak47 = ((1<<CSW_AK47))

public 
plugin_init()
{
    
    
/* CVARS */
    
cvar_dmgmultiplier register_cvar("zp_goldenak_dmg_multiplier""5")
    
cvar_custommodel register_cvar("zp_goldenak_custom_model""1")
    
cvar_goldbullets register_cvar("zp_goldenak_gold_bullets""1")
    
cvar_uclip register_cvar("zp_goldenak_unlimited_clip""1")
    
    
// Register The Plugin
    
register_plugin("[ZP] Extra: Golden Ak 47""1.1""AlejandroSk")
    
// Register Zombie Plague extra item
    
g_itemid zp_register_extra_item("Golden Ak 47"30ZP_TEAM_HUMAN)
    
// Death Msg
    
register_event("DeathMsg""Death""a")
    
// Weapon Pick Up
    
register_event("WeapPickup","checkModel","b","1=19")
    
// Current Weapon Event
    
register_event("CurWeapon","checkWeapon","be","1=1")
    
register_event("CurWeapon""make_tracer""be""1=1""3>0")
    
// Ham TakeDamage
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
register_forwardFM_CmdStart"fw_CmdStart" )
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
    
}

public 
client_connect(id)
{
    
g_HasAk[id] = false
}

public 
client_disconnect(id)
{
    
g_HasAk[id] = false
}

public 
Death()
{
    
g_HasAk[read_data(2)] = false
}

public 
fwHamPlayerSpawnPost(id)
{
    
g_HasAk[id] = false
}

public 
plugin_precache()
{
    
precache_model(AK_V_MODEL)
    
precache_model(AK_P_MODEL)
    
m_spriteTexture precache_model("sprites/dot.spr")
    
precache_sound("weapons/zoom.wav")
}

public 
zp_user_infected_post(id)
{
    if (
zp_get_user_zombie(id))
    {
        
g_HasAk[id] = false
    
}
}

public 
checkModel(id)
{
    if ( 
zp_get_user_zombie(id) )
        return 
PLUGIN_HANDLED
    
    
new szWeapID read_data(2)
    
    if ( 
szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
    {
        
set_pev(idpev_viewmodel2AK_V_MODEL)
        
set_pev(idpev_weaponmodel2AK_P_MODEL)
    }
    return 
PLUGIN_HANDLED
}

public 
checkWeapon(id)
{
    new 
plrClipplrAmmoplrWeap[32]
    new 
plrWeapId
    
    plrWeapId 
get_user_weapon(idplrClip plrAmmo)
    
    if (
plrWeapId == CSW_AK47 && g_HasAk[id])
    {
        
checkModel(id)
    }
    else 
    {
        return 
PLUGIN_CONTINUE
    
}
    
    if (
plrClip == && get_pcvar_num(cvar_uclip))
    {
        
// If the user is out of ammo..
        
get_weaponname(plrWeapIdplrWeap31)
        
// Get the name of their weapon
        
give_item(idplrWeap)
        
engclient_cmd(idplrWeap
        
engclient_cmd(idplrWeap)
        
engclient_cmd(idplrWeap)
    }
    return 
PLUGIN_HANDLED
}



public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if ( 
is_valid_playerattacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
    {
        
SetHamParamFloat(4damage get_pcvar_floatcvar_dmgmultiplier ) )
    }
}

public 
fw_CmdStartiduc_handleseed )
{
    if( !
is_user_aliveid ) ) 
        return 
PLUGIN_HANDLED
    
    
if( ( get_ucuc_handleUC_Buttons ) & IN_ATTACK2 ) && !( pevidpev_oldbuttons ) & IN_ATTACK2 ) )
    {
        new 
szClipszAmmo
        
new szWeapID get_user_weaponidszClipszAmmo )
        
        if( 
szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
        {
            
g_hasZoom[id] = true
            cs_set_user_zoom
idCS_SET_AUGSG552_ZOOM)
            
emit_soundidCHAN_ITEM"weapons/zoom.wav"0.202.400100 )
        }
        
        else if ( 
szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
        {
            
g_hasZoomid ] = false
            cs_set_user_zoom
idCS_RESET_ZOOM)
            
        }
        
    }
    return 
PLUGIN_HANDLED
}


public 
make_tracer(id)
{
    if (
get_pcvar_num(cvar_goldbullets))
    {
        new 
clip,ammo
        
new wpnid get_user_weapon(id,clip,ammo)
        new 
pteam[16]
        
        
get_user_team(idpteam15)
        
        if ((
bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id]) 
        {
            new 
vec1[3], vec2[3]
            
get_user_origin(idvec11// origin; your camera point.
            
get_user_origin(idvec24// termina; where your bullet goes (4 is cs-only)
            
            
            //BEAMENTPOINTS
            
message_beginMSG_BROADCAST,SVC_TEMPENTITY)
            
write_byte (0)     //TE_BEAMENTPOINTS 0
            
write_coord(vec1[0])
            
write_coord(vec1[1])
            
write_coord(vec1[2])
            
write_coord(vec2[0])
            
write_coord(vec2[1])
            
write_coord(vec2[2])
            
write_shortm_spriteTexture )
            
write_byte(1// framestart
            
write_byte(5// framerate
            
write_byte(2// life
            
write_byte(10// width
            
write_byte(0// noise
            
write_byte255 )     // r, g, b
            
write_byte215 )       // r, g, b
            
write_byte)       // r, g, b
            
write_byte(200// brightness
            
write_byte(150// speed
            
message_end()
        }
    
        
bullets[id] = clip
    
}
    
}

public 
zp_extra_item_selected(playeritemid)
{
    if ( 
itemid == g_itemid )
    {
        if ( 
user_has_weapon(playerCSW_AK47) )
        {
            
drop_prim(player)
        }
        
        
give_item(player"weapon_ak47")
        
client_print(playerprint_chat"[ZP] You bought Golden Ak - 47")
        
g_HasAk[player] = true;
    }
}

stock drop_prim(id
{
    new 
weapons[32], num
    get_user_weapons
(idweaponsnum)
    for (new 
0numi++) {
        if (
Wep_ak47 & (1<<weapons[i])) 
        {
            static 
wname[32]
            
get_weaponname(weapons[i], wnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/ 
CrazY. is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 05-25-2015 , 15:17   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #14

Code:
/*
[ZP] Extra Item: Golden Ak 47
Team: Humans

Description: This plugin adds a new weapon for Human Teams.
Weapon Cost: 30

Features:
- This weapon do more damage
- This weapon has zoom
- Launch Lasers
- This weapon has unlimited bullets

Credits:

KaOs - For his Dual MP5 mod

Cvars:


- zp_goldenak_dmg_multiplier <5> - Damage Multiplier for Golden Ak 47
- zp_goldenak_gold_bullets <1|0> - Golden bullets effect ?
- zp_goldenak_custom_model <1|0> - Golden ak Custom Model
- zp_goldenak_unlimited_clip <1|0> - Golden ak Unlimited Clip 

*/



#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <cs_ham_bots_api>
#include <cstrike>
#include <zombieplague>

#define is_valid_player(%1) (1 <= %1 <= 32)

new AK_V_MODEL[64] = "models/zombie_plague/v_golden_ak47.mdl"
new AK_P_MODEL[64] = "models/zombie_plague/p_golden_ak47.mdl"

/* Pcvars */
new cvar_dmgmultiplier, cvar_goldbullets,  cvar_custommodel, cvar_uclip

// Item ID
new g_itemid

new bool:g_HasAk[33]

new g_hasZoom[ 33 ]
new bullets[ 33 ]

// Sprite
new m_spriteTexture

const Wep_ak47 = ((1<<CSW_AK47))

public plugin_init()
{
    
    /* CVARS */
    cvar_dmgmultiplier = register_cvar("zp_goldenak_dmg_multiplier", "5")
    cvar_custommodel = register_cvar("zp_goldenak_custom_model", "1")
    cvar_goldbullets = register_cvar("zp_goldenak_gold_bullets", "1")
    cvar_uclip = register_cvar("zp_goldenak_unlimited_clip", "1")
    
    // Register The Plugin
    register_plugin("[ZP] Extra: Golden Ak 47", "1.1", "AlejandroSk")
    // Register Zombie Plague extra item
    g_itemid = zp_register_extra_item("Golden Ak 47", 30, ZP_TEAM_HUMAN)
    // Death Msg
    register_event("DeathMsg", "Death", "a")
    // Weapon Pick Up
    register_event("WeapPickup","checkModel","b","1=19")
    // Current Weapon Event
    register_event("CurWeapon","checkWeapon","be","1=1")
    register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
    // Ham TakeDamage
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    RegisterHamBots(Ham_TakeDamage, "fw_TakeDamage")
    register_forward( FM_CmdStart, "fw_CmdStart" )
    RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
    
}

public client_connect(id)
{
    g_HasAk[id] = false
}

public client_disconnect(id)
{
    g_HasAk[id] = false
}

public Death()
{
    g_HasAk[read_data(2)] = false
}

public fwHamPlayerSpawnPost(id)
{
    g_HasAk[id] = false
}

public plugin_precache()
{
    precache_model(AK_V_MODEL)
    precache_model(AK_P_MODEL)
    m_spriteTexture = precache_model("sprites/dot.spr")
    precache_sound("weapons/zoom.wav")
}

public zp_user_infected_post(id)
{
    if (zp_get_user_zombie(id))
    {
        g_HasAk[id] = false
    }
}

public checkModel(id)
{
    if ( zp_get_user_zombie(id) )
        return PLUGIN_HANDLED
    
    new szWeapID = read_data(2)
    
    if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
    {
        set_pev(id, pev_viewmodel2, AK_V_MODEL)
        set_pev(id, pev_weaponmodel2, AK_P_MODEL)
    }
    return PLUGIN_HANDLED
}

public checkWeapon(id)
{
    new plrClip, plrAmmo, plrWeap[32]
    new plrWeapId
    
    plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
    
    if (plrWeapId == CSW_AK47 && g_HasAk[id])
    {
        checkModel(id)
    }
    else 
    {
        return PLUGIN_CONTINUE
    }
    
    if (plrClip == 0 && get_pcvar_num(cvar_uclip))
    {
        // If the user is out of ammo..
        get_weaponname(plrWeapId, plrWeap, 31)
        // Get the name of their weapon
        give_item(id, plrWeap)
        engclient_cmd(id, plrWeap) 
        engclient_cmd(id, plrWeap)
        engclient_cmd(id, plrWeap)
    }
    return PLUGIN_HANDLED
}



public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
    if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
    {
        SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
    }
}

public fw_CmdStart( id, uc_handle, seed )
{
    if( !is_user_alive( id ) ) 
        return PLUGIN_HANDLED
    
    if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
    {
        new szClip, szAmmo
        new szWeapID = get_user_weapon( id, szClip, szAmmo )
        
        if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
        {
            g_hasZoom[id] = true
            cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
            emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
        }
        
        else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
        {
            g_hasZoom[ id ] = false
            cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
            
        }
        
    }
    return PLUGIN_HANDLED
}


public make_tracer(id)
{
    if (get_pcvar_num(cvar_goldbullets))
    {
        new clip,ammo
        new wpnid = get_user_weapon(id,clip,ammo)
        new pteam[16]
        
        get_user_team(id, pteam, 15)
        
        if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id]) 
        {
            new vec1[3], vec2[3]
            get_user_origin(id, vec1, 1) // origin; your camera point.
            get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
            
            
            //BEAMENTPOINTS
            message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
            write_byte (0)     //TE_BEAMENTPOINTS 0
            write_coord(vec1[0])
            write_coord(vec1[1])
            write_coord(vec1[2])
            write_coord(vec2[0])
            write_coord(vec2[1])
            write_coord(vec2[2])
            write_short( m_spriteTexture )
            write_byte(1) // framestart
            write_byte(5) // framerate
            write_byte(2) // life
            write_byte(10) // width
            write_byte(0) // noise
            write_byte( 255 )     // r, g, b
            write_byte( 215 )       // r, g, b
            write_byte( 0 )       // r, g, b
            write_byte(200) // brightness
            write_byte(150) // speed
            message_end()
        }
    
        bullets[id] = clip
    }
    
}

public zp_extra_item_selected(player, itemid)
{
    if ( itemid == g_itemid )
    {
        if ( user_has_weapon(player, CSW_AK47) )
        {
            drop_prim(player)
        }
        
        give_item(player, "weapon_ak47")
        client_print(player, print_chat, "[ZP] You bought Golden Ak - 47")
        g_HasAk[player] = true;
    }
}

stock drop_prim(id) 
{
    new weapons[32], num
    get_user_weapons(id, weapons, num)
    for (new i = 0; i < num; i++) {
        if (Wep_ak47 & (1<<weapons[i])) 
        {
            static wname[32]
            get_weaponname(weapons[i], wname, sizeof wname - 1)
            engclient_cmd(id, "drop", wname)
        }
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/

Last edited by Depresie; 05-25-2015 at 16:25.
Depresie is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-25-2015 , 16:04   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #15

CrazY. is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 05-25-2015 , 16:27   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #16

updated the code, if you are not running zp 5.0, get the cs_ham_bots_api.inc include

http://zp-50-module-version.googleco...m_bots_api.inc
Depresie is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-25-2015 , 16:59   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #17

This code only works with zp 5.0?

Last edited by CrazY.; 05-25-2015 at 16:59.
CrazY. is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 05-26-2015 , 07:48   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #18

no, it works with any zp, but you need the cs_ham_bots_api include
zp 5.0 already has it, for any other version you will have to download it
Depresie is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-26-2015 , 10:12   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #19

This code is used for something?

PHP Code:
/*================================================================================
    
    ------------------------------------------
    -*- [CS] Ham Hooks for CZ Bots API 1.0 -*-
    ------------------------------------------
    
    - Fixes RegisterHam player hooks not working for CZ bots
    
================================================================================*/

#include <amxmodx>
#include <hamsandwich>

#define INVALID_HANDLE -1
#define REGISTERHAM_CALLBACK "__RegisterHamBots"

new g_HamsNotRegistered
new g_CZBotPlayerID
new g_MaxPlayers
new cvar_bot_quota

new Array:g_PluginID
new Array:g_PluginCallback
new Array:g_HamFunctionID
new Array:g_HamFunctionIsPost
new Array:g_HamForwardHandle
new Array:g_HamForwardEnable
new g_BotHooksCount

public plugin_precache()
{
    
// Initialize dynamic arrays
    
g_PluginID ArrayCreate(11)
    
g_PluginCallback ArrayCreate(641)
    
g_HamFunctionID ArrayCreate(11)
    
g_HamFunctionIsPost ArrayCreate(11)
    
g_HamForwardHandle ArrayCreate(11)
    
g_HamForwardEnable ArrayCreate(11)
}

public 
plugin_init()
{
    
register_plugin("[CS] Ham Hooks for Bots API""1.0""WiLS")
    
    
g_MaxPlayers get_maxplayers()
    
cvar_bot_quota get_cvar_pointer("bot_quota")
}

public 
plugin_natives()
{
    
register_library("cs_ham_bots_api")
    
register_native("RegisterHamBots""native_register_ham_bots")
    
register_native("DisableHamForwardBots""native_disable_ham_forward_bots")
    
register_native("EnableHamForwardBots""native_enable_ham_forward_bots")
}

public 
native_register_ham_bots(plugin_idnum_params)
{
    new 
ham_function_id get_param(1)
    
    if (!
IsHamValid(Ham:ham_function_id))
    {
        
log_error(AMX_ERR_NATIVE"[HAM] Invalid Function ID (%d)."ham_function_id)
        return -
1;
    }
    
    new 
plugin_callback[64]
    
get_string(2plugin_callbackcharsmax(plugin_callback))
    
    if (
get_func_id(plugin_callbackplugin_id) < 0)
    {
        
log_error(AMX_ERR_NATIVE"[HAM] Function %s not found."plugin_callback)
        return -
1;
    }
    
    new 
is_post get_param(3) ? true false
    
    ArrayPushCell
(g_PluginIDplugin_id)
    
ArrayPushString(g_PluginCallbackplugin_callback)
    
ArrayPushCell(g_HamFunctionIDham_function_id)
    
ArrayPushCell(g_HamFunctionIsPostis_post)
    
ArrayPushCell(g_HamForwardHandleINVALID_HANDLE)
    
ArrayPushCell(g_HamForwardEnabletrue)
    
g_BotHooksCount++
    
    
// Reset flags
    
g_HamsNotRegistered true
    
    
// Is there a CZ Bot connected?
    
if (g_CZBotPlayerID)
    {
        
// Use it to register right away
        
register_ham_czbots(g_CZBotPlayerID)
    }
    
    return 
g_BotHooksCount 1;
}

public 
native_disable_ham_forward_bots(plugin_idnum_params)
{
    new 
ham_hook_index get_param(1)
    
    if (
ham_hook_index || ham_hook_index g_BotHooksCount 1)
    {
        
log_error(AMX_ERR_NATIVE"[HAM] Invalid hook index (%d)."ham_hook_index)
        return 
false;
    }
    
    
// Hook is already disabled
    
if (!ArrayGetCell(g_HamForwardEnableham_hook_index))
        return 
true;
    
    
// Is this forward already registered?
    
if (ArrayGetCell(g_HamForwardHandleham_hook_index) != INVALID_HANDLE)
    {
        
// We have the forward handle, disable right away
        
new ham_forward_handle ArrayGetCell(g_HamForwardHandleham_hook_index)
        
DisableHamForward(HamHook:ham_forward_handle)
    }
    
    
// If we don't have a forward handle, disable it once it's registered
    
ArraySetCell(g_HamForwardEnableham_hook_indexfalse)
    return 
true;
}

public 
native_enable_ham_forward_bots(plugin_idnum_params)
{
    new 
ham_hook_index get_param(1)
    
    if (
ham_hook_index || ham_hook_index g_BotHooksCount 1)
    {
        
log_error(AMX_ERR_NATIVE"[HAM] Invalid hook index (%d)."ham_hook_index)
        return 
false;
    }
    
    
// Hook is already enabled
    
if (ArrayGetCell(g_HamForwardEnableham_hook_index))
        return 
true;
    
    
// Is this forward already registered?
    
if (ArrayGetCell(g_HamForwardHandleham_hook_index) != INVALID_HANDLE)
    {
        
// We have the forward handle, enable right away
        
new ham_forward_handle ArrayGetCell(g_HamForwardHandleham_hook_index)
        
EnableHamForward(HamHook:ham_forward_handle)
    }
    
    
// If we don't have a forward handle, enable it once it's registered
    
ArraySetCell(g_HamForwardEnableham_hook_indextrue)
    return 
true;
}

public 
client_disconnect(id_leaving)
{
    
// Our CZ Bot used for registering hooks is leaving
    
if (id_leaving == g_CZBotPlayerID)
    {
        
// Can we find a replacement?
        
new index 1
        
while ((!is_user_connected(index) || !is_user_bot(index) || index == id_leaving) && (index <= g_MaxPlayers))
            
index++ // keep looping
        
        // Update player ID
        
if (index <= g_MaxPlayers)
            
g_CZBotPlayerID index
        
else
            
g_CZBotPlayerID 0
    
}
}

public 
client_putinserver(id)
{
    
// CZ bots seem to use a different "classtype" for player entities
    // (or something like that) which needs to be hooked separately
    
if (is_user_bot(id) && cvar_bot_quota)
    {
        
// Set a task to let the private data initialize
        
set_task(0.1"register_ham_czbots"id)
    }
}

// Register Ham Forwards for CZ bots
public register_ham_czbots(id_bot)
{
    
// Make sure it's a CZ bot and it's still connected
    
if (!is_user_connected(id_bot) || !get_pcvar_num(cvar_bot_quota))
        return;
    
    
// Save CZ Bot Player ID in case we need to register any more forwards later
    
g_CZBotPlayerID id_bot
    
    
// Nothing to hook?
    
if (!g_HamsNotRegistered)
        return;
    
    new 
indexplugin_idplugin_filename[64], ham_function_idplugin_callback[64], is_postfunc_idham_forward_handleplugin_is_paused
    
for (index 0index g_BotHooksCountindex++)
    {
        
// Already registered
        
if (ArrayGetCell(g_HamForwardHandleindex) != INVALID_HANDLE)
            continue;
        
        
plugin_id ArrayGetCell(g_PluginIDindex)
        
ham_function_id ArrayGetCell(g_HamFunctionIDindex)
        
ArrayGetString(g_PluginCallbackindexplugin_callbackcharsmax(plugin_callback))
        
is_post ArrayGetCell(g_HamFunctionIsPostindex)
        
func_id get_func_id(REGISTERHAM_CALLBACKplugin_id)
        
plugin_is_paused = (callfunc_begin_i(func_idplugin_id) == -2) ? true false // -2 = Function not executable
        
        
if (plugin_is_paused)
        {
            
// Unpause plugin before callfunc
            
get_plugin(plugin_idplugin_filenamecharsmax(plugin_filename))
            
unpause("c"plugin_filenameREGISTERHAM_CALLBACK//unpause("ac", plugin_filename)
            
            
if (callfunc_begin_i(func_idplugin_id) == -2)
            {
                
pause("c"plugin_filenameREGISTERHAM_CALLBACK//pause("ac", plugin_filename)
                
log_amx("ERROR: callfunc_begin_i: Function still not executable after unpausing - plugin id %d (%s) - func id %d (%s)"plugin_idplugin_filenamefunc_idREGISTERHAM_CALLBACK)
                continue;
            }
        }
        
        
callfunc_push_int(ham_function_id)
        
callfunc_push_int(id_bot)
        
callfunc_push_str(plugin_callback)
        
callfunc_push_int(is_post)
        
ham_forward_handle callfunc_end()
        
        if (
plugin_is_paused)
        {
            
// Pause plugin again after callfunc
            
pause("c"plugin_filenameREGISTERHAM_CALLBACK//pause("ac", plugin_filename)
        
}
        
        
ArraySetCell(g_HamForwardHandleindexham_forward_handle)
        
        
// Ham forward was disabled
        
if (!ArrayGetCell(g_HamForwardEnableindex))
        {
            
DisableHamForward(HamHook:ham_forward_handle)
        }
        else if (
ham_function_id == _:Ham_Spawn && is_user_alive(id_bot) && !plugin_is_paused)
        {
            
// If the bot has already spawned, call Ham_Spawn forward manually for him (bugfix)
            
func_id get_func_id(plugin_callbackplugin_id)
            
callfunc_begin_i(func_idplugin_id)
            
callfunc_push_int(id_bot)
            
callfunc_end()
        }
    }
    
    
// Ham forwards for CZ bots succesfully registered
    
g_HamsNotRegistered false

CrazY. is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 05-26-2015 , 14:14   Re: [Help] Damage multiplication does not work with bots ?
Reply With Quote #20

sorry i forgot you need and the plugin not only the include, so here are them both

copy cs_ham_bots_api.inc into scripting/include folder
compile cs_ham_bots_api.sma and add it to the plugins.ini
compile the ak code i gave you, see if it works
Attached Files
File Type: inc cs_ham_bots_api.inc (1.4 KB, 430 views)
File Type: sma Get Plugin or Get Source (cs_ham_bots_api.sma - 1191 views - 7.5 KB)

Last edited by Depresie; 05-26-2015 at 14:15.
Depresie is offline
Reply



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 19:54.


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