Help fixing an Gunxp Unlock Model Problem

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
Infamous2017
Membru, skill +1
Membru, skill +1
Posts: 228
Joined: 11 Feb 2017, 12:13
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Fond eXtream: 0
Has thanked: 2 times
Contact:

08 Jul 2019, 20:53

Hello, i have an problem. I dont get errors but the Modelchaning after Upgrade dont work. Any Idea ?

| Afiseaza codul
#include <amxmodx>
#include <engine>
#include <gxm_shop>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define IsPlayer(%1) (1 <= %1 <= g_maxplayers)
new ItemIndex
new cvar_knock;
const m_flNextSecondaryAttack = 47;
const m_pPlayer	= 41
const m_flPrimaryAttack = 46;
static bool:Knife[33]

new const KNIFE_MDL[] = "models/gunxp/v_baseball.mdl";	

new g_maxplayers, damage_knife, bool:g_KNIFE[33];

public plugin_precache()
	engfunc(EngFunc_PrecacheModel, KNIFE_MDL);

public plugin_init()
{
	register_plugin("TEST KNIFE BASEBAT" , "1.0" , "Invis");
	
	RegisterHam(Ham_TakeDamage, "player", "Ham_Damage");

	register_event("CurWeapon",	"Event_CurWeaponKNIFE", "be", "1=1")
	register_event("Damage" , "event_Damage" , "b" , "2>0");

	ItemIndex = gxm_register_knife("Base", 1000, 0, 1, 0, "KNIFE")
	
	damage_knife = register_cvar("gxm_knife_damage", "2.0");
	cvar_knock = register_cvar("gxm_knife_knocks" , "50");
	
	g_maxplayers = get_maxplayers();
}

public gxm_knife_selected(id, itemid)
{
	if(ItemIndex == itemid)
	{
		Knife[id] = true
	}
}

public client_connect(id)
	g_KNIFE[id] = false;

public Event_CurWeaponKNIFE(id) 
{
	if (!g_KNIFE[id] || cs_get_user_team(id) == CS_TEAM_T)
		return PLUGIN_CONTINUE;

	new Gun = read_data(2);
	
	if(Gun == CSW_KNIFE)
		set_pev(id, pev_viewmodel2, KNIFE_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_KNIFE[attacker])
		return PLUGIN_CONTINUE;

	if(weapon == CSW_KNIFE && cs_get_user_team(attacker) == CS_TEAM_CT)
	{
		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_Damage(id, inflictor, attacker, Float:damage, damagebits) 
{
	if ( !(1 <= attacker <= g_maxplayers) || !g_KNIFE[attacker] || cs_get_user_team(attacker) == CS_TEAM_T || damagebits == 16777216)
		return HAM_IGNORED; 

	new weaponx = get_user_weapon(attacker, _, _);
	if(weaponx == CSW_KNIFE && damagebits != 16777216)
	{
		SetHamParamFloat(4, damage * get_pcvar_float(damage_knife));
		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;
}


Inc File for Unlocks:



| Afiseaza codul
#if defined _gxm_shop_included
    #endinput
#endif

#define _gxm_shop_included

native gxm_register_gun( const Name[ ], const XP, const Level = 0, const VIP = 0, const Round = 0, const Type[ ] = 0);
native gxm_register_item( const Name[ ], const XP, const Level = 0, const VIP = 0, const Round = 0, const Type[ ] = 0);
native gxm_register_pistol( const Name[ ], const XP, const Level = 0, const VIP = 0, const Round = 0, const Type[ ] = 0);
native gxm_register_knife( const Name[ ], const XP, const Level = 0, const VIP = 0, const Round = 0, const Type[ ] = 0);
native gxm_register_grenade( const Name[ ], const XP, const Level = 0, const VIP = 0, const Round = 0, const Type[ ] = 0);



forward gxm_gun_selected( Player, ItemIndex);
forward gxm_item_selected( Player, ItemIndex);
forward gxm_pistol_selected( Player, ItemIndex);
forward gxm_knife_selected( Player, ItemIndex);
forward gxm_grenade_selected( Player, ItemIndex);
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 14 guests