This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indradullanov
Member
Join Date: Sep 2012
Location: Indonesian
Old 07-15-2013 , 05:52   help
Reply With Quote #1

I used the code from dias, I edit price and others and I use it in basebuilder, but if people use to kill zombies, zombienya not live again ... anyone who can fix this?

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <xs>

#define PLUGIN "Dragon Cannon"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define CSW_CANNON CSW_UMP45
#define weapon_cannon "weapon_ump45"

#define DEFAULT_W_MODEL "models/w_ump45.mdl"
#define WEAPON_SECRET_CODE 4965
#define CANNONFIRE_CLASSNAME "cannon_round"

// Fire Start
#define WEAPON_ATTACH_F 30.0
#define WEAPON_ATTACH_R 10.0
#define WEAPON_ATTACH_U -10.0

#define TASK_RESET_AMMO 5434

const pev_ammo pev_iuser4

new const WeaponModel[3][] =
{
    
"models/v_cannon.mdl",
    
"models/p_cannon.mdl",
    
"models/w_cannon.mdl"
}

new const 
WeaponSound[2][] =
{
    
"weapons/cannon-1.wav",
    
"weapons/cannon_draw.wav"
}

new const 
WeaponResource[5][] = 
{
    
"sprites/fire_cannon.spr",
    
"sprites/weapon_cannon.txt",
    
"sprites/640hud69.spr",
    
"sprites/640hud2_cso.spr",
    
"sprites/smokepuff.spr"
}

enum
{
    
MODEL_V 0,
    
MODEL_P,
    
MODEL_W
}

enum
{
    
CANNON_ANIM_IDLE 0,
    
CANNON_ANIM_SHOOT1,
    
CANNON_ANIM_SHOOT2,
    
CANNON_ANIM_DRAW
}

new 
g_had_cannon[33], g_old_weapon[33], g_cannon_ammo[33], g_got_firsttime[33], Float:g_lastshot[33]
new 
g_cvar_defaultammog_cvar_reloadtimeg_cvar_firespeedg_cvar_radiusdamageg_cvar_damage
new Float:g_temp_reloadtimeg_smokepuff_idcvar_cost

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""event_CurWeapon""be""1=1")

    
register_forward(FM_UpdateClientData"fw_UpdateClientData_Post"1)
    
register_forward(FM_CmdStart"fw_CmdStart")
    
register_forward(FM_SetModel"fw_SetModel")

    
register_think(CANNONFIRE_CLASSNAME"fw_Cannon_Think")
    
register_touch(CANNONFIRE_CLASSNAME"*""fw_Cannon_Touch")
    
    
RegisterHam(Ham_Spawn"player""fw_Spawn_Post"1)
    
RegisterHam(Ham_Item_AddToPlayerweapon_cannon"fw_AddToPlayer_Post"1)

    
g_cvar_defaultammo register_cvar("cannon_default_ammo""20")
    
g_cvar_reloadtime register_cvar("cannon_reload_time""4.0")
    
g_cvar_firespeed register_cvar("cannon_fire_speed""200.0")
    
g_cvar_radiusdamage register_cvar("cannon_radius_damage""1000.0")
    
g_cvar_damage register_cvar("cannon_damage""700.0")
    
cvar_cost register_cvar("dragon_cost""5000")
    
    
register_clcmd("say /dragon""get_dragoncannon")
    
register_clcmd("weapon_cannon""hook_weapon")
}

public 
plugin_precache()
{
    new 
i
    
for(0sizeof(WeaponModel); i++)
        
engfunc(EngFunc_PrecacheModelWeaponModel[i])
    for(
0sizeof(WeaponSound); i++)
        
engfunc(EngFunc_PrecacheSoundWeaponSound[i])
        
    
engfunc(EngFunc_PrecacheModelWeaponResource[0])
    
engfunc(EngFunc_PrecacheGenericWeaponResource[1])
    
engfunc(EngFunc_PrecacheModelWeaponResource[2])
    
engfunc(EngFunc_PrecacheModelWeaponResource[3])
    
g_smokepuff_id engfunc(EngFunc_PrecacheModelWeaponResource[4])
}

public 
get_dragoncannon(id)
{
    if(!
is_user_alive(id))
    {
        
client_print(id,print_chat"[AMXX] To buy Dragon Cannon You need to be alive!")
        return 
PLUGIN_HANDLED
    
}
        

    new 
money cs_get_user_money(id)
        
    
g_had_cannon[id] = 1
    g_cannon_ammo
[id] =     get_pcvar_num(g_cvar_defaultammo)
    if (
money >= get_pcvar_num(cvar_cost))
    {
        
cs_set_user_money(idmoney get_pcvar_num(cvar_cost))
    
fm_give_item(idweapon_cannon)
}
    
    else
    {
        
client_print(idprint_chat"[AMXX] You dont hav enough money to buy Dragon Cannon Cost $%d "get_pcvar_num(cvar_cost))
    }
    return 
PLUGIN_HANDLED
}

public 
remove_dragoncannon(id)
{
    if(!
is_user_connected(id))
        return
        
    
g_had_cannon[id] = 0
    g_got_firsttime
[id] = 0
    g_cannon_ammo
[id] = 0
    
    remove_task
(id+TASK_RESET_AMMO)
}

public 
hook_weapon(idengclient_cmd(idweapon_cannon)

public 
event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return
        
    if(
get_user_weapon(id) == CSW_CANNON && g_had_cannon[id])
    {
        if(!
g_got_firsttime[id])
        {
            static 
cannon_weapon
            cannon_weapon 
fm_find_ent_by_owner(-1weapon_cannonid)
    
            if(
pev_valid(cannon_weapon)) cs_set_weapon_ammo(cannon_weapon25)
            
g_got_firsttime[id] = 1
        
}
        
        
set_pev(idpev_viewmodel2WeaponModel[MODEL_V])
        
set_pev(idpev_weaponmodel2WeaponModel[MODEL_P])
        
        if(
g_old_weapon[id] != CSW_CANNON)
        {
            
g_temp_reloadtime get_pcvar_float(g_cvar_reloadtime)
            
set_weapon_anim(idCANNON_ANIM_DRAW)
        }
            
        
update_ammo(id)
    }
    
    
g_old_weapon[id] = get_user_weapon(id)
}


public 
dragoncannon_shoothandle(id)
{
    if(
pev(idpev_weaponanim) != CANNON_ANIM_IDLE)
        return
        
    if(
get_gametime() - g_temp_reloadtime g_lastshot[id])
    {
        
dragoncannon_shootnow(id)
        
g_lastshot[id] = get_gametime()
    }
}

public 
dragoncannon_shootnow(id)
{
    if(
g_cannon_ammo[id] == 1)
    {
        
set_task(0.5"set_weapon_outofammo"id+TASK_RESET_AMMO)
    }
    if(
g_cannon_ammo[id] <= 0)
    {
        return
    }
    
    
create_fake_attack(id)
    
    
g_cannon_ammo[id]--
    
    
set_weapon_anim(idrandom_num(CANNON_ANIM_SHOOT1CANNON_ANIM_SHOOT2))
    
emit_sound(idCHAN_WEAPONWeaponSound[0], 1.0ATTN_NORM0PITCH_NORM)
    
    
set_player_nextattack(idCSW_CANNONg_temp_reloadtime)
    
update_ammo(id)
    
    
make_fire_effect(id)
    
make_fire_smoke(id)
    
check_radius_damage(id)
}

public 
create_fake_attack(id)
{
    static 
cannon_weapon
    cannon_weapon 
fm_find_ent_by_owner(-1"weapon_knife"id)
    
    if(
pev_valid(cannon_weapon)) ExecuteHam(Ham_Weapon_PrimaryAttackcannon_weapon)    
}

public 
set_weapon_outofammo(id)
{
    
id -= TASK_RESET_AMMO
    
if(!is_user_alive(id))
        return
    if(
get_user_weapon(id) != CSW_CANNON || !g_had_cannon[id])
        return
        
    
set_weapon_anim(idCANNON_ANIM_IDLE)
}

public 
make_fire_effect(id)
{
    const 
MAX_FIRE 10
    
static Float:Origin[MAX_FIRE][3]
    
    
// Stage 1
    
get_position(id30.050.0WEAPON_ATTACH_UOrigin[0])
    
get_position(id30.040.0WEAPON_ATTACH_UOrigin[1])
    
get_position(id30.0, -40.0WEAPON_ATTACH_UOrigin[2])
    
get_position(id30.0, -50.0WEAPON_ATTACH_UOrigin[2])
    
    
// Stage 2
    
get_position(id50.030.0WEAPON_ATTACH_UOrigin[3])
    
get_position(id50.00.0WEAPON_ATTACH_UOrigin[4])
    
get_position(id50.0, -30.0WEAPON_ATTACH_UOrigin[5])
    
    
// Stage 3
    
get_position(id70.020.0WEAPON_ATTACH_UOrigin[3])
    
get_position(id70.0, -20.0WEAPON_ATTACH_UOrigin[5])    
    
    
// Stage 4
    
get_position(id90.00.0WEAPON_ATTACH_UOrigin[4])
    
    for(new 
0MAX_FIREi++)
        
create_fire(idOrigin[i])
}

public 
create_fire(idFloat:Origin[3])
{
    new 
iEnt create_entity("env_sprite")
    static 
Float:vfAngle[3], Float:MyOrigin[3], Float:TargetOrigin[3], Float:Velocity[3]
    
    
pev(idpev_anglesvfAngle)
    
pev(idpev_originMyOrigin)
    
    
vfAngle[2] = float(random(18) * 20)

    
// set info for ent
    
set_pev(iEntpev_movetypeMOVETYPE_PUSHSTEP)
    
set_pev(iEntpev_rendermodekRenderTransAdd)
    
set_pev(iEntpev_renderamt250.0)
    
set_pev(iEntpev_fuser1get_gametime() + 2.5)    // time remove
    
set_pev(iEntpev_scale2.0)
    
set_pev(iEntpev_nextthinkhalflife_time() + 0.05)
    
    
entity_set_string(iEntEV_SZ_classnameCANNONFIRE_CLASSNAME)
    
engfunc(EngFunc_SetModeliEntWeaponResource[0])
    
set_pev(iEntpev_minsFloat:{-5.0, -5.0, -5.0})
    
set_pev(iEntpev_maxsFloat:{5.05.05.0})
    
set_pev(iEntpev_originOrigin)
    
set_pev(iEntpev_gravity0.01)
    
set_pev(iEntpev_anglesvfAngle)
    
set_pev(iEntpev_solid1)
    
set_pev(iEntpev_ownerid)    
    
set_pev(iEntpev_frame0.0)
    
    
// Set Velocity
    
get_position(id100.00.0, -5.0TargetOrigin)
    
    
get_speed_vector(MyOriginTargetOriginget_pcvar_float(g_cvar_firespeed), Velocity)
    
set_pev(iEntpev_velocityVelocity)
}

public 
fw_Cannon_Think(iEnt)
{
    if(!
pev_valid(iEnt)) 
        return
    
    new 
Float:fFrameFloat:fNextThink
    pev
(iEntpev_framefFrame)
    
    
// effect exp
    
new iMoveType pev(iEntpev_movetype)
    if (
iMoveType == MOVETYPE_NONE)
    {
        
fNextThink 0.0015
        fFrame 
+= 0.5
        
        
if (fFrame 21.0)
        {
            
engfunc(EngFunc_RemoveEntityiEnt)
            return
        }
    }
    
    
// effect normal
    
else
    {
        
fNextThink 0.045
        fFrame 
+= 0.5
        fFrame 
floatmin(21.0fFrame)
    }
    
    
set_pev(iEntpev_framefFrame)
    
set_pev(iEntpev_nextthinkhalflife_time() + fNextThink)
    
    
// time remove
    
new Float:fTimeRemove
    pev
(iEntpev_fuser1fTimeRemove)
    if (
get_gametime() >= fTimeRemove)
    {
        
engfunc(EngFunc_RemoveEntityiEnt)
        return;
    }
}

public 
fw_Cannon_Touch(entid)
{
    if(!
pev_valid(ent))
        return
        
    
set_pev(entpev_movetypeMOVETYPE_NONE)
    
set_pev(entpev_solidSOLID_NOT)
}

public 
make_fire_smoke(id)
{
    static 
Float:Origin[3]
    
get_position(idWEAPON_ATTACH_FWEAPON_ATTACH_RWEAPON_ATTACH_UOrigin)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY
    
write_byte(TE_EXPLOSION
    
engfunc(EngFunc_WriteCoordOrigin[0])
    
engfunc(EngFunc_WriteCoordOrigin[1])
    
engfunc(EngFunc_WriteCoordOrigin[2])
    
write_short(g_smokepuff_id
    
write_byte(10)
    
write_byte(30)
    
write_byte(14)
    
message_end()
}

public 
update_ammo(id)
{
    if(!
is_user_alive(id))
        return
        
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("CurWeapon"), _id)
    
write_byte(1)
    
write_byte(CSW_CANNON)
    
write_byte(-1)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("AmmoX"), _id)
    
write_byte(6)
    
write_byte(g_cannon_ammo[id])
    
message_end()
}

public 
check_radius_damage(id)
{
    static 
Float:Origin[3]
    for(new 
0get_maxplayers(); i++)
    {
        if(!
is_user_alive(i))
            continue
        if(
cs_get_user_team(id) == cs_get_user_team(i))
            continue
        if(
id == i)
            continue
        
pev(ipev_originOrigin)
        if(!
is_in_viewcone(idOrigin1))
            continue
        if(
entity_range(idi) >= get_pcvar_float(g_cvar_radiusdamage))
            continue
            
        
ExecuteHamB(Ham_TakeDamagei0idget_pcvar_float(g_cvar_damage), DMG_BURN)
    }
}

public 
fw_UpdateClientData_Post(idsendweaponscd_handle)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_IGNORED
    
if(get_user_weapon(id) != CSW_CANNON || !g_had_cannon[id])
        return 
FMRES_IGNORED
    
    set_cd
(cd_handleCD_flNextAttackget_gametime() + 0.001
    
    return 
FMRES_HANDLED
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
FMRES_IGNORED
    
if(get_user_weapon(id) != CSW_CANNON || !g_had_cannon[id])
        return 
FMRES_IGNORED
    
    
static CurButton
    CurButton 
get_uc(uc_handleUC_Buttons)
    
    if(
CurButton IN_ATTACK)
    {
        
CurButton &= ~IN_ATTACK
        set_uc
(uc_handleUC_ButtonsCurButton)
        
        
dragoncannon_shoothandle(id)
    }
    
    return 
FMRES_HANDLED
}

public 
fw_SetModel(entitymodel[])
{
    if(!
pev_valid(entity))
        return 
FMRES_IGNORED
    
    
static szClassName[33]
    
pev(entitypev_classnameszClassNamecharsmax(szClassName))
    
    if(!
equal(szClassName"weaponbox"))
        return 
FMRES_IGNORED
    
    
static id
    id 
pev(entitypev_owner)
    
    if(
equal(modelDEFAULT_W_MODEL))
    {
        static 
weapon
        weapon 
fm_find_ent_by_owner(-1weapon_cannonentity)
        
        if(!
pev_valid(weapon))
            return 
FMRES_IGNORED
        
        
if(g_had_cannon[id])
        {
            
set_pev(weaponpev_impulseWEAPON_SECRET_CODE)
            
set_pev(weaponpev_ammog_cannon_ammo[id])
            
            
engfunc(EngFunc_SetModelentityWeaponModel[MODEL_W])
            
remove_dragoncannon(id)
            
            return 
FMRES_SUPERCEDE
        
}
    }

    return 
FMRES_IGNORED
}

public 
fw_Spawn_Post(id)
{
    
remove_dragoncannon(id)
}

public 
fw_AddToPlayer_Post(entid)
{
    if(!
pev_valid(ent))
        return 
HAM_IGNORED
        
    
if(pev(entpev_impulse) == WEAPON_SECRET_CODE)
    {
        
remove_dragoncannon(id)
        
        
g_had_cannon[id] = 1
        g_got_firsttime
[id] = 0
        g_cannon_ammo
[id] = pev(entpev_ammo)
    }
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("WeaponList"), _id)
    
write_string(g_had_cannon[id] == "weapon_cannon" "weapon_ump45")
    
write_byte(6)
    
write_byte(20)
    
write_byte(-1)
    
write_byte(-1)
    
write_byte(0)
    
write_byte(15)
    
write_byte(CSW_CANNON)
    
write_byte(0)
    
message_end()            
    
    return 
HAM_HANDLED    
}

stock set_weapon_anim(idanim)
{
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id)
    
write_byte(anim)
    
write_byte(pev(idpev_body))
    
message_end()
}

stock drop_weapons(iddropwhat)
{
    static 
weapons[32], numiweaponid
    num 
0
    get_user_weapons
(idweaponsnum)
    
    const 
PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_MAC10)|(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)
    
    for (
0numi++)
    {
        
weaponid weapons[i]
        
        if (
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
        {
            static 
wname[32]
            
get_weaponname(weaponidwnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }
}

stock set_player_nextattack(playerweapon_idFloat:NextTime)
{
    const 
m_flNextPrimaryAttack 46
    
const m_flNextSecondaryAttack 47
    
const m_flTimeWeaponIdle 48
    
const m_flNextAttack 83
    
    
static weapon
    weapon 
fm_get_user_weapon_entity(playerweapon_id)
    
    
set_pdata_float(playerm_flNextAttackNextTime5)
    if(
pev_valid(weapon))
    {
        
set_pdata_float(weaponm_flNextPrimaryAttack NextTime4)
        
set_pdata_float(weaponm_flNextSecondaryAttackNextTime4)
        
set_pdata_float(weaponm_flTimeWeaponIdleNextTime4)
    }
}

stock get_position(id,Float:forwFloat:rightFloat:upFloat:vStart[])
{
    new 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
    
pev(idpev_originvOrigin)
    
pev(idpev_view_ofs,vUp//for player
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(idpev_v_anglevAngle// 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:speedFloat: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;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by indradullanov; 07-15-2013 at 05:53.
indradullanov is offline
Send a message via Yahoo to indradullanov
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 07-15-2013 , 06:41   Re: help
Reply With Quote #2

Clear It a Bit ..
Want to respawn the zombies ? Or No respawning for zombies ?
devilicioux is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 07-15-2013 , 07:33   Re: help
Reply With Quote #3

Ask Dias to fix it.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
indradullanov
Member
Join Date: Sep 2012
Location: Indonesian
Old 07-16-2013 , 04:19   Re: help
Reply With Quote #4

If there are people buying dragon cannon and shoot zombies, zombies are not alive, please fix that zombie live if the dragon cannon shoot
indradullanov is offline
Send a message via Yahoo to indradullanov
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 09:37.


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