10/08/2021, 12:15 AM
Hola, me podrían ayudar con este problema por favor!
Estoy utilizando el mod de Xbatista (GunXPMOD) para mi zp, tengo problemas con la mejora del knife de la tienda de mejoras del mod
-> gunxpmod_shop.
Bueno el problema es el siguiente: El knife/cuchillo se mejora, aumenta su daño, cambia el modelo del mismo y lo que debe, pero se supone que esta mejora es solo para los TEAM CT!! ósea para los humanos en este caso. Al momento de ser infectado quiero que no sea valida esta mejora para lo T/Zombies. El modelo del knife mejorado se sigue viendo así como su mejora de daño siguen activas! quiero que solo cuando sean humanos se vea el modelo asi como sus respectivo efecto de daño,cknoback y rof pero cuando sean zombies la mejora del knife no este activa. Agradeceria su ayuda
Estoy utilizando el mod de Xbatista (GunXPMOD) para mi zp, tengo problemas con la mejora del knife de la tienda de mejoras del mod
-> gunxpmod_shop.
Bueno el problema es el siguiente: El knife/cuchillo se mejora, aumenta su daño, cambia el modelo del mismo y lo que debe, pero se supone que esta mejora es solo para los TEAM CT!! ósea para los humanos en este caso. Al momento de ser infectado quiero que no sea valida esta mejora para lo T/Zombies. El modelo del knife mejorado se sigue viendo así como su mejora de daño siguen activas! quiero que solo cuando sean humanos se vea el modelo asi como sus respectivo efecto de daño,cknoback y rof pero cuando sean zombies la mejora del knife no este activa. Agradeceria su ayuda
Código PHP:
#include <amxmodx>
#include <engine>
#include <gunxpmod>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
new PLUGIN_NAME[] = "UNLOCK : Knife"
new PLUGIN_AUTHOR[] = "xbatista"
new PLUGIN_VERSION[] = "1.0"
#define IsPlayer(%1) ( 1 <= %1 <= g_maxplayers )
new cvar_knock;
const m_flNextSecondaryAttack = 47;
const m_pPlayer = 41
const m_flPrimaryAttack = 46;
new pCvarRof;
new const WEAPON_V_MDL[] = "models/v_knife.mdl";
new const WEAPON_P_MDL[] = "models/p_knife.mdl";
#define WEAPON_CSW CSW_KNIFE
new g_maxplayers
new damage_knife
new bool:g_Weapon[33];
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_gxm_item("Furia Nocturna - (Knife)", "", 500, 5, GUN_SECTION_KNIFE, 0, CSW_KNIFE)
RegisterHam( Ham_TakeDamage, "player", "Ham_DamageWeapon");
RegisterHam( Ham_Item_Deploy , "weapon_knife" , "Event_BlockSecondaryAttack", 2 );
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "Event_BlockSecondaryAttack" , 2 );
register_event("CurWeapon","Event_CurWeaponKNIFE", "be", "1=1")
register_event("Damage" , "event_Damage" , "b" , "2>0");
pCvarRof = register_cvar( "knife_rof", "0.090" );
damage_knife = register_cvar("gxm_damage_knife","2.0"); // damage multiplier
cvar_knock = register_cvar("zp_knife_power" , "10");
g_maxplayers = get_maxplayers();
}
public plugin_precache()
{
engfunc(EngFunc_PrecacheModel, WEAPON_V_MDL);
engfunc(EngFunc_PrecacheModel, WEAPON_P_MDL);
}
public Event_BlockSecondaryAttack ( const Entity )
{
static id ; id = get_pdata_cbase(Entity, m_pPlayer, 4)
if (g_Weapon[id] && IsPlayer(id))
{
set_pdata_float( Entity, m_flPrimaryAttack, get_pcvar_float( pCvarRof ), 4 );
set_pdata_float( Entity , m_flNextSecondaryAttack , get_pcvar_float( pCvarRof ), 4 );
}
}
public gxm_item_enabled(id)
{
g_Weapon[id] = true;
}
public client_connect(id)
{
g_Weapon[id] = false;
}
public Event_CurWeaponKNIFE(id)
{
if (!g_Weapon[id])
return PLUGIN_CONTINUE;
new Gun = read_data(2)
if( Gun == CSW_KNIFE && get_user_team(id) == 2)
{
entity_set_string(id, EV_SZ_viewmodel, WEAPON_V_MDL)
entity_set_string(id, EV_SZ_weaponmodel, WEAPON_P_MDL)
}
return PLUGIN_CONTINUE;
}
public event_Damage(id)
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE;
new weapon , attacker = get_user_attacker(id , weapon);
if(!is_user_alive(attacker))
return PLUGIN_CONTINUE;
if (!g_Weapon[attacker])
return PLUGIN_CONTINUE;
if(weapon == CSW_KNIFE && get_user_team(attacker) == 2)
{
new Float:vec[3];
new Float:oldvelo[3];
get_user_velocity(id, oldvelo);
create_velocity_vector(id , attacker , vec);
vec[0] += oldvelo[0];
vec[1] += oldvelo[1];
set_user_velocity(id , vec);
}
return PLUGIN_CONTINUE;
}
public Ham_DamageWeapon(id, inflictor, attacker, Float:damage, damagebits)
{
if ( !(1 <= attacker <= g_maxplayers) || !g_Weapon[attacker])
return HAM_IGNORED;
new weaponx = get_user_weapon(attacker, _, _);
if( weaponx == CSW_KNIFE && get_user_team(attacker) == 2)
{
SetHamParamFloat(4, damage * get_pcvar_float(damage_knife)); //Knife damage
return HAM_HANDLED;
}
return HAM_IGNORED;
}
// Stock by the one and only, Chronic :P
stock create_velocity_vector(victim,attacker,Float:velocity[3])
{
if(!is_user_alive(attacker))
return 0;
new Float:vicorigin[3];
new Float:attorigin[3];
entity_get_vector(victim , EV_VEC_origin , vicorigin);
entity_get_vector(attacker , EV_VEC_origin , attorigin);
new Float:origin2[3]
origin2[0] = vicorigin[0] - attorigin[0];
origin2[1] = vicorigin[1] - attorigin[1];
new Float:largestnum = 0.0;
if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]);
if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]);
origin2[0] /= largestnum;
origin2[1] /= largestnum;
velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knock) * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knock) * 3000) ) / get_entity_distance(victim , attacker);
if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
velocity[2] = random_float(200.0 , 275.0);
return 1;
}