我刚做了一个extra_item(如下)
可是不知如何改变它的攻击力,射击速度和子弹量...
请问我该如何改呢?
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
//////////////////////////////////////////////////////////////////////////////
// Customizations ////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
new const model_vmg3[] = "models/zombie_plague/v_mg3.mdl" /* Weapon Model */
new const g_mg3_cost = 30 /* Item Cost */
//////////////////////////////////////////////////////////////////////////////
// Customizations Ends Here :D ///////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#define is_valid_player(%1) (1 <= %1 <= g_maxplayers)
new g_mg3, g_maxplayers, big_explode, g_deathmsg
new bool:g_bHasmg3[33]
new cvar_enable, cvar_kill, cvar_remove_hltv, cvar_enable2, cvar_explode, cvar_particles, cvar_blood
public plugin_init()
{
// Register the Plugin
register_plugin("[ZP] Extra Item: MG3", "0.1", "Survivor-ST|MakingGroup")
// Variables
g_maxplayers = get_maxplayers()
g_deathmsg = get_user_msgid("DeathMsg")
g_mg3 = zp_register_extra_item("MG3", g_mg3_cost, ZP_TEAM_HUMAN)
// Cvars
cvar_enable = register_cvar("zp_mg3_enable", "1")
cvar_kill = register_cvar("zp_mg3_ap_for_kill", "2")
cvar_remove_hltv = register_cvar("zp_mg3_roundstart_remove", "0")
cvar_enable2 = register_cvar("zp_mg3_block_delay_buy", "0")
// Special Efects Cvars
cvar_explode = register_cvar("zp_mg3_explode", "1")
cvar_blood = register_cvar("zp_mg3_bloodspurt", "1")
cvar_particles = register_cvar("zp_mg3_particles", "1")
// Events: HamSandwich
RegisterHam(Ham_TakeDamage, "player", "fw_mg3_damage")
RegisterHam(Ham_Killed, "player", "fw_player_killed")
RegisterHam(Ham_Spawn, "player", "fw_player_spawn", 1)
// Events: Normal HL1 Events
register_event("CurWeapon", "mg3_model", "be", "1=1", "2=18")
}
public plugin_precache()
{
engfunc(EngFunc_PrecacheModel, model_vmg3)
engfunc(EngFunc_PrecacheSound, "ambience/particle_suck2.wav")
big_explode = engfunc(EngFunc_PrecacheModel, "sprites/fexplo.spr")
}
public fw_player_spawn(id)
{
if (g_bHasmg3[id] && get_pcvar_num(cvar_remove_hltv))
{
g_bHasmg3[id] = false
fm_strip_user_gun(id, 18)
}
}
public client_putinserver(id)
g_bHasmg3[id] = false;
public client_disconnect(id)
g_bHasmg3[id] = false;
public fw_player_killed(victim, attacker, shouldgib)
{
if(g_bHasmg3[victim])
{
client_print(victim, print_center, "[mg3] Power Off")
g_bHasmg3[victim] = false
}
}
public fw_mg3_damage(victim, inflictor, attacker, Float:damage, damage_bits)
{
if(!zp_get_user_zombie(victim))
return;
if(!is_valid_player(attacker))
return;
new clip, ammo, wpnid = get_user_weapon(attacker, clip, ammo)
if (g_bHasmg3[attacker] && wpnid == CSW_M249)
{
new origin[3]
get_user_origin(victim, origin)
// player fades..
set_user_rendering(victim, kRenderFxFadeSlow, 255, 255, 255, kRenderTransColor, 4);
// beeeg explody!
if(get_pcvar_num(cvar_explode))
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_EXPLOSION)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2]+128)
write_short(big_explode) // big explosion
write_byte(40) // scale in 0.1's
write_byte(12) // frame rate
write_byte(TE_EXPLFLAG_NONE)
message_end()
}
// do turn down that awful racket..to be replaced by a blood spurt!
if(get_pcvar_num(cvar_blood))
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_LAVASPLASH)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2]-26)
message_end()
}
// particle suck
if(get_pcvar_num(cvar_particles))
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_IMPLOSION)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_byte(200)
write_byte(40)
write_byte(45)
message_end()
emit_sound(victim, CHAN_WEAPON, "ambience/particle_suck2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(victim, CHAN_VOICE, "ambience/particle_suck2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
// Setting damage to 0 for some bugs
SetHamParamFloat(4, 0.0);
// kill victim
user_silentkill(victim)
message_begin(MSG_ALL, g_deathmsg,{0,0,0},0 )
write_byte(attacker)
write_byte(victim)
write_byte(0)
write_string("m249")
message_end()
// Save Hummiliation
new namea[24],namev[24],authida[20],authidv[20],teama[8],teamv[8]
// Info On Attacker
get_user_name(attacker,namea,23)
get_user_team(attacker,teama,7)
get_user_authid(attacker,authida,19)
new attackerid = get_user_userid(attacker)
// Info On Victim
get_user_name(victim,namev,23)
get_user_team(victim,teamv,7)
get_user_authid(victim,authidv,19)
new victimid = get_user_userid(victim)
// Log This Kill
log_message("^"%s<%d><%s><%s>^" killed^"%s<%d><%s><%s>^" with ^"mg3^"", namea, attackerid,authida, teama, namev, victimid, authidv, teamv)
// for some reason this doesn't update in the hud until the next round.. whatever.
if (get_user_team(attacker) != get_user_team(victim))
{
set_user_frags(attacker, get_user_frags(attacker) + 1)
new killap = get_pcvar_num(cvar_kill)
new getap = zp_get_user_ammo_packs(attacker)
zp_set_user_ammo_packs(attacker, getap + killap)
client_print(attacker, print_center, "[mg3] Enemy Killed. +%d Ammopacks", killap)
}
}
}
public zp_extra_item_selected(id, item)
{
if (item == g_mg3)
{
if(get_pcvar_num(cvar_enable))
{
if(get_pcvar_num(cvar_enable2))
{
if (!zp_has_round_started())
{
client_print(id, print_chat, "[ZP] You must wait until the round starts")
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_mg3_cost)
return;
}
}
if(g_bHasmg3[id])
{
client_print(id, print_chat, "[ZP] You already have a mg3")
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_mg3_cost)
return;
}
// Var's
g_bHasmg3[id] = true
// mg3
give_item(id, "weapon_m249")
give_item(id, "ammo_556natobox")
give_item(id, "ammo_556natobox")
give_item(id, "ammo_556natobox")
// Msgs
client_print(id, print_chat, "[ZP] You now have a mg3. Shooting at a Zombie, it is annihilated")
client_print(id, print_center, "[mg3] Power On. Seek and Destroy")
// Setting Models
put_models(id)
}
else
{
client_print(id, print_chat, "[ZP] This Item has been Disabled")
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + g_mg3_cost)
return;
}
}
}
public mg3_model(id)
{
// Not alive
if (!is_user_alive(id))
return;
if (!g_bHasmg3[id])
return;
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if (wpnid == CSW_M249 && g_bHasmg3[id])
{
set_pev(id, pev_viewmodel2, model_vmg3)
}
}
public zp_user_infected_post(id)
{
if(g_bHasmg3[id])
{
g_bHasmg3[id] = false
}
}
public put_models(id)
{
if(!g_bHasmg3[id])
return;
if (get_user_weapon(id) == CSW_M249)
{
mg3_model(id)
}
else
{
engclient_cmd(id, "weapon_m249")
mg3_model(id)
}
}
// Stock: fm_strip_user_gun (taked from fakemeta_util)
stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "")
{
new ent_class[32];
if (!wid && wname[0])
copy(ent_class, sizeof ent_class - 1, wname);
else
{
new weapon = wid, clip, ammo;
if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
return false;
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
}
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index);
if (!ent_weap)
return false;
engclient_cmd(index, "drop", ent_class);
new ent_box = pev(ent_weap, pev_owner);
if (!ent_box || ent_box == index)
return false;
dllfunc(DLLFunc_Think, ent_box);
return true;
}
// Stock: fm_find_ent_by_owner (taked from fakemeta_util)
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
{
new strtype[11] = "classname", ent = index;
switch (jghgtype)
{
case 1: strtype = "target";
case 2: strtype = "targetname";
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
return ent;
}
-------------------------------------------------------------------------------------------------------------------------------------------
先感谢各位帮忙!"