Raised This Month: $ Target: $400
 0% 

Gun + knife models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Buddy
Junior Member
Join Date: Apr 2006
Location: Germany/Bayer
Old 04-10-2006 , 17:33  
Reply With Quote #1

hy....

how can i turn it [ON] [OFF] in the Map.cfg or Server.cfg, Amx.cfg

I used the Code from ---> Golden Colts

http://forums.alliedmods.net/showthread.php?p=132765

(I am from Germany and my english are very bad)

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <cstrike>

new g_lastweap[33]

public plugin_init() 
{ 
  	register_plugin("amx_Dragon_knife1", AMXX_VERSION_STR, "[MUDDA]Middy")
  	register_event("CurWeapon","handle_gun","be","1=1")
  	register_forward(FM_TraceLine,"fw_traceline",1);
}

public handle_gun(id)
{
  	new clip, ammo
 	new weap = get_user_weapon(id,clip,ammo)

  	if(clip > 16 && weap == CSW_KNIFE)
  	{
		new iWPNidx = -1,wpn[32]
		get_weaponname(weap,wpn,31)
		while ((iWPNidx = find_ent_by_class(iWPNidx, wpn)) != 0)
		{
			if (id == entity_get_edict(iWPNidx, EV_ENT_owner)) 
			{
				cs_set_weapon_ammo(iWPNidx,16)
			}
		}
 	}

  	if(weap == CSW_KNIFE && g_lastweap[id] != weap)
  	{
		entity_set_string(id, EV_SZ_viewmodel, "models/v_Dragon_knife1.mdl")
	}
}


public plugin_precache()
{
  	precache_model("models/v_Dragon_knife1.mdl")
}

public plugin_modules() 
{
	require_module("FakeMeta");
	require_module("Engine");
	require_module("Cstrike");
}

public fw_traceline(Float:v1[3],Float:v2[3],noMonsters,id) 
{
	if(!is_user_connected(id) || !is_user_alive(id)) 
	{
		return FMRES_IGNORED;
	}

	new victim = get_tr(TR_pHit);

	if(!is_user_connected(victim) || !is_user_alive(victim)) 
	{
		return FMRES_IGNORED;
	}

	new clip, ammo, weapon = get_user_weapon(id,clip,ammo);

	if(weapon != CSW_KNIFE || clip <= 0) 
	{
		return FMRES_IGNORED;
	}

	new hitplace = get_tr(TR_iHitgroup);

	if(hitplace == HIT_LEFTARM) 
	{
		set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect it an arm
	}
	else if(hitplace == HIT_RIGHTARM) 
	{
		set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg
	}
	else if(hitplace == HIT_RIGHTLEG)
	{
		set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg
	}
	else if(hitplace == HIT_LEFTLEG) 
	{
		set_tr(TR_iHitgroup,random_num(HIT_STOMACH,HIT_CHEST)); // redirect to a leg
	}
	
	return FMRES_IGNORED;	
}
Buddy is offline
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 16:33.


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