Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Zombie Plague 4.3

prośba o zablokowanie unlimitedclip dla goldak i plasmagun

zombie plague 4.3

  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 ZIGI89

    Życzliwy

  • Użytkownik

Reputacja: 2
Nowy

  • Postów:30
  • GG:
  • Steam:steam
  • Lokalizacja:Łodygowice
Offline

Napisano 21.02.2016 15:11

witam chciał bym prosić  o  zablokowanie  unlimitedclip dla  goldak i plasma gan

 

posiadam serwer zombi mod 4.3

 

dokładnie chodzi mi o nie możność korzystanie z unlimited ammo  na tych dwóch broniach

 

kolega  kiedyś  zablokował możliwość zakupu goldak  po zakupieniu nieskończoności

ale da się  kupić  goldak  a potem unlimited clip

plasmagun w ogóle niejest zablokowana

 

 

oto   .sms

 

 

unlimitedclip

/*================================================================================
	
	-------------------------------------------
	-*- [ZP] Extra Item: Unlimited Clip 1.0 -*-
	-------------------------------------------
	
	~~~~~~~~~~~~~~~
	- Description -
	~~~~~~~~~~~~~~~
	
	This item/upgrade gives players unlimited clip ammo for a single round.
	
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

/*================================================================================
 [Plugin Customization]
=================================================================================*/

new const g_item_name[] = { "Nieskonczone ammo (1 runda)" }
const g_item_cost = 50
const g_maplimit = 2;

/*============================================================================*/

// CS Offsets
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4

// Max Clip for weapons
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
			10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_itemid_infammo, g_has_unlimited_clip[33]
const MAX_STATS_SAVED = 64;
new g_times_bought[33];
new db_name[MAX_STATS_SAVED][32] // player name
new db_times_bought[MAX_STATS_SAVED] // ammo pack count
new db_slot_i;
new g_maxplayers;

native zp_get_user_goldenak(id);

public plugin_init()
{
	register_plugin("[ZP] Extra: Unlimited Clip", "1.0", "MeRcyLeZZ")
	g_itemid_infammo = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN, 0)	
	register_forward(FM_ClientDisconnect, "fw_ClientDisconnect")
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
	
	g_maxplayers = get_maxplayers()
	
	// Reserved saving slots starts on maxplayers+1
	db_slot_i = g_maxplayers+1
}

public plugin_natives(){
	register_native("zp_set_user_unlimited_clip", "native_set_user_clip", 1);
	register_native("zp_get_user_unlimited_clip", "native_get_user_clip", 1);
}

// Player buys our upgrade, set the unlimited ammo flag
public zp_extra_item_selected(player, itemid)
{
	if (itemid == g_itemid_infammo){
		if (!zp_get_user_goldenak(player)){
			if (g_times_bought[player] < g_maplimit){
				g_has_unlimited_clip[player] = true
				g_times_bought[player]++;
				client_print(player, print_chat, "Kupiles Nieskonczonosc Ammo. Mozesz je jeszcze kupic %d razy", g_maplimit - g_times_bought[player]);

			}
			else{
				client_print(player, print_chat, "Wykorzystales limit kupna Nieskonczonego Ammo na tej mapie");
				return ZP_PLUGIN_HANDLED;
			}
		}
		else{
				client_print(player, print_chat, "Nie mozesz kupic Nieskonczonego Ammo posiadajac Zlotego Kalacha!");
				return ZP_PLUGIN_HANDLED;
		}
	}
}

// Reset flags for all players on newround
public event_round_start()
{
	for (new id; id <= 32; id++) g_has_unlimited_clip[id] = false;
}

// Unlimited clip code
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
	// Player doesn't have the unlimited clip upgrade
	if (!g_has_unlimited_clip[msg_entity])
		return;
	
	// Player not alive or not an active weapon
	if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
		return;
	
	static weapon, clip
	weapon = get_msg_arg_int(2) // get weapon ID
	clip = get_msg_arg_int(3) // get weapon clip
	
	// Unlimited Clip Ammo
	if (MAXCLIP[weapon] > 2) // skip grenades
	{
		set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]) // HUD should show full clip all the time
		
		if (clip < 2) // refill when clip is nearly empty
		{
			// Get the weapon entity
			static wname[32], weapon_ent
			get_weaponname(weapon, wname, sizeof wname - 1)
			weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
			
			// Set max clip on weapon
			fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
		}
	}
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
	while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
	
	return entity;
}

// Set Weapon Clip Ammo
stock fm_set_weapon_ammo(entity, amount)
{
	set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}

// Save player's stats to database
save_stats(id)
{
	new g_playername[64];
	get_user_name(id, g_playername, charsmax(g_playername));
	// Check whether there is another record already in that slot
	if (db_name[id][0] && !equal(g_playername, db_name[id]))
	{
		// If DB size is exceeded, write over old records
		if (db_slot_i >= sizeof db_name)
			db_slot_i = g_maxplayers+1
		
		// Move previous record onto an additional save slot
		copy(db_name[db_slot_i], charsmax(db_name[]), db_name[id])
		db_times_bought[db_slot_i] = db_times_bought[id]
		db_slot_i++
	}
	
	// Now save the current player stats
	copy(db_name[id], charsmax(db_name[]), g_playername) // name
	db_times_bought[id] = g_times_bought[id] // usesnum
}

// Load player's stats from database (if a record is found)
load_stats(id)
{
	new g_playername[64];
	get_user_name(id, g_playername, charsmax(g_playername));
	// Look for a matching record
	static i
	for (i = 0; i < sizeof db_name; i++)
	{
		if (equal(g_playername, db_name[i]))
		{
			// Bingo!
			g_times_bought[id] = db_times_bought[i]
			return;
		}
	}
}

public client_putinserver(id)
{
	load_stats(id);
}

public fw_ClientDisconnect(id)
{
	save_stats(id);
}

public native_set_user_clip(id){
	g_has_unlimited_clip[id] = true;
	return 1;
}

public native_get_user_clip(id){
	return g_has_unlimited_clip[id];
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par }
*/

goldak

/*
[ZP] Extra Item: Golden Ak 47
Team: Humans

Description: This plugin adds a new weapon for Human Teams.
Weapon Cost: 30

Features:
- This weapon do more damage
- This weapon has zoom
- Launch Lasers
- This weapon has unlimited bullets

Credits:

KaOs - For his Dual MP5 mod

Cvars:


- zp_goldenak_dmg_multiplier <5> - Damage Multiplier for Golden Ak 47
- zp_goldenak_gold_bullets <1|0> - Golden bullets effect ?
- zp_goldenak_custom_model <1|0> - Golden ak Custom Model
- zp_goldenak_unlimited_clip <1|0> - Golden ak Unlimited Clip 

*/



#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <cstrike>
#include <zombie_plague_advance>

native zp_get_user_unlimited_clip(id)

#define is_valid_player(%1) (1 <= %1 <= 32)

new AK_V_MODEL[64] = "models/zombie_plague/v_golden_ak47.mdl"
new AK_P_MODEL[64] = "models/zombie_plague/p_golden_ak47.mdl"

/* Pcvars */
new const cvar_goldbullets = 0,  cvar_custommodel = 1, cvar_uclip = 0;
new const Float: cvar_dmgmultiplier = 2.0;
// Item ID
new g_itemid
new const g_item_cost = 32

new bool:g_HasAk[33]

new g_hasZoom[ 33 ]
new bullets[ 33 ]

// Sprite
new m_spriteTexture

const Wep_ak47 = ((1<<CSW_AK47))

public plugin_init()
{	
	// Register The Plugin
	register_plugin("[ZP] Extra: Golden Ak 47", "1.1", "AlejandroSk")
	// Register Zombie Plague extra item
	g_itemid = zp_register_extra_item("Zloty Kalach", g_item_cost , ZP_TEAM_HUMAN, 1)
	// Death Msg
	register_event("DeathMsg", "Death", "a")
	// Weapon Pick Up
	register_event("WeapPickup","checkModel","b","1=19")
	// Current Weapon Event
	register_event("CurWeapon","checkWeapon","be","1=1")
	register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
	// Ham TakeDamage
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
	register_forward( FM_CmdStart, "fw_CmdStart" )
	RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
	
}

public plugin_natives(){
	register_native("zp_set_user_goldenak", "native_set_user_goldenak", 1);
	register_native("zp_get_user_goldenak", "native_get_user_goldenak", 1);
}

public client_connect(id)
{
	g_HasAk[id] = false
}

public client_disconnect(id)
{
	g_HasAk[id] = false
}

public Death()
{
	g_HasAk[read_data(2)] = false
}

public fwHamPlayerSpawnPost(id)
{
	g_HasAk[id] = false
}

public plugin_precache()
{
	precache_model(AK_V_MODEL)
	precache_model(AK_P_MODEL)
	m_spriteTexture = precache_model("sprites/dot.spr")
	precache_sound("weapons/zoom.wav")
}

public zp_user_infected_post(id)
{
	if (zp_get_user_zombie(id))
	{
		g_HasAk[id] = false
	}
}

public checkModel(id)
{
	if ( zp_get_user_zombie(id) )
		return PLUGIN_HANDLED
	
	new szWeapID = read_data(2)
	
	if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && cvar_custommodel )
	{
		set_pev(id, pev_viewmodel2, AK_V_MODEL)
		set_pev(id, pev_weaponmodel2, AK_P_MODEL)
	}
	return PLUGIN_HANDLED
}

public checkWeapon(id)
{
	new plrClip, plrAmmo, plrWeap[32]
	new plrWeapId
	
	plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
	
	if (plrWeapId == CSW_AK47 && g_HasAk[id])
	{
		checkModel(id)
	}
	else 
	{
		return PLUGIN_CONTINUE
	}
	
	if (plrClip == 0 && cvar_uclip)
	{
		// If the user is out of ammo..
		get_weaponname(plrWeapId, plrWeap, 31)
		// Get the name of their weapon
		give_item(id, plrWeap)
		engclient_cmd(id, plrWeap) 
		engclient_cmd(id, plrWeap)
		engclient_cmd(id, plrWeap)
	}
	
	ExecuteHamB(Ham_GiveAmmo, id, 3, "762nato", 3)
	
	return PLUGIN_HANDLED
}



public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
	if (attacker >= 1 && attacker <= 31){
		if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
		{
			SetHamParamFloat(4, damage * cvar_dmgmultiplier)
		}
	}
}

public fw_CmdStart( id, uc_handle, seed )
{
	if( !is_user_alive( id ) ) 
		return PLUGIN_HANDLED
	
	if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
	{
		new szClip, szAmmo
		new szWeapID = get_user_weapon( id, szClip, szAmmo )
		
		if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
		{
			g_hasZoom[id] = true
			cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
			emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
		}
		
		else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
		{
			g_hasZoom[ id ] = false
			cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
			
		}
		
	}
	return PLUGIN_HANDLED
}


public make_tracer(id)
{
	if (cvar_goldbullets)
	{
		new clip,ammo
		new wpnid = get_user_weapon(id,clip,ammo)
		new pteam[16]
		
		get_user_team(id, pteam, 15)
		
		if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id]) 
		{
			new vec1[3], vec2[3]
			get_user_origin(id, vec1, 1) // origin; your camera point.
			get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
			
			
			//BEAMENTPOINTS
			message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
			write_byte (0)     //TE_BEAMENTPOINTS 0
			write_coord(vec1[0])
			write_coord(vec1[1])
			write_coord(vec1[2])
			write_coord(vec2[0])
			write_coord(vec2[1])
			write_coord(vec2[2])
			write_short( m_spriteTexture )
			write_byte(1) // framestart
			write_byte(5) // framerate
			write_byte(2) // life
			write_byte(10) // width
			write_byte(0) // noise
			write_byte( 255 )     // r, g, b
			write_byte( 215 )       // r, g, b
			write_byte( 0 )       // r, g, b
			write_byte(200) // brightness
			write_byte(150) // speed
			message_end()
		}
	
		bullets[id] = clip
	}
	
}

public zp_extra_item_selected(player, itemid)
{
	if ( itemid == g_itemid)
	{
		if (!zp_get_user_unlimited_clip(player)){
			if ( user_has_weapon(player, CSW_AK47) )
			{
				drop_prim(player)
			}
			
			fm_give_item(player, "weapon_ak47")
			g_HasAk[player] = true;
		}
		else {
			client_print(player, print_chat, "Nie mozesz kupic Zlotego AK-47 jesli posiadasz Nieskonczonosc Amunicji!");
			return ZP_PLUGIN_HANDLED;
		}
	}
}

stock drop_prim(id) 
{
	new weapons[32], num
	get_user_weapons(id, weapons, num)
	for (new i = 0; i < num; i++) {
		if (Wep_ak47 & (1<<weapons[i])) 
		{
			static wname[32]
			get_weaponname(weapons[i], wname, sizeof wname - 1)
			engclient_cmd(id, "drop", wname)
		}
	}
}

public native_get_user_goldenak(id){
	return g_HasAk[id];
}

public native_set_user_goldenak(id){
	g_HasAk[id] = true;
	return 1;
}

plasmagun

/* Plugin generated by AMXX-Studio */

#include < AmxModX >
#include < FakeMeta >
#include < HamSandwich >
#include < ZombiePlague >
#include < xs >

#define PLUGIN 		"PlasmaGun"
#define VERSION 	"0.1"
#define AUTHOR 		"Opo4uMapy"

//##########Cvars [Start]##########//

#define WEAPON_MULTI_DAMAGE		1.0	// Ěíîćčňĺëü óđîíŕ (Đŕáîňŕĺň ĺńëč çŕďóůĺíî ACTIVE_TRACCE_ATTACK_DAMAGE)
#define WEAPON_TIME_NEXT_ATTACK 	0.15	// Âđĺě˙ ÷ĺđĺç ńęîëüęî áóäĺň âîçěîćíŕ ńëĺä. ŕňňŕęŕ
#define WEAPON_TIME_RELOAD		3.19	// Âđĺě˙ ďĺđĺçŕđ˙äęč
#define WEAPON__SPEED			0.20

#define WEAPON_BALL_SPEED		2000	// Ńęîđîńňü řŕđŕ
#define WEAPON_BALL_DAMAGE		60.0	// Óđîí řŕđŕ
#define WEAPON_BALL_RADIUS_EXPLODE	2.0	// Đŕäčóń âçđűâŕ řŕđŕ
#define WEAPON_BALL_SIZE		random_float(random_float(0.1 , 0.2), random_float(0.3, 0.4)) // Đŕçěĺđ řŕđŕ

#define CLIP				30	// Ďŕňđîíű â îáîéěĺ
#define AMMO				200	// Ďŕňđîíű â çŕďŕńĺ
#define ACTIVE_ZOMBIE_PLAGUE 1

//#define ACTIVE_SHOOT_DECALS			// Âęëţ÷čňü äĺęŕëč(äűđęč) îň âűńňđĺëîâ
//#define ACTIVE_SHELL				// Âęëţ÷čňü/âűęëţ÷čňü ăčëüçű
//#define ACTIVE_TRACCE_ATTACK_DAMAGE		// Âęëţ÷čňü óđîí ń ďîěîůüţ ňđĺéń ŕňňŕę

enum	// Îňäŕ÷ŕ
{
	x = -5.0,
	y = 0.0,
	z = 0.0
}

//##########Cvars [End]##########//

#define WEAPON_NEW		"weapon_plasmagun"
#define WEAPON_REFERANCE	"weapon_m249"
#define CLASS_NAME_BALL		"EntBall"

#define STATEMENT_FALLBACK(%0,%1,%2)	public %0()<>{return %1;} public %0()<%2>{return %1;}

const m_iClip 				= 	51	// îôôńĺň îáîéěű
const m_pPlayer 			= 	41 	// îôôńĺň äë˙ ďîëó÷ĺíčĺ id čăđîęŕ
const m_fInReload			=	54 	// îôôńĺň äë˙ ďîëó÷ĺíč˙ ďĺđĺçŕđ˙äęč
const m_iShellLate 			= 	57 	// îôôńĺň ăčëüç
const m_pActiveItem			= 	373 	// îôôńĺň get_pdata_cbase 
const m_flNextAttack 			= 	83 	// îôôńĺň äë˙ áëęčđîâŕíč˙ íŕćŕňčĺ
const m_flEjectBrass  			= 	111 	// îôôńĺň äë˙ âűëĺňŕ ăčëüç ń çŕäĺđćęîé
const m_szAnimExtention	 		= 	492	// îôôńĺň äë˙ óńňŕíîâęč ŕíčěŕöčč íŕ čăđîęĺ
const m_afButtonPressed 		= 	246  	// îôôńĺň äë˙ âűńňđĺëŕ čç ďčńňîëĺňŕ
const m_flTimeWeaponIdle		= 	48  	// îôôńĺň äë˙ ŕíčěŕöčč idle 
const m_flNextPrimaryAttack 		= 	46 	// îôôńĺň äë˙ ńęîđîńňč ââűńňđĺëŕ ďĺđâč÷íîé ŕňŕęč
const m_flNextSecondaryAttack		=	47	// îôôńĺň äë˙ ńęîđîńňč ââűńňđĺëŕ âňîđč÷íîé ŕňŕęč
const m_rgpPlayerItems_CBasePlayer	=	367
const m_rgpPlayerItems_CWeaponBox 	= 	34
const m_iShotsFired			=	64
const m_pNext				=	42 
const OFFSET_LINUX_WEAPONS     		=	4 	// îôôńĺň äë˙ ďóřęč
const OFFSET_LINUX    			=    	5 	// îôôńĺň äë˙ čăđîęŕ 

enum
{
	IDLE = 0,	// 1
	RELOAD,		// 2
	DRAW,		// 3
	SHOOT,		// 4
	SHOOT_END	// 5
}

new const Resources_Models[3][] = 
{
	"models/pzb_zombie/v_plasmagun.mdl",		// 0
	"models/pzb_zombie/p_plasmagun.mdl",		// 1
	"models/pzb_zombie/w_plasmagun.mdl"		// 2
}

new const Resources_Sounds[2][] = 
{
	"weapons/pzb_zombie/plasmagun-1.wav",		// 0
	"weapons/pzb_zombie/plasmagun_exp.wav"		// 1
}

new const Resources_WeaponList[2][] = 
{
	"sprites/zm/640hud3.spr",			// 0
	"sprites/zm/640hud91.spr"			// 1
}

new const Resources_Sprites[2][] =
{
	"sprites/pzb_zombie/plasmaball.spr",		// 0
	"sprites/pzb_zombie/plasmabomb.spr"		// 1
}

new const OFFSET_AMMO[31] =  // Îôńĺňű ďŕňđîíîâ
{
	0, 385, 0, 378, 0, 381, 0, 382, 380, 0, 386, 383, 382, 380, 380, 380, 382, 386, 377, 386, 379, 381, 380, 386, 378, 0, 384, 380, 378, 0, 383
}
#if defined ACTIVE_TRACCE_ATTACK_DAMAGE
new const TRACE_ATTACK[][] = 
{
	"func_breakable", 
	"hostage_entity",
	"info_target", 
	"player" 
}
#endif

#if defined ACTIVE_SHELL
new g_Shell
new const SHELL_MODEL[] = "models/rshell.mdl"
#endif

new g_WeaponID = 0, g_WeaponKey, g_SpriteExp, g_item

new g_iForwardDecalIndex, g_WeaponListData[8]

public plugin_init() 
{
	//Authors
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	//Ham
	RegisterHam(Ham_Spawn, 			"weaponbox", 		"Weapon_SpawnPost", 		1)
	RegisterHam(Ham_Touch,			"env_sprite",		"Weapon_Ball_Touch",		1)
	RegisterHam(Ham_Item_Deploy,		WEAPON_REFERANCE,	"Weapon_Deploy",		1)
	RegisterHam(Ham_Weapon_Reload, 		WEAPON_REFERANCE, 	"Hook_Reload", 			0)
	RegisterHam(Ham_Weapon_PrimaryAttack, 	WEAPON_REFERANCE, 	"Hook_PrimaryAttack_Pre",	0)
	RegisterHam(Ham_Item_AddToPlayer, 	WEAPON_REFERANCE, 	"Weapon_AddToPlayer",		0)
	RegisterHam(Ham_Item_PostFrame,		WEAPON_REFERANCE, 	"Weapon_ItemPostFrame",	0)

	#if defined ACTIVE_TRACCE_ATTACK_DAMAGE
	for(new i = 0; i < sizeof TRACE_ATTACK; i++)
	{
		RegisterHam(Ham_TraceAttack, TRACE_ATTACK[i], "Hook_TraceAttack", 0)
	}
	#endif
	
	//Forward
	register_forward(FM_UpdateClientData, 	"fw_UpdateClientData_Post", 	1)
	register_forward(FM_PlaybackEvent, 	"fw_PlaybackEvent",		0)
	register_forward(FM_SetModel, 		"fw_SetModel",			0)
	register_forward(FM_AddToFullPack, 	"CPlayer__AddToFullPack_post", 	1)
	register_forward(FM_CheckVisibility, 	"CEntity__CheckVisibility",	0)
	
	#if defined ACTIVE_SHOOT_DECALS
	register_forward(FM_TraceLine,		"FakeMeta_TraceLine_Post",	1)
	#endif

	#if defined ACTIVE_ZOMBIE_PLAGUE
	g_item = zp_register_extra_item("Wyrzutnia Plazmy", 15, ZP_TEAM_HUMAN, 1)
	#else
	register_clcmd("plasmagun", "Weapon_Give")
	#endif
	
	//Other's
	g_WeaponID = get_weaponid(WEAPON_REFERANCE)
	unregister_forward(FM_DecalIndex, g_iForwardDecalIndex, true)
}

public plugin_precache()
{
	g_WeaponKey = engfunc(EngFunc_AllocString, WEAPON_NEW)
	register_message(78, "Hook_WeaponList")
	
	new i
	
	for(i = 0; i < sizeof Resources_Models; i++)
		precache_model(Resources_Models[i])
		
	for(i = 0; i < sizeof Resources_Sounds; i++)
		precache_sound(Resources_Sounds[i])
	
	for(i = 0; i < sizeof Resources_Sprites; i++)
		precache_model(Resources_Sprites[i])
		
	for(i = 0; i < sizeof Resources_WeaponList; i++)
		precache_generic(Resources_WeaponList[i])
		
	PRECACHE_SOUNDS_FROM_MODEL(Resources_Models[0])
	
	#if defined ACTIVE_SHELL
	g_Shell = precache_model(SHELL_MODEL)
	#endif
	g_SpriteExp = precache_model(Resources_Sprites[1])
	
	new Buffer[32]
	formatex(Buffer, charsmax(Buffer), "sprites/%s.txt", WEAPON_NEW)
	precache_generic(Buffer)
	
	g_iForwardDecalIndex = register_forward(FM_DecalIndex, "FakeMeta_DecalIndex_Post", true)

	register_clcmd(WEAPON_NEW, "Weapon_Hook")
}

public Weapon_Hook(id)
{
	engclient_cmd(id, WEAPON_REFERANCE)
	return PLUGIN_HANDLED
}

#if defined ACTIVE_ZOMBIE_PLAGUE
public zp_extra_item_selected(id, itemid)
{
	if(itemid == g_item)
	{
		Weapon_Give(id)
	}
}
#endif

public Weapon_Deploy(weapon)
{		
	static id
	
	if(!CheckItem(weapon, id))
		return HAM_IGNORED

	#if defined ACTIVE_SHOOT_DECALS
	if(zp_get_user_zombie(id))
		return
	#endif

	set_pev(id, pev_viewmodel2, Resources_Models[0])
	set_pev(id, pev_weaponmodel2, Resources_Models[1])

	WeaponList(id, WEAPON_NEW)
	Weapon_SendAnim(id, DRAW)
	
	set_pdata_string(id, m_szAnimExtention * 4, "rifle", -1, OFFSET_LINUX * 4)
	set_pdata_float(id, m_flNextAttack, WEAPON_TIME_NEXT_ATTACK, OFFSET_LINUX)
	
	return HAM_IGNORED
}

public Weapon_AddToPlayer(weapon, id) 
{
	if(pev_valid(weapon) != 2 || pev_valid(id) != 2)
		return HAM_IGNORED
		
	if(pev(weapon, pev_impulse) == g_WeaponKey) 
	{
  		WeaponList(id, WEAPON_NEW)
		return HAM_HANDLED
	}
	else
	{
		WeaponList(id, WEAPON_REFERANCE)
		return HAM_IGNORED
	}
	return HAM_IGNORED
}

public fw_SetModel(entity) <WeaponBox: Enabled>
{
	state WeaponBox: Disabled

	if(pev_valid(entity) != 2) 
		return FMRES_IGNORED

	for(new i, iItem; i < 6; i++)
	{
		iItem = get_pdata_cbase(entity, m_rgpPlayerItems_CWeaponBox + i, OFFSET_LINUX_WEAPONS)
		
		if(pev_valid(iItem) == 2 && pev(iItem, pev_impulse) == g_WeaponKey)
		{
			InstallWorldModel(entity)
			return FMRES_SUPERCEDE
		}
	}
	return FMRES_IGNORED
}
STATEMENT_FALLBACK(fw_SetModel, FMRES_IGNORED, WeaponBox: Disabled)

public Hook_PrimaryAttack_Pre(weapon)
{
	static id
	
	if(CheckItem(weapon, id))
	{
		Weapon_PrimaryAttack_Pre(weapon, id)
		return HAM_SUPERCEDE
	}
	return HAM_IGNORED
}

public Weapon_PrimaryAttack_Pre(Weapon, id)
{
	static Float:vecPuncheAngle[3]

	state FireBullets: Enabled
	
	pev(id, pev_punchangle, vecPuncheAngle)
	ExecuteHam(Ham_Weapon_PrimaryAttack, Weapon)
	set_pev(id, pev_punchangle, vecPuncheAngle)
	state FireBullets: Disabled

	if(get_pdata_int(Weapon, m_iClip, OFFSET_LINUX_WEAPONS) <= 0)
		return

	if(!get_pdata_int(id, OFFSET_AMMO[g_WeaponID]))
		return

	#if defined ACTIVE_SHOOT_DECALS
	if(zp_get_user_zombie(id))
		return
	#endif

	set_pev(id, pev_punchangle, Float:{x, y, z})
	
	#if defined ACTIVE_SHELL
	cmdBrass(Weapon, id, g_Shell)
	#endif

	CreateBall(id)
	Weapon_SendAnim(id, SHOOT)
	emit_sound(id, CHAN_WEAPON, Resources_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	set_pdata_float(Weapon, m_flNextPrimaryAttack , WEAPON__SPEED , OFFSET_LINUX_WEAPONS)
	set_pdata_float(Weapon, m_flTimeWeaponIdle, WEAPON__SPEED + 3.0, OFFSET_LINUX_WEAPONS)
}

public Weapon_Ball_Touch(entity)
{
	if(!pev_valid(entity)) 
		return
	
	static ClassName[32] 
	pev(entity, pev_classname, ClassName, charsmax(ClassName))
	
	if(equali(ClassName, CLASS_NAME_BALL))
	{
		static Float:flOrigin[3]
		pev(entity, pev_origin, flOrigin)
		
		engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, flOrigin, 0)
		write_byte(TE_EXPLOSION)
		engfunc(EngFunc_WriteCoord, flOrigin[0])
		engfunc(EngFunc_WriteCoord, flOrigin[1])
		engfunc(EngFunc_WriteCoord, flOrigin[2])
		write_short(g_SpriteExp)
		write_byte(5)
		write_byte(15)
		write_byte(TE_EXPLFLAG_NOPARTICLES | TE_EXPLFLAG_NOSOUND)
		message_end()
		
		emit_sound(entity, CHAN_WEAPON, Resources_Sounds[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

		new victim  = FM_NULLENT,
		attacker = pev(entity, pev_iuser1)
		
		while((victim = engfunc(EngFunc_FindEntityInSphere, victim, flOrigin, WEAPON_BALL_RADIUS_EXPLODE)) != 0)
		{
			if(!is_user_alive(victim) || victim == attacker)
				continue

			#if defined ACTIVE_SHOOT_DECALS
			if(!zp_get_user_zombie(victim))
				return
			#endif
				
			ExecuteHamB(Ham_TakeDamage, victim, attacker, attacker, WEAPON_BALL_DAMAGE, DMG_SONIC)
		}
		engfunc(EngFunc_RemoveEntity, entity)
	}
}

public Weapon_ItemPostFrame(weapon) 
{
	static id
	id = get_pdata_cbase(weapon, m_pPlayer, OFFSET_LINUX_WEAPONS)

	if(!CheckItem(weapon, id))
		return

	#if defined ACTIVE_SHOOT_DECALS
	if(zp_get_user_zombie(id))
		return
	#endif

	if(!get_pdata_int(weapon, m_fInReload, OFFSET_LINUX_WEAPONS) || get_pdata_float(id, m_flNextAttack) > 0.0)
		return

	new iAmmo = get_pdata_int(id, OFFSET_AMMO[g_WeaponID])
	new iClip = get_pdata_int(weapon, m_iClip, OFFSET_LINUX_WEAPONS)
	new j = min(CLIP - iClip, iAmmo)

	set_pdata_int(weapon, m_iClip, iClip + j, OFFSET_LINUX_WEAPONS)
	set_pdata_int(id, OFFSET_AMMO[g_WeaponID], iAmmo - j)
	set_pdata_int(weapon, m_fInReload, 0, OFFSET_LINUX_WEAPONS)
}

public Hook_Reload(weapon) 
{    
	static id
	
	if(CheckItem(weapon, id))
	{
		Weapon_Reload(weapon, id)
		return HAM_SUPERCEDE
	}
	return HAM_IGNORED
}

public Weapon_Reload(weapon, id)
{
	if(get_pdata_int(id, OFFSET_AMMO[g_WeaponID]) <= 0)
		return

	#if defined ACTIVE_SHOOT_DECALS
	if(zp_get_user_zombie(id))
		return
	#endif
		
	ExecuteHam(Ham_Weapon_Reload, weapon)

	Weapon_SendAnim(id, RELOAD)

	set_pdata_float(id, m_flNextAttack, WEAPON_TIME_RELOAD)
	set_pdata_int(weapon, m_fInReload, 1, OFFSET_LINUX_WEAPONS)
	set_pdata_float(weapon, m_flTimeWeaponIdle, WEAPON_TIME_RELOAD, OFFSET_LINUX_WEAPONS)
}

public Weapon_Give(id)
{
	if(pev_valid(id) != 2)
		return FM_NULLENT
	
	new entity, Float:Origin[3]
	pev(id, pev_origin, Origin)
	
	if ((entity = Weapon_Create(Origin)) != FM_NULLENT)
	{
		Player_DropWeapons(id, ExecuteHamB(Ham_Item_ItemSlot, entity))
		
		set_pev(entity, pev_spawnflags, pev(entity, pev_spawnflags) | SF_NORESPAWN)
		dllfunc(DLLFunc_Touch, entity, id)
		
		set_pdata_int(id, OFFSET_AMMO[g_WeaponID], AMMO, OFFSET_LINUX)
		
		return entity
	}
	
	return FM_NULLENT
}

Weapon_Create(const Float: vecOrigin[3] = {0.0, 0.0, 0.0}, const Float: vecAngles[3] = {0.0, 0.0, 0.0})
{
	new entity

	static iszAllocStringCached
	if (iszAllocStringCached || (iszAllocStringCached = engfunc(EngFunc_AllocString, WEAPON_REFERANCE)))
	{
		entity = engfunc(EngFunc_CreateNamedEntity, iszAllocStringCached)
	}
	
	if(pev_valid(entity) != 2)
	{
		return FM_NULLENT
	}
	
	dllfunc(DLLFunc_Spawn, entity)
	engfunc(EngFunc_SetOrigin, entity, vecOrigin)
	
	set_pdata_int(entity, m_iClip, CLIP ,OFFSET_LINUX_WEAPONS)

	set_pev_string(entity, pev_classname, g_WeaponKey)
	set_pev(entity, pev_impulse, g_WeaponKey)
	set_pev(entity, pev_angles, vecAngles)
	
	InstallWorldModel(entity)
	 
	return entity
}

public Weapon_SpawnPost(entity)
{
	if(pev_valid(entity) == 2)
	{
		state (pev_valid(pev(entity, pev_owner)) == 2) WeaponBox: Enabled
	}
	
	return HAM_IGNORED
}
#if defined ACTIVE_SHOOT_DECALS
public FakeMeta_TraceLine_Post(const Float: vecTraceStart[3], const Float: vecTraceEnd[3], const fNoMonsters, const iEntToSkip, const iTrace) <FireBullets: Enabled>
{
	static Float: vecEndPos[3]
	
	get_tr2(iTrace, TR_vecEndPos, vecEndPos)
	engfunc(EngFunc_TraceLine, vecEndPos, vecTraceStart, fNoMonsters, iEntToSkip, 0)
	
	UTIL_GunshotDecalTrace(0)
	UTIL_GunshotDecalTrace(iTrace, true)
	
	return FMRES_IGNORED
}
STATEMENT_FALLBACK(FakeMeta_TraceLine_Post, FMRES_IGNORED, FireBullets: Disabled)
#endif
#if defined ACTIVE_TRACCE_ATTACK_DAMAGE
public Hook_TraceAttack(entity, iAttacker, Float:flDamage) <FireBullets: Enabled>
{
	SetHamParamFloat(3, flDamage * WEAPON_MULTI_DAMAGE)
	return HAM_IGNORED
}
STATEMENT_FALLBACK(Hook_TraceAttack, HAM_IGNORED, FireBullets: Disabled)
#endif

public fw_PlaybackEvent() <FireBullets: Enabled>
{
	return FMRES_SUPERCEDE
}
STATEMENT_FALLBACK(fw_PlaybackEvent, FMRES_IGNORED, FireBullets: Disabled)

public fw_UpdateClientData_Post(id, SendWeapons, CD_Handle )
{
	static iItem
	
	if(CheckItem2(id, iItem))
	{
		set_cd(CD_Handle, CD_flNextAttack, get_gametime() + 0.001)
	}
}

#if defined ACTIVE_SHELL
public cmdBrass(Weapon, id, ModelIndex)
{
        set_pdata_int(Weapon, m_iShellLate, ModelIndex, OFFSET_LINUX)
        set_pdata_float(id, m_flEjectBrass, get_gametime())
}
#endif

public Hook_WeaponList(MsgID, MsgDest, MsgEntity)
{
	new WeaponName[32]
	get_msg_arg_string(1, WeaponName, charsmax(WeaponName))
		
	if (!strcmp(WeaponName, WEAPON_REFERANCE))
	{
		for(new i, a = sizeof g_WeaponListData; i < a; i++)
		{
			g_WeaponListData[i] = get_msg_arg_int(i + 2)
		}
	}
}

CreateBall(id)
{
	static entity
	
	if((entity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))))
	{
		static Float:vOrigin[3], Float:vVelocity[3], vAngles[3]

		get_weapon_position(id, vOrigin, 40.0, 12.0, -5.0)
		
		set_pev(entity, pev_classname, CLASS_NAME_BALL)
		set_pev(entity, pev_movetype, MOVETYPE_FLY)
		set_pev(entity, pev_solid, SOLID_SLIDEBOX)
		
		engfunc(EngFunc_SetModel, entity, Resources_Sprites[0])
		engfunc(EngFunc_SetOrigin, entity, vOrigin)
		engfunc(EngFunc_SetSize, entity, Float:{ 0.0, 0.0, 0.0 }, Float:{ 0.0, 0.0, 0.0 })
		
		set_pev(entity, pev_renderfx, kRenderFxGlowShell)
		set_pev(entity, pev_rendermode, kRenderTransAdd)
		set_pev(entity, pev_renderamt, 255.0)
		set_pev(entity, pev_scale, WEAPON_BALL_SIZE)
		set_pev(entity, pev_iuser1, id)
		
		velocity_by_aim(id, WEAPON_BALL_SPEED, vVelocity)
		
		set_pev(entity, pev_velocity, vVelocity)
		engfunc(EngFunc_VecToAngles, vVelocity, vAngles)
		set_pev(entity, pev_angles, vAngles)
	}
}

WeaponList(id, const WeaponName[32])
{
	engfunc(EngFunc_MessageBegin, MSG_ONE, 78, {0.0, 0.0, 0.0}, id)
	write_string(WeaponName)
		
	for(new i, a = sizeof g_WeaponListData; i < a; i++)
	{
		write_byte(g_WeaponListData[i])
	}
	message_end()
}

InstallWorldModel(entity)
	engfunc(EngFunc_SetModel, entity, Resources_Models[2])

Weapon_SendAnim(id, anim)
{
	set_pev(id, pev_weaponanim, anim)

	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0.0, 0.0, 0.0}, id)
	write_byte(anim)
	write_byte(0)
	message_end()
}

stock bool:CheckItem(weapon, &id)
{
	if(pev_valid(weapon) == 2 && pev(weapon, pev_impulse) == g_WeaponKey)
	{
		id = get_pdata_cbase(weapon, m_pPlayer, OFFSET_LINUX_WEAPONS)
		if(pev_valid(id) == 2)
			return true
	}
	return false
}

stock bool:CheckItem2(id, &iItem)
{
	if(pev_valid(id) != 2)
	{
		return false
	}
	
	iItem = get_pdata_cbase(id, m_pActiveItem, OFFSET_LINUX)
	
	if(pev_valid(iItem) != 2 || pev(iItem, pev_impulse) != g_WeaponKey)
	{
		return false
	}
	
	return true
}

Player_DropWeapons(id, iSlot)
{
	new WeaponName[32], entity = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer + iSlot, OFFSET_LINUX)

	while(pev_valid(entity) == 2)
	{
		pev(entity, pev_classname, WeaponName, charsmax(WeaponName))
		engclient_cmd(id, "drop", WeaponName)

		entity = get_pdata_cbase(entity, m_pNext, OFFSET_LINUX_WEAPONS)
	}
}

stock get_weapon_position(id, Float:fOrigin[], Float:add_forward = 0.0, Float:add_right = 0.0, Float:add_up = 0.0)
{
	static Float:Angles[3],Float:ViewOfs[3], Float:vAngles[3]
	static Float:Forward[3], Float:Right[3], Float:Up[3]
	
	pev(id, pev_v_angle, vAngles)
	pev(id, pev_origin, fOrigin)
	pev(id, pev_view_ofs, ViewOfs)
	xs_vec_add(fOrigin, ViewOfs, fOrigin)
	
	pev(id, pev_angles, Angles)
	
	Angles[0] = vAngles[0]
	
	engfunc(EngFunc_MakeVectors, Angles)
	
	global_get(glb_v_forward, Forward)
	global_get(glb_v_right, Right)
	global_get(glb_v_up, Up)
	
	xs_vec_mul_scalar(Forward, add_forward, Forward)
	xs_vec_mul_scalar(Right, add_right, Right)
	xs_vec_mul_scalar(Up, add_up, Up)
	
	fOrigin[0] = fOrigin[0] + Forward[0] + Right[0] + Up[0]
	fOrigin[1] = fOrigin[1] + Forward[1] + Right[1] + Up[1]
	fOrigin[2] = fOrigin[2] + Forward[2] + Right[2] + Up[2]
}
#if defined ACTIVE_SHOOT_DECALS
//Decals
//By KORD
#define INSTANCE(%0) ((%0 == -1) ? 0 : %0)

new Array:g_hDecals

public FakeMeta_DecalIndex_Post()
{
	if(!g_hDecals)
		g_hDecals = ArrayCreate(1, 1)
	
	ArrayPushCell(g_hDecals, get_orig_retval())
}

UTIL_GunshotDecalTrace(const iTrace, const bool: bIsGunshot = false)
{
	static iHit;
	static iMessage;
	static iDecalIndex;
	
	static Float: flFraction; 
	static Float: vecEndPos[3];
	
	iHit = INSTANCE(get_tr2(iTrace, TR_pHit));
	
	if (iHit && pev_valid(iHit) != 2 || (pev(iHit, pev_flags) & FL_KILLME))
	{
		return;
	}
	
	if (pev(iHit, pev_solid) != SOLID_BSP && pev(iHit, pev_movetype) != MOVETYPE_PUSHSTEP)
	{
		return;
	}
	
	iDecalIndex = ExecuteHamB(Ham_DamageDecal, iHit, 0);
	
	if (iDecalIndex < 0 || iDecalIndex >=  ArraySize(g_hDecals))
	{
		return;
	}
	
	iDecalIndex = ArrayGetCell(g_hDecals, iDecalIndex);
	
	get_tr2(iTrace, TR_flFraction, flFraction);
	get_tr2(iTrace, TR_vecEndPos, vecEndPos);
	
	if (iDecalIndex < 0 || flFraction >= 1.0)
	{
		return;
	}
	
	if (bIsGunshot)
	{
		iMessage = TE_GUNSHOTDECAL
	}
	else
	{
		iMessage = TE_DECAL;
		
		if (iHit != 0)
		{
			if (iDecalIndex > 255)
			{
				iMessage = TE_DECALHIGH
				iDecalIndex -= 256
			}
		}
		else
		{
			iMessage = TE_WORLDDECAL
			
			if (iDecalIndex > 255)
			{
				iMessage = TE_WORLDDECALHIGH
				iDecalIndex -= 256
			}
		}
	}
	
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, vecEndPos, 0)
	write_byte(iMessage)
	engfunc(EngFunc_WriteCoord, vecEndPos[0])
	engfunc(EngFunc_WriteCoord, vecEndPos[1])
	engfunc(EngFunc_WriteCoord, vecEndPos[2])
	
	if (bIsGunshot)
	{
		write_short(iHit)
		write_byte(iDecalIndex)
	}
	else 
	{
		write_byte(iDecalIndex)
		
		if (iHit)
		{
			write_short(iHit)
		}
	}
    
	message_end()
}
#endif
PRECACHE_SOUNDS_FROM_MODEL(const szModelPath[])
{
	new iFile
	
	if ((iFile = fopen(szModelPath, "rt")))
	{
		new szSoundPath[64]
		
		new iNumSeq, iSeqIndex
		new iEvent, iNumEvents, iEventIndex
		
		fseek(iFile, 164, SEEK_SET)
		fread(iFile, iNumSeq, BLOCK_INT)
		fread(iFile, iSeqIndex, BLOCK_INT)
		
		for (new k, i = 0; i < iNumSeq; i++)
		{
			fseek(iFile, iSeqIndex + 48 + 176 * i, SEEK_SET)
			fread(iFile, iNumEvents, BLOCK_INT)
			fread(iFile, iEventIndex, BLOCK_INT)
			fseek(iFile, iEventIndex + 176 * i, SEEK_SET)

			for (k = 0; k < iNumEvents; k++)
			{
				fseek(iFile, iEventIndex + 4 + 76 * k, SEEK_SET)
				fread(iFile, iEvent, BLOCK_INT)
				fseek(iFile, 4, SEEK_CUR)
				
				if (iEvent != 5004)
				{
					continue
				}

				fread_blocks(iFile, szSoundPath, 64, BLOCK_CHAR)
				
				if (strlen(szSoundPath))
				{
					strtolower(szSoundPath)
					precache_sound(szSoundPath)
				}
			}
		}
	}
	
	fclose(iFile);
}


  • +
  • -
  • 0
<img src="http://steamprofile....1:25467514.png" alt="Tekst alternatywny" />





Również z jednym lub większą ilością słów kluczowych: zombie plague 4.3

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych