Bom glr ja quebrei a vaneça aqui e nao consigo aumentar o dano desta arma vo mandar a sma, sera que alguem ai pode me ajudar almentar o dano? e a distancia de alcance? ja alterei fx etc e nada quem puder da uma força segue ai a sma
Código:
*
[ZP] ExtraItem: Knock Weapon
Plugin by Shidla [SGC]
Credits:
Idea: Koshak | ICQ: 283-361-228 (zombie-mod.ru)
Test: Koshak
Shidla [SGC] | 2011 | ICQ: 312-298-513 | http://Shidla.Gm-Project.NET/ | http://Shidla.QuZ.SU/
1.0 [Final Version]
*/
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
#include <cstrike>
#include <zombieplague>
#define is_valid_player(%1) (1 <= %1 <= 32)
#define KNOCK_WEAP CSW_XM1014
new CNOC_V_MODEL[64] = "models/zombie_plague/v_knock_weap.mdl";
new CNOC_P_MODEL[64] = "models/zombie_plague/p_knock_weap.mdl";
new weap_push, weap_radius, weap_nofall, weap_fx, weap_iammo, weap_one_round, g_extra_weap;
new lastammo[33], lastweap[33];
new g_Explosion;
new NoFallDamage[33], g_Has_Cnoc_Weapon[33];
public plugin_init()
{
register_plugin("[ZP] Knock Weapon", "1.0", "Emp` | Shidla");
register_cvar("Shidla", "[ZP] Knock Weapon v.1.0", FCVAR_SERVER|FCVAR_SPONLY)
register_cvar("zp_knock_weap", "[ZP] Knock Weapon v.1.0", FCVAR_SERVER|FCVAR_SPONLY)
g_extra_weap = zp_register_extra_item("Cnoc XM1014", 300, ZP_TEAM_HUMAN);
weap_push = register_cvar("zp_weap_knock","25000.0");
weap_radius = register_cvar("zp_weap_radius","1000.0");
weap_nofall = register_cvar("zp_weap_nofall","1");
weap_fx = register_cvar("zp_weap_fx","10");
weap_iammo = register_cvar("zp_weap_iammo","1");
weap_one_round = register_cvar("zp_weap_oneround","1");
register_event("CurWeapon","make_tracer", "be", "1=1");
register_event("HLTV", "NewRound", "a", "1=0", "2=0");
register_forward(FM_PlayerPreThink,"fw_playerprethink");
register_forward(FM_PlayerPostThink,"fw_playerpostthink");
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled");
}
public plugin_precache()
{
g_Explosion = precache_model("sprites/zerogxplode.spr");
precache_model(CNOC_V_MODEL);
precache_model(CNOC_P_MODEL);
}
public zp_extra_item_selected(id, item)
{
if(item == g_extra_weap)
{
if(g_Has_Cnoc_Weapon[id])
{
client_print(id, print_chat, "[ZP] Already have Cnoc XM1014");
return ZP_PLUGIN_HANDLED;
}
else
{
g_Has_Cnoc_Weapon[id] = true;
fm_give_item(id, "weapon_xm1014")
fm_give_item(id, "ammo_buckshot")
}
}
return PLUGIN_CONTINUE;
}
public make_tracer(id)
{
new weap = read_data(2); // id of the weapon
if(weap == KNOCK_WEAP && is_user_alive(id) && is_valid_player(id) && !zp_get_user_zombie(id) && g_Has_Cnoc_Weapon[id])
{
set_pev(id, pev_viewmodel2, CNOC_V_MODEL);
set_pev(id, pev_weaponmodel2, CNOC_P_MODEL);
}
if(g_Has_Cnoc_Weapon[id] && is_user_alive(id) && is_valid_player(id) && !zp_get_user_zombie(id))
{
new Float:maxboost = get_pcvar_float(weap_push);
if(!maxboost)
return;
new ammo = read_data(3); // ammo left in clip
if(weap == KNOCK_WEAP && is_user_alive(id) && is_valid_player(id) && !zp_get_user_zombie(id))
{
if(lastweap[id] == 0)
lastweap[id] = weap;
if(lastammo[id] > ammo && lastweap[id] == weap)
{
new Vec[3], Float:fVec[3], Float:origin[3];
get_user_origin(id, Vec, 3);
IVecFVec(Vec, fVec);
pev(id, pev_origin, origin);
new Float:dist = get_distance_f(origin, fVec);
new Float:radius = get_pcvar_float(weap_radius);
if(dist <= radius)
{
new Float:boost = maxboost -((maxboost * dist) / radius);
set_velocity_from_origin(id, fVec, boost);
}
new fx = get_pcvar_num(weap_fx);
if(fx & 1)
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_EXPLOSION);
write_coord(Vec[0]);
write_coord(Vec[1]);
write_coord(Vec[2]);
write_short(g_Explosion);
write_byte(30);
write_byte(15);
write_byte(0);
message_end();
}
if(fx & 2)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION2);
write_coord(Vec[0]);
write_coord(Vec[1]);
write_coord(Vec[2]);
write_byte(188); // start color
write_byte(10); // num colors
message_end();
}
if(get_pcvar_num(weap_iammo))
{
new wpn[32];
get_weaponname(weap,wpn,31);
if(ammo == 1)
{
new iWPNidx = -1;
while((iWPNidx = fm_find_ent_by_class(iWPNidx, wpn)))
{
if(id == pev(iWPNidx, pev_owner))
{
cs_set_weapon_ammo(iWPNidx, 11);
ammo = 11;
break;
}
}
}
}
}
lastammo[id] = ammo;
lastweap[id] = weap;
}
}
return;
}
public fw_playerprethink(id)
{
NoFallDamage[id] = get_pcvar_num(weap_nofall);
}
public fw_playerpostthink(id)
{
if(NoFallDamage[id])
set_pev(id, pev_watertype, -3);
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
if(is_user_connected(victim) && is_valid_player(victim))
{
g_Has_Cnoc_Weapon[victim] = false;
}
}
public zp_user_infected_post(id)
{
if(zp_get_user_zombie(id))
{
g_Has_Cnoc_Weapon[id] = false;
}
}
public NewRound()
{
if(get_pcvar_num(weap_one_round))
arrayset(g_Has_Cnoc_Weapon, false, 33);
}
public zp_user_humanized_post(player, survivor)
{
g_Has_Cnoc_Weapon[survivor] = false;
}
/*==========================================*/
/*================== Stocks ==================*/
/*==========================================*/
stock get_velocity_from_origin(ent, Float:fOrigin[3], Float:fSpeed, Float:fVelocity[3])
{
new Float:fEntOrigin[3];
pev(ent, pev_origin, fEntOrigin);
// Velocity = Distance / Time
new Float:fDistance[3];
fDistance[0] = fEntOrigin[0] - fOrigin[0];
fDistance[1] = fEntOrigin[1] - fOrigin[1];
fDistance[2] = fEntOrigin[2] - fOrigin[2];
new Float:fTime =(vector_distance(fEntOrigin,fOrigin) / fSpeed);
fVelocity[0] = fDistance[0] / fTime;
fVelocity[1] = fDistance[1] / fTime;
fVelocity[2] = fDistance[2] / fTime;
return(fVelocity[0] && fVelocity[1] && fVelocity[2]);
}
// Sets velocity of an entity(ent) away from origin with speed(speed)
stock set_velocity_from_origin(ent, Float:fOrigin[3], Float:fSpeed)
{
new Float:fVelocity[3];
get_velocity_from_origin(ent, fOrigin, fSpeed, fVelocity)
set_pev(ent, pev_velocity, fVelocity);
return(1);
}