Eroare Furien Weapons

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
CaPy.lNt
Membru, skill +1
Membru, skill +1
Posts: 146
Joined: 23 Mar 2013, 21:11
Detinator Steam: Nu
CS Status: studiez
Detinator server CS: DR.ECILA.RO
Reputatie: Restrictie PM
Has thanked: 34 times
Been thanked: 13 times
Contact:

29 Nov 2013, 23:51

salut , am si eu o eroare la pluginul de arme...
| Afiseaza codul
L 11/29/2013 - 23:47:18: [AMXX] Displaying debug trace (plugin "bot.amxx")
L 11/29/2013 - 23:47:18: [AMXX] Run time error 4: index out of bounds 
L 11/29/2013 - 23:47:18: [AMXX]    [0] bot.sma::Player_TakeDamage (line 1692)
Cat si la arrmele V.I.P arma cu numarul 5 nu merge modelul..apare cel normal..inainte mergea, aparea gold

Sursa pluginului :
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <ColorChat>
#include <engine>
#include <xs>

#define PLUGIN "Furien Weapons Menu"
#define VERSION "1.0"
#define AUTHOR "Tr3fla & Edit By Blue" // si-a bagat si hades nasul pe aici

#define ADMIN_FLAG ADMIN_KICK
#define VIP_FLAG ADMIN_LEVEL_H

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

native set_user_credits ( id, credits );
native get_user_credits ( id );

const m_flNextSecondaryAttack =	47
/* AK47 Golden pentru VIP */
new const vGoldenAk[ 64 ] = "models/fw/v_goldenak.mdl"
new const pGoldenAk[ 64 ] = "models/fw/p_goldenak.mdl"

/* M4A1 Golden pentru VIP */
new const vGoldenM4[ 64 ] = "models/fw/v_goldenm4.mdl"
new const pGoldenM4[ 64 ] = "models/fw/p_goldenm4.mdl"

/* Deagle Golden pentru VIP */
new const vGDeagle[ 64 ] = "models/fw/v_gdeagle.mdl"
new const pGDeagle[ 64 ] = "models/fw/p_deagle.mdl"

new const vFatal [ 64 ] = "models/fw/v_fatal.mdl";
new const pFatal [ 64 ] = "models/fw/p_fatal.mdl";

new const vBarlog [ 64 ] = "models/fw/v_barlog.mdl";
new const pBarlog [ 64 ] = "models/fw/p_barlog.mdl";

//new m_spriteTexture

new bool: ArmaPrimita[ 33 ]
new bool: AreGoldenAK[ 33 ]
new bool: AreGoldenM4[ 33 ]
new bool: AreGDeagle[ 33 ]
new bool: HaveFatal [ 33 ];
new bool: HaveBarlog [ 33 ];

new normalTrace[33], lastTrace[33], cvEnabled, weapon2, dummy;

#define ENG_NULLENT		-1
#define EV_INT_WEAPONKEY	EV_INT_impulse
#define watergun_WEAPONKEY 893
#define MAX_PLAYERS  			  32
#define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)

#define TASK_FBURN				100
#define ID_FBURN					( taskid - TASK_FBURN )

#define MAX_CLIENTS				32

new bool:g_fRoundEnd

#define FIRE_DURATION		6
#define FIRE_DAMAGE		25

const USE_STOPPED = 0
const OFFSET_ACTIVE_ITEM = 373
const OFFSET_WEAPONOWNER = 41
const OFFSET_LINUX = 5
const OFFSET_LINUX_WEAPONS = 4

#define WEAP_LINUX_XTRA_OFF		4
#define m_fKnown					44
#define m_flNextPrimaryAttack 		46
#define m_iClip					51
#define PLAYER_LINUX_XTRA_OFF	5
#define m_flNextAttack				83

#define watergun_RELOAD_TIME 	3.5
#define watergun_RELOAD		1
#define watergun_DRAW		2
#define watergun_SHOOT1		3
#define watergun_SHOOT2		4

new g_flameSpr
new g_smokeSpr

new g_burning_duration[ MAX_CLIENTS + 1 ]

#define write_coord_f(%1)	engfunc(EngFunc_WriteCoord,%1)

new const Fire_Sounds[][] = { "weapons/waterp.wav" }

new watergun_V_MODEL[64] = "models/fw/v_waterg.mdl"
new watergun_P_MODEL[64] = "models/fw/p_waterg.mdl"
new watergun_W_MODEL[64] = "models/fw/w_waterg.mdl"

//new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }

new cvar_dmg_watergun, cvar_recoil_watergun, cvar_clip_watergun, cvar_spd_watergun, cvar_watergun_ammo
new g_MaxPlayers, g_orig_event_watergun, g_IsInPrimaryAttack
new Float:cl_pushangle[MAX_PLAYERS + 1][3], m_iBlood[2]
new g_has_watergun[33], g_clip_ammo[33], g_watergun_TmpClip[33], oldweap[33]
new watergun_sprite

const PRIMARY_WEAPONS_BIT_SUM = 
(1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<
CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
			"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
			"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
			"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
			"weapon_ak47", "weapon_knife", "weapon_p90" }

			
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))

#define FIRERATE 0.2
#define HITSD 0.7
#define RELOADSPEED 5.0
#define DAMAGE 250.0
#define DAMAGE_MULTI 3.0

#define CSW_WPN CSW_FAMAS
new const weapon[] = "weapon_famas"

new const spr_beam[] = "sprites/plasma/plasma_beam.spr"
new const spr_exp[] = "sprites/plasma/plasma_exp.spr"
new const spr_blood[] = "sprites/blood.spr"
new const snd_fire[][] = { "zombie_plague/plasma/plasma_fire.wav" }
new const snd_reload[][] = { "zombie_plague/plasma/plasma_reload.wav" }
new const snd_hit[][] = { "zombie_plague/plasma/plasma_hit.wav" }

new bool:g_HasRifle[33]
new g_iCurWpn[33], Float:g_flLastFireTime[33]
new g_sprBeam, g_sprExp, g_sprBlood, g_msgDamage, g_msgScreenFade, g_msgScreenShake

const m_pPlayer = 		41
const m_fInReload =		54
const m_pActiveItem = 		373
const m_flTimeWeaponIdle = 	48

const UNIT_SECOND =		(1<<12)
const WPN_MAXCLIP =		25
const ANIM_FIRE = 		5
const ANIM_DRAW = 		10
const ANIM_RELOAD =		9
const EV_INT_WEAPONKEY = 	EV_INT_impulse
const WPNKEY = 			2816

public plugin_init( ) {
	register_plugin( PLUGIN, VERSION, AUTHOR )
	
	register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" )
	//register_event("CurWeapon", "GoldenEffect", "be", "1=1", "3>0" )
	
	
	cvEnabled = register_cvar("fwm_enabled","1");
	register_event("ResetHUD","event_resethud","b");		//
	register_clcmd("fullupdate","cmd_fullupdate");
	
	register_forward(FM_TraceLine,"fw_traceline");
	register_forward(FM_PlayerPostThink,"fw_playerpostthink");	//
	
	RegisterHam( Ham_Spawn, "player", "fwPlayerSpawn", true )
	RegisterHam ( Ham_TakeDamage, "player", "Player_TakeDamage" );
	RegisterHam( Ham_TakeDamage, "player", "fwTakeDamage" )
	
	register_clcmd( "say /weapons", "ClcmdWeaponsMenus" )
	register_event ( "CurWeapon", "CurrWeapon2", "be", "1=1" );
	
	register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
	register_event("CurWeapon","CurrentWeapon","be","1=1")
	RegisterHam(Ham_Item_AddToPlayer, "weapon_mp5navy", "fw_watergun_AddToPlayer")
	RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1)
	for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
	if (WEAPONENTNAMES[0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES, "fw_Item_Deploy_Post", 1)
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "fw_watergun_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "fw_watergun_PrimaryAttack_Post", 1)
	RegisterHam(Ham_Item_PostFrame, "weapon_mp5navy", "watergun_ItemPostFrame")
	RegisterHam(Ham_Weapon_Reload, "weapon_mp5navy", "watergun_Reload")
	RegisterHam(Ham_Weapon_Reload, "weapon_mp5navy", "watergun_Reload_Post", 1)
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
	RegisterHam( Ham_Spawn, "player", "PlayerSpawn_Post", 1 );
	register_forward(FM_SetModel, "fw_SetModel")
	register_event( "DeathMsg", "EV_DeathMsg", "a" );
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post_fw", 1)
	register_forward(FM_PlaybackEvent, "fwPlaybackEvent")
	
	//RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_breakable", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_wall", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_door", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_door_rotating", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_plat", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_rotating", "fw_TraceAttack", 1)

	cvar_dmg_watergun = register_cvar("zp_watergun_dmg", "0.86")
	cvar_recoil_watergun = register_cvar("zp_watergun_recoil", "1.01")
	cvar_clip_watergun = register_cvar("zp_watergun_clip", "40")
	cvar_spd_watergun = register_cvar("zp_watergun_spd", "1.02")
	cvar_watergun_ammo = register_cvar("zp_watergun_ammo", "200")
	
	
	g_MaxPlayers = get_maxplayers()
	
	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0");
	register_event("CurWeapon", "event_CurWeapon", "b", "1=1")	

	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	RegisterHam(Ham_Item_Deploy, weapon, "fw_Deploy_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, weapon, "fw_AddToPlayer")
	RegisterHam(Ham_Weapon_Reload, weapon, "fw_Reload_Post", 1)
	RegisterHam(Ham_Item_PostFrame, weapon, "fw_PostFrame")
	
	g_msgDamage = get_user_msgid("Damage")
	g_msgScreenFade = get_user_msgid("ScreenFade")
	g_msgScreenShake = get_user_msgid("ScreenShake")
	
}

public plugin_precache( ) {
	precache_model( vGoldenAk )
	precache_model( pGoldenAk )
	precache_model( vGoldenM4 )
	precache_model( pGoldenM4 )
	precache_model( vGDeagle )
	precache_model( pGDeagle )
	
	precache_model ( vBarlog );
	precache_model ( pBarlog );
	
	precache_model ( vFatal );
	precache_model ( pFatal );
	
	//m_spriteTexture = precache_model( "sprites/dot.spr" )
	
	precache_model(watergun_V_MODEL)
	precache_model(watergun_P_MODEL)
	precache_model(watergun_W_MODEL)
	for(new i = 0; i < sizeof Fire_Sounds; i++)
	precache_sound(Fire_Sounds)	
	m_iBlood[0] = precache_model("sprites/blood.spr")
	m_iBlood[1] = precache_model("sprites/bloodspray.spr")
	watergun_sprite = precache_model("sprites/watergun.spr")

	g_flameSpr = precache_model( "sprites/flame.spr" );
	g_smokeSpr = precache_model( "sprites/black_smoke3.spr" );

	register_forward(FM_PrecacheEvent, "fwPrecacheEvent_Post", 1)
	
	precache_model("models/fw/plasma/v_plasma.mdl")
	precache_model("models/fw/plasma/p_plasma.mdl")

	g_sprBlood = precache_model(spr_blood)
	g_sprBeam = precache_model(spr_beam)
	g_sprExp = precache_model(spr_exp)
	
	static i
	for(i = 0; i < sizeof snd_fire; i++)
		precache_sound(snd_fire)
	for(i = 0; i < sizeof snd_hit; i++)
		precache_sound(snd_hit)
	for(i = 0; i < sizeof snd_reload; i++)
		precache_sound(snd_reload)	
		
}

public fwPlayerSpawn( id ) {
	AreGoldenAK[ id ] = false
	AreGoldenM4[ id ] = false
	AreGDeagle[ id ] = false
	ArmaPrimita[ id ] = false
	HaveFatal [ id ] = false;
	HaveBarlog [ id ] = false;
	
	if( is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_CT ) {
		strip_user_weapons( id )
		PopUpWeaponsMenu( id )
		give_item( id, "weapon_knife" )
		give_item( id, "weapon_usp" )
		cs_set_user_bpammo( id, CSW_USP, 100 )
	}
	else if( is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_T ) {
		strip_user_weapons( id ) 
		give_item( id, "weapon_knife" )
		give_item( id, "weapon_hegrenade" )
		give_item( id, "weapon_flashbang" )
		give_item( id, "weapon_smokegrenade" )
		cs_set_user_bpammo( id, CSW_FLASHBANG, 2 )
	}
}

public PopUpWeaponsMenu( id ) {
	new FurienWeaponsMenu = menu_create( "\yAnti-Furien\r Weapons", "FurienWeaponsHandler" )
	
	menu_additem( FurienWeaponsMenu, "Arme\y Hunter", "1", 0 )
	menu_additem( FurienWeaponsMenu, "Arme\r V.I.P", "2", 0 )
	
	// aici si-a bagat hades ownage nasul
	
	menu_additem ( FurienWeaponsMenu, "\wCiuruitoare \r[Special] \y[25 CREDITE]", "3", 0 );
	menu_additem ( FurienWeaponsMenu, "\wArma Fatala \r[Special] \y[80 CREDITE]", "4", 0 );
	menu_additem ( FurienWeaponsMenu, "\wDragon \r[Special] \y[45 CREDITE]", "5", 0 );
	
	menu_setprop( FurienWeaponsMenu, MPROP_EXIT, MEXIT_ALL )
	menu_display( id, FurienWeaponsMenu, 0 )
}

public FurienWeaponsHandler( id, FurienWeaponsMenu, item ) {
	
	if ( get_user_team ( id ) != 2 ) return 1;
	
	if( item == MENU_EXIT ) {
		menu_destroy( FurienWeaponsMenu )
		return PLUGIN_HANDLED
	}
	
	switch( item ) {
		case 0 : {
			ArmeNormale( id ) 
		}
		case 1 : {
			if( get_user_flags( id ) & VIP_FLAG ) {
				ArmeVIP( id ) 
			}
			else {
				ColorChat( id, GREEN, "^4[Furien Weapons]^1 Aceste arme sunt rezervate numai pentru^3 V.I.P^1." )
				PopUpWeaponsMenu( id )
			}

		}
		
		case 2:
		{
			
			new iCredits = get_user_credits(id) - 25;
			if( iCredits < 0 )
			{
				ColorChat ( id, GREEN, "^4[Furien Weapons]^1 Nu ai destule credite, credite necesare:^3 25^1." );
				return 1;
			}
			else
			{
				set_user_credits ( id, iCredits );
				ArmaPrimita[ id ] = true;
				HaveFatal [ id ] = true;
				give_item ( id, "weapon_m249" );
				cs_set_user_bpammo ( id, CSW_M249, 300 );
				CurrWeapon2 ( id );
			}
			
			
			return 1;
		}
		
		case 3:
		{
			
			
			
			new iCredits = get_user_credits(id) - 80;
			if( iCredits < 0 )
			{
				ColorChat ( id, GREEN, "^4[Furien Weapons]^1 Nu ai destule credite, credite necesare:^3 80^1." );
				return 1;
			}
			else
			{
				set_user_credits ( id, iCredits );
				ArmaPrimita[ id ] = true;
				give_laser ( id );
			}
			
			return 1;
		}
		
		case 4:
		{
			new iCredits = get_user_credits(id) - 45;
			if( iCredits < 0 )
			{
				ColorChat ( id, GREEN, "^4[Furien Weapons]^1 Nu ai destule credite, credite necesare:^3 45^1." );
				return 1;
			}
			else
			{
				set_user_credits ( id, iCredits );
				ArmaPrimita[ id ] = true;
				HaveBarlog [ id ] = true;
				give_item ( id, "weapon_xm1014" );
				cs_set_user_bpammo ( id, CSW_XM1014, 200 );
				CurrWeapon2 ( id );
			}
			
			return 1;
		}
	}
	return PLUGIN_HANDLED
}
public ArmeNormale( id ) {
	
	new MeniuArmeNormale = menu_create( "\wMeniu are pentru\r Playeri", "ArmeNormaleHandler" )
	
	menu_additem( MeniuArmeNormale, "\r AK47", "1", 0 )
	menu_additem( MeniuArmeNormale, "M4A1", "2", 0 )
	menu_additem( MeniuArmeNormale, "Mp5 Navy", "3", 0 )
	menu_additem( MeniuArmeNormale, "XM1014", "4", 0 )
	menu_additem( MeniuArmeNormale, "\r M3", "5", 0 )
	menu_additem( MeniuArmeNormale, "\r GALIL", "6", 0 )
	menu_additem( MeniuArmeNormale, "\r P\y90", "7", 0 )
	
	
	menu_setprop( MeniuArmeNormale, MPROP_EXIT, MEXIT_ALL )
	menu_display( id, MeniuArmeNormale, 0 )
}

public ArmeNormaleHandler( id, MeniuArmeNormale, item ) {
	if( !is_user_alive( id ) ) {
		ColorChat( id, GREEN, "^4[Furien Weapons]^1 Nu iti poti alege arma atunci cand esti mort!" )
		return PLUGIN_HANDLED
	}
	
	if ( get_user_team ( id ) != 2 ) return 1;
	
	if( item == MENU_EXIT ) {
		menu_destroy( MeniuArmeNormale )
		return PLUGIN_HANDLED 
	}
	
	switch( item ) {
		case 0 : {
			give_item( id, "weapon_ak47" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_AK47, 200 )
			ArmaPrimita[ id ] = true
		}
		case 1 : {
			give_item( id, "weapon_m4a1" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M4A1, 200 )
			ArmaPrimita[ id ] = true
		}
		case 2 : {
			give_item( id, "weapon_mp5navy" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_MP5NAVY, 200 )
			ArmaPrimita[ id ] = true
		}
		case 3 : {
			give_item( id, "weapon_xm1014" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_XM1014, 200 )
			ArmaPrimita[ id ] = true
		}
		
		case 4 : {
			give_item( id, "weapon_m3" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M3, 30 )
			ArmaPrimita[ id ] = true
		}
		
		case 5 : {
			give_item( id, "weapon_galil" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_GALIL, 200 )
			ArmaPrimita[ id ] = true
		}
		case 6 : {
			give_item( id, "weapon_p90" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_P90, 200 )
			ArmaPrimita[ id ] = true
		}
		
		
	}
	menu_destroy( MeniuArmeNormale )
	return PLUGIN_HANDLED
}

public ArmeVIP( id ) {
	new MeniuArmeVIP = menu_create( "\yArme \r*\w V\r.\wI\r.\wP\r *", "ArmeVIPHandler" )
	
	menu_additem( MeniuArmeVIP, "Golden AK47\r  (\y2x DMG\r)", "1", 0 )
	menu_additem( MeniuArmeVIP, "Golden M4A1\r (\y2x DMG\r)", "2", 0 )					
	menu_additem( MeniuArmeVIP, "Golden DEAGLE\r   (\y2x DMG\r)", "3", 0 )			
	menu_additem( MeniuArmeVIP, "Ciuruitoarea\r   (\y100 GL\r)", "4", 0 )
	
	menu_setprop( MeniuArmeVIP, MPROP_EXIT, MEXIT_ALL )
	menu_display( id, MeniuArmeVIP, 0 )
}

public ArmeVIPHandler( id, MeniuArmeVIP, item ) {
	if( !is_user_alive( id ) ) {
		ColorChat( id, GREEN, "^4[Furien Weapons]^1 Nu iti poti alege arma atunci cand esti mort!" )
		return PLUGIN_HANDLED
	}
	
	if ( get_user_team ( id ) != 2 ) return 1;
	
	if( item == MENU_EXIT ) {
		menu_destroy( MeniuArmeVIP )
		return PLUGIN_HANDLED
	}
	
	switch( item ) {
		case 0 : {
			give_item( id, "weapon_ak47" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_AK47, 250 )
			set_pev( id, pev_viewmodel2, vGoldenAk )
			set_pev( id, pev_weaponmodel2, pGoldenAk )
			ArmaPrimita[ id ] = true
			AreGoldenAK[ id ] = true
		}
		case 1 : {
			give_item( id, "weapon_m4a1" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M4A1, 250 )
			set_pev( id, pev_viewmodel2, vGoldenM4 )
			set_pev( id, pev_weaponmodel2, pGoldenM4 )
			ArmaPrimita[ id ] = true
			AreGoldenM4[ id ] = true
		}
		case 2 : {
			give_item( id, "weapon_deagle" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_DEAGLE, 250 )
			set_pev( id, pev_viewmodel2, vGDeagle )
			set_pev( id, pev_weaponmodel2, pGDeagle )
			ArmaPrimita[ id ] = true
			AreGDeagle[ id ] = true
		}
		case 3 : {
			give_item( id, "weapon_m249" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M249, 200 )
			ArmaPrimita[ id ] = true
		}
	}
	menu_destroy( MeniuArmeVIP )
	return PLUGIN_HANDLED
}

public ClcmdWeaponsMenus( id ) {
	if( !is_user_alive( id ) ) {
		ColorChat( id,GREEN, "^4[Furien Weapons]^1 Nu poti sa-ti alegeti arma atunci cand esti mort!" )
		return 
	}
	
	if( ArmaPrimita[ id ] ) {
		ColorChat( id, GREEN,"^4[Furien Weapons]^1 Ti-ai ales deja arma in aceasta runda!" )
		return 
	}
	
	if( cs_get_user_team( id ) == CS_TEAM_CT ) {
		PopUpWeaponsMenu( id )
	}
}

public Event_CurWeapon( id ) {
	new Arma = read_data( 2 )
	
	if( Arma == CSW_AK47 && AreGoldenAK[ id ] ) {
		set_pev( id, pev_viewmodel2, vGoldenAk )
		set_pev( id, pev_weaponmodel2, pGoldenAk )
	}
	
	if( Arma == CSW_M4A1 && AreGoldenM4[ id ] ) {
		set_pev( id, pev_viewmodel2, vGoldenM4 )
		set_pev( id, pev_weaponmodel2, pGoldenM4 )
	}
	
	if( Arma == CSW_DEAGLE && AreGDeagle[ id ] ) {
		set_pev( id, pev_viewmodel2, vGDeagle )
		set_pev( id, pev_weaponmodel2, pGDeagle )
	}
	
	

}

public CurrWeapon2 ( id ) {
	
	if ( get_user_weapon ( id ) == CSW_M249 && HaveFatal [ id ] ) {
		
		set_pev ( id, pev_viewmodel2, vFatal );
		set_pev ( id, pev_weaponmodel2, pFatal );
		
	}
	
	if ( get_user_weapon ( id ) == CSW_XM1014 && HaveBarlog [ id ] ) {
		
		set_pev ( id, pev_viewmodel2, vBarlog );
		set_pev ( id, pev_weaponmodel2, pBarlog );
		
	}
	
}

public fwTakeDamage( Victim, Inflictor, Attacker, Float:Damage ) {
	if( is_valid_player( Attacker ) && get_user_weapon( Attacker ) == CSW_AK47 && AreGoldenAK[ Attacker ] ) {
		SetHamParamFloat( 4, Damage * 2 )
	}
	
	if( is_valid_player( Attacker) && get_user_weapon( Attacker ) == CSW_M4A1 && AreGoldenM4[ Attacker ] ) {
		SetHamParamFloat( 4, Damage * 2 )
	}
	
	if( is_valid_player( Attacker ) && get_user_weapon( Attacker ) == CSW_DEAGLE && AreGDeagle[ Attacker ] ) {
		SetHamParamFloat( 4, Damage * 2 )
	}
	

}

//public GoldenEffect( id ) {
//	new clip,ammo
//	new Arma = get_user_weapon(id,clip,ammo)

//	if (Arma == CSW_AK47 && AreGoldenAK[ id ] || Arma == CSW_M4A1 && AreGoldenM4[ id ] || Arma == CSW_MP5NAVY && AreGoldenMP5[ id ]  ) {
//		new vec1[ 3 ], vec2[ 3 ]
//		get_user_origin( id, vec1, 1 ) 
//		get_user_origin( id, vec2, 4 ) 
//
//		message_begin( MSG_BROADCAST,SVC_TEMPENTITY )
//		write_byte ( 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 )  
//		write_byte( 5 ) 
//		write_byte( 2 ) 
//		write_byte( 10 ) 
//		write_byte( 0  ) 
//		write_byte( 255  )     
//		write_byte( 215  )       
//		write_byte(  0 )       
//		write_byte( 200 ) 
//		write_byte( 150 ) 
//		message_end( )
//	}
//}

/* Edit lucylucy */


// reset normal trace id on join or leave
public client_connect(id)
{
	normalTrace[id] = 0;
	g_has_watergun[id] = false

	g_HasRifle[id] = false
}

public client_disconnect(id)
{
	normalTrace[id] = 0;
	g_has_watergun[id] = false
	g_HasRifle[id] = false
	remove_task(id + TASK_FBURN )
}

// player spawns, and some other such things
public event_resethud(id)
{
	lastTrace[id] = 0;
}

// block forced resethud call
public cmd_fullupdate(id)
{
	return PLUGIN_HANDLED;
}

// traceline hook, meat and bones of the entire plugin
public fw_traceline(Float:vecStart[3],Float:vecEnd[3],ignoreM,id,pentru) // pentToSkip == id, for clarity
{
	if(!is_user_connected(id))
		return FMRES_IGNORED;
	
	// grab normal trace
	if(!normalTrace[id])
	{
		normalTrace[id] = pentru;
		return FMRES_IGNORED;
	}
	
	// ignore normal trace
	else if(pentru == normalTrace[id])
		return FMRES_IGNORED;
	
	// no functionality
	if(!get_pcvar_num(cvEnabled))
		return FMRES_IGNORED;
	
	// not a player entity, or player is dead
	if(!is_user_alive(id))
		return FMRES_IGNORED;
	
	// not shooting anything
	if(!(pev(id,pev_button) & IN_ATTACK))
		return FMRES_IGNORED;
	
	weapon2 = get_user_weapon(id,dummy,dummy);
	
	// using a shotgun, expect multiple tracelines
	if(weapon2 == CSW_M3 || weapon2 == CSW_XM1014)
		return FMRES_IGNORED;
	
	// this is a second traceline, for shooting through walls
	if(pentru == lastTrace[id])
	{
		// values sure to throw off any traceline
		set_tr(TR_vecEndPos,Float:{4096.0,4096.0,4096.0});
		set_tr(TR_AllSolid,1);
		set_tr(TR_pHit,0);
		set_tr(TR_iHitgroup,0);
		set_tr(TR_flFraction,1.0);
		
		return FMRES_SUPERCEDE;
	}
	
	// remeber traceline index for next time
	lastTrace[id] = pentru;
	
	return FMRES_IGNORED;
}

// finished client calculations, reset our traceline index
public fw_playerpostthink(id)
{
	lastTrace[id] = 0;
}




public plugin_natives ()
{
	register_native("give_weapon_watergun", "native_give_weapon_add", 1)
}
public native_give_weapon_add(id)
{
	give_watergun(id)
}

public fwPrecacheEvent_Post(type, const name[])
{
	if (equal("events/mp5n.sc", name))
	{
		g_orig_event_watergun = get_orig_retval()
		return FMRES_HANDLED
	}
	return FMRES_IGNORED
}

public fw_SetModel(entity, model[])
{
	if(!is_valid_ent(entity))
		return FMRES_IGNORED
	
	static szClassName[33]
	entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
		
	if(!equal(szClassName, "weaponbox"))
		return FMRES_IGNORED
	
	static iOwner
	
	iOwner = entity_get_edict(entity, EV_ENT_owner)
	
	if(equal(model, "models/w_mp5.mdl"))
	{
		static iStoredAugID
		
		iStoredAugID = find_ent_by_owner(ENG_NULLENT, "weapon_mp5navy", entity)
	
		if(!is_valid_ent(iStoredAugID))
			return FMRES_IGNORED
	
		if(g_has_watergun[iOwner])
		{
			entity_set_int(iStoredAugID, EV_INT_WEAPONKEY, watergun_WEAPONKEY)
			
			g_has_watergun[iOwner] = false
			
			entity_set_model(entity, watergun_W_MODEL)
			
			return FMRES_SUPERCEDE
		}
	}
	return FMRES_IGNORED
}

public EV_DeathMsg( )
{
	static pevVictim;
	pevVictim = read_data( 2 )
	
	if( !is_user_connected( pevVictim ) )
		return
		
	remove_task( pevVictim + TASK_FBURN )
}

public PlayerSpawn_Post( Player )
{
	if( !is_user_alive( Player ) )
		return;
		
	g_burning_duration[ Player ] = 0
}

public give_watergun(id)
{
	drop_weapons(id, 1)
	new iWep2 = give_item(id,"weapon_mp5navy")
	if( iWep2 > 0 )
	{
		cs_set_weapon_ammo(iWep2, get_pcvar_num(cvar_clip_watergun))
		cs_set_user_bpammo (id, CSW_MP5NAVY, get_pcvar_num(cvar_watergun_ammo))	
		UTIL_PlayWeaponAnimation(id, watergun_DRAW)
		set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
	}
	g_has_watergun[id] = true
}

public fw_watergun_AddToPlayer(watergun, id)
{
	if(!is_valid_ent(watergun) || !is_user_connected(id))
		return HAM_IGNORED
	
	if(entity_get_int(watergun, EV_INT_WEAPONKEY) == watergun_WEAPONKEY)
	{
		g_has_watergun[id] = true
		
		entity_set_int(watergun, EV_INT_WEAPONKEY, 0)
		
		return HAM_HANDLED
	}
	return HAM_IGNORED
}

public fw_UseStationary_Post(entity, caller, activator, use_type)
{
	if (use_type == USE_STOPPED && is_user_connected(caller))
		replace_weapon_models(caller, get_user_weapon(caller))
}

public fw_Item_Deploy_Post(weapon_ent)
{
	static owner
	owner = fm_cs_get_weapon_ent_owner(weapon_ent)
	
	static weaponid
	weaponid = cs_get_weapon_id(weapon_ent)
	
	replace_weapon_models(owner, weaponid)
}

public CurrentWeapon(id)
{
	
     replace_weapon_models(id, read_data(2))

     if(read_data(2) != CSW_MP5NAVY || !g_has_watergun[id])
          return
     
     static Float:iSpeed
     if(g_has_watergun[id])
          iSpeed = get_pcvar_float(cvar_spd_watergun)
     
     static weapon[32],Ent
     get_weaponname(read_data(2),weapon,31)
     Ent = find_ent_by_owner(-1,weapon,id)
     if(Ent)
     {
          static Float:Delay
          Delay = get_pdata_float( Ent, 46, 4) * iSpeed
          if (Delay > 0.0)
          {
               set_pdata_float(Ent, 46, Delay, 4)
          }
     }
}

replace_weapon_models(id, weaponid)
{
	
	
	
	switch (weaponid)
	{
		case CSW_MP5NAVY:
		{
			
			if(g_has_watergun[id])
			{
				set_pev(id, pev_viewmodel2, watergun_V_MODEL)
				set_pev(id, pev_weaponmodel2, watergun_P_MODEL)
				if(oldweap[id] != CSW_MP5NAVY) 
				{
					UTIL_PlayWeaponAnimation(id, watergun_DRAW)
					set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
				}
			}
		}
	}
	oldweap[id] = weaponid
}

public fw_UpdateClientData_Post_fw(Player, SendWeapons, CD_Handle)
{
	if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_MP5NAVY || !g_has_watergun[Player]))
		return FMRES_IGNORED
	
	set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
	return FMRES_HANDLED
}

public fw_watergun_PrimaryAttack(Weapon)
{
	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	if (!g_has_watergun[Player])
		return
	
	g_IsInPrimaryAttack = 1
	pev(Player,pev_punchangle,cl_pushangle[Player])
	
	g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
}

public fwPlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if ((eventid != g_orig_event_watergun) || !g_IsInPrimaryAttack)
		return FMRES_IGNORED
	if (!(1 <= invoker <= g_MaxPlayers))
    return FMRES_IGNORED

	playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
	return FMRES_SUPERCEDE
}

public fw_watergun_PrimaryAttack_Post(Weapon)
{
	g_IsInPrimaryAttack = 0
	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	new szClip, szAmmo
	get_user_weapon(Player, szClip, szAmmo)
	
	if(!is_user_alive(Player))
		return

	if(g_has_watergun[Player])
	{
		if (!g_clip_ammo[Player])
			return

		new Float:push[3]
		pev(Player,pev_punchangle,push)
		xs_vec_sub(push,cl_pushangle[Player],push)
		
		xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil_watergun),push)
		xs_vec_add(push,cl_pushangle[Player],push)
		set_pev(Player,pev_punchangle,push)
		
		emit_sound(Player, CHAN_WEAPON, Fire_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
		UTIL_PlayWeaponAnimation(Player, random_num(watergun_SHOOT1, watergun_SHOOT2))

		static Float:plrViewAngles[3], Float:VecEnd[3], Float:VecDir[3], Float:PlrOrigin[3]
		pev(Player, pev_v_angle, plrViewAngles)

		static Float:VecSrc[3], Float:VecDst[3]
	
		//VecSrc = pev->origin + pev->view_ofs
		pev(Player, pev_origin, PlrOrigin)
		pev(Player, pev_view_ofs, VecSrc)
		xs_vec_add(VecSrc, PlrOrigin, VecSrc)

		//VecDst = VecDir * 8192.0
		angle_vector(plrViewAngles, ANGLEVECTOR_FORWARD, VecDir);
		xs_vec_mul_scalar(VecDir, 8192.0, VecDst);
		xs_vec_add(VecDst, VecSrc, VecDst);
	
		new hTrace = create_tr2()
		engfunc(EngFunc_TraceLine, VecSrc, VecDst, 0, Player, hTrace)
		get_tr2(hTrace, TR_vecEndPos, VecEnd);

		create_tracer_water(Player, VecSrc, VecEnd)	
	}
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
	if(!is_user_alive(attacker))
		return;

	if (victim != attacker && is_user_connected(attacker))
	{
		if(get_user_weapon(attacker) == CSW_MP5NAVY)
		{
			if(g_has_watergun[attacker])
			{
				SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmg_watergun))

				if( !task_exists( victim + TASK_FBURN ) )
				{
					g_burning_duration[ victim ] += FIRE_DURATION * 5
				
					set_task( 0.2, "CTask__BurningFlame", victim + TASK_FBURN, _, _, "b" )
				}
			}
		}
	}
}

public message_DeathMsg(msg_id, msg_dest, id)
{
	static szTruncatedWeapon[33], iAttacker, iVictim
	
	get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
	
	iAttacker = get_msg_arg_int(1)
	iVictim = get_msg_arg_int(2)
	
	if(!is_user_connected(iAttacker) || iAttacker == iVictim)
		return PLUGIN_CONTINUE
	
	if(equal(szTruncatedWeapon, "mp5navy") && get_user_weapon(iAttacker) == CSW_MP5NAVY)
	{
		if(g_has_watergun[iAttacker])
			set_msg_arg_string(4, "mp5navy")
	}
	return PLUGIN_CONTINUE
}

stock fm_cs_get_current_weapon_ent(id)
{
	return get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, OFFSET_LINUX)
}

stock fm_cs_get_weapon_ent_owner(ent)
{
	return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS)
}

stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
{
	set_pev(Player, pev_weaponanim, Sequence)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
	write_byte(Sequence)
	write_byte(pev(Player, pev_body))
	message_end()
}

public watergun_ItemPostFrame(weapon_entity) 
{
     new id = pev(weapon_entity, pev_owner)
     if (!is_user_connected(id))
          return HAM_IGNORED

     if (!g_has_watergun[id])
          return HAM_IGNORED

     static iClipExtra
     
     iClipExtra = get_pcvar_num(cvar_clip_watergun)
     new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, PLAYER_LINUX_XTRA_OFF)

     new iBpAmmo = cs_get_user_bpammo(id, CSW_MP5NAVY);
     new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)

     new fInReload = get_pdata_int(weapon_entity, m_fInReload, WEAP_LINUX_XTRA_OFF) 

     if( fInReload && flNextAttack <= 0.0 )
     {
	     new j = min(iClipExtra - iClip, iBpAmmo)
	
	     set_pdata_int(weapon_entity, m_iClip, iClip + j, WEAP_LINUX_XTRA_OFF)
	     cs_set_user_bpammo(id, CSW_MP5NAVY, iBpAmmo-j)
		
	     set_pdata_int(weapon_entity, m_fInReload, 0, WEAP_LINUX_XTRA_OFF)
	     fInReload = 0
     }
     return HAM_IGNORED
}

public watergun_Reload(weapon_entity) 
{
     new id = pev(weapon_entity, pev_owner)
     if (!is_user_connected(id))
          return HAM_IGNORED

     if (!g_has_watergun[id])
          return HAM_IGNORED

     static iClipExtra

     if(g_has_watergun[id])
          iClipExtra = get_pcvar_num(cvar_clip_watergun)

     g_watergun_TmpClip[id] = -1

     new iBpAmmo = cs_get_user_bpammo(id, CSW_MP5NAVY)
     new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)

     if (iBpAmmo <= 0)
          return HAM_SUPERCEDE

     if (iClip >= iClipExtra)
          return HAM_SUPERCEDE

     g_watergun_TmpClip[id] = iClip

     return HAM_IGNORED
}

public watergun_Reload_Post(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_connected(id))
		return HAM_IGNORED

	if (!g_has_watergun[id])
		return HAM_IGNORED

	if (g_watergun_TmpClip[id] == -1)
		return HAM_IGNORED

	set_pdata_int(weapon_entity, m_iClip, g_watergun_TmpClip[id], WEAP_LINUX_XTRA_OFF)

	set_pdata_float(weapon_entity, m_flTimeWeaponIdle, watergun_RELOAD_TIME, WEAP_LINUX_XTRA_OFF)

	set_pdata_float(id, m_flNextAttack, watergun_RELOAD_TIME, PLAYER_LINUX_XTRA_OFF)

	set_pdata_int(weapon_entity, m_fInReload, 1, WEAP_LINUX_XTRA_OFF)

	UTIL_PlayWeaponAnimation(id, watergun_RELOAD)

	return HAM_IGNORED
}

stock create_tracer_water(id, Float:fVec1[3], Float:fVec2[3])
{
	static iVec1[3]
	FVecIVec(fVec1, iVec1)

	static Float:origin[3], Float:vSrc[3], Float:angles[3], Float:v_forward[3], Float:v_right[3], Float:v_up[3], Float:gun_position[3], Float:player_origin[3], Float:player_view_offset[3]
	pev(id, pev_v_angle, angles)
	engfunc(EngFunc_MakeVectors, angles)
	global_get(glb_v_forward, v_forward)
	global_get(glb_v_right, v_right)
	global_get(glb_v_up, v_up)

	//m_pPlayer->GetGunPosition( ) = pev->origin + pev->view_ofs
	pev(id, pev_origin, player_origin)
	pev(id, pev_view_ofs, player_view_offset)
	xs_vec_add(player_origin, player_view_offset, gun_position)

	xs_vec_mul_scalar(v_forward, 24.0, v_forward)
	xs_vec_mul_scalar(v_right, 3.0, v_right)

	if ((pev(id, pev_flags) & FL_DUCKING) == FL_DUCKING)
		xs_vec_mul_scalar(v_up, 6.0, v_up)
	else
		xs_vec_mul_scalar(v_up, -2.0, v_up)

	xs_vec_add(gun_position, v_forward, origin)
	xs_vec_add(origin, v_right, origin)
	xs_vec_add(origin, v_up, origin)

	vSrc[0] = origin[0]
	vSrc[1] = origin[1]
	vSrc[2] = origin[2]

	new Float:dist = get_distance_f(vSrc, fVec2)
	new CountDrops = floatround(dist / 50.0)
	
	if (CountDrops > 20)
		CountDrops = 20
	
	if (CountDrops < 2)
		CountDrops = 2

	message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, vSrc[0])
	engfunc(EngFunc_WriteCoord, vSrc[1])
	engfunc(EngFunc_WriteCoord, vSrc[2])
	engfunc(EngFunc_WriteCoord, fVec2[0])
	engfunc(EngFunc_WriteCoord, fVec2[1])
	engfunc(EngFunc_WriteCoord, fVec2[2])
	write_short(watergun_sprite)
	write_byte(CountDrops)
	write_byte(0)
	write_byte(1)
	write_byte(60)
	write_byte(10)
	message_end()

	message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1)
	write_byte(TE_BEAMPOINTS)
	engfunc(EngFunc_WriteCoord, fVec2[0])
	engfunc(EngFunc_WriteCoord, fVec2[1])
	engfunc(EngFunc_WriteCoord, fVec2[2])
	engfunc(EngFunc_WriteCoord, vSrc[0])
	engfunc(EngFunc_WriteCoord, vSrc[1])
	engfunc(EngFunc_WriteCoord, vSrc[2])
	write_short(watergun_sprite)
	write_byte(6)
	write_byte(200) 
	write_byte(1)
	write_byte(100)
	write_byte(0)
	write_byte(64); write_byte(64); write_byte(192);
	write_byte(192)
	write_byte(250) 
	message_end()
}

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

public CTask__BurningFlame( taskid )
{
	// Get player origin and flags
	static origin[3], flags
	get_user_origin(ID_FBURN, origin)
	flags = pev(ID_FBURN, pev_flags)
	
	// Madness mode - in water - burning stopped
	if ((flags & FL_INWATER) || g_burning_duration[ID_FBURN] < 1 || g_fRoundEnd || !is_user_alive(ID_FBURN))
	{
		// Smoke sprite
		message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
		write_byte(TE_SMOKE) // TE id
		write_coord(origin[0]) // x
		write_coord(origin[1]) // y
		write_coord(origin[2]-50) // z
		write_short(g_smokeSpr) // sprite
		write_byte(random_num(15, 20)) // scale
		write_byte(random_num(10, 20)) // framerate
		message_end()
		
		// Task not needed anymore
		remove_task(taskid)
		return
	}
	
	// Get player's health
	static health
	health = pev(ID_FBURN, pev_health)
	
	// Take damage from the fire
	if (health - FIRE_DAMAGE > 0)
		fm_set_user_health(ID_FBURN, health - FIRE_DAMAGE)
	
	// Flame sprite
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_SPRITE) // TE id
	write_coord(origin[0]+random_num(-5, 5)) // x
	write_coord(origin[1]+random_num(-5, 5)) // y
	write_coord(origin[2]+random_num(-10, 10)) // z
	write_short(g_flameSpr) // sprite
	write_byte(random_num(5, 10)) // scale
	write_byte(200) // brightness
	message_end()

	
	g_burning_duration[ID_FBURN]--
}

stock fm_set_user_health( index, health ) 
	health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index);

	
public event_CurWeapon(id)
{
	if(!is_user_alive(id))
	return PLUGIN_CONTINUE
		
	g_iCurWpn[id] = read_data(2)
	
		
	if(!g_HasRifle[id] || g_iCurWpn[id] != CSW_WPN) 
		return PLUGIN_CONTINUE
		
	entity_set_string(id, EV_SZ_viewmodel, "models/fw/plasma/v_plasma.mdl")
	entity_set_string(id, EV_SZ_weaponmodel, "models/fw/plasma/p_plasma.mdl")
	return PLUGIN_CONTINUE
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
	if(is_user_alive(victim))
	{
		g_HasRifle[victim] = false
		return HAM_HANDLED
	}
	return HAM_IGNORED
}

public Event_NewRound()
{
	for (new i = 1; i <= get_maxplayers(); i++)
	{
		g_HasRifle = false
	}
}

public give_laser(id)
{
		
	new bool:HasWpn = bool:user_has_weapon(id, CSW_WPN)
		
	if(!g_HasRifle[id] && !HasWpn)
	{
		g_HasRifle[id] = true	
		fm_give_item(id, weapon)	
		cs_set_user_bpammo(id, CSW_WPN, 100)	
		engclient_cmd(id, weapon)
	}

	
	return PLUGIN_CONTINUE
}
public fw_CmdStart(id, handle, seed)
{
	if(!is_user_alive(id))
		return FMRES_IGNORED
	
	if(!g_HasRifle[id])
		return FMRES_IGNORED
		

	
	if(g_iCurWpn[id] != CSW_WPN)
		return FMRES_IGNORED
		
	static iButton
	iButton = get_uc(handle, UC_Buttons)
	
	if(iButton & IN_ATTACK)
	{
		set_uc(handle, UC_Buttons, iButton & ~IN_ATTACK)
		
		static Float:flCurTime
		flCurTime = halflife_time()
		
		if(flCurTime - g_flLastFireTime[id] < FIRERATE)
			return FMRES_IGNORED
			
		static iWpnID, iClip
		iWpnID = get_pdata_cbase(id, m_pActiveItem, 5)
		iClip = cs_get_weapon_ammo(iWpnID)
		
		if(get_pdata_int(iWpnID, m_fInReload, 4))
			return FMRES_IGNORED
		
		set_pdata_float(iWpnID, m_flNextPrimaryAttack, FIRERATE, 4)
		set_pdata_float(iWpnID, m_flNextSecondaryAttack, FIRERATE, 4)
		set_pdata_float(iWpnID, m_flTimeWeaponIdle, FIRERATE, 4)
		g_flLastFireTime[id] = flCurTime
		if(iClip <= 0)
		{
			ExecuteHamB(Ham_Weapon_PlayEmptySound, iWpnID)
			return FMRES_IGNORED
		}
		primary_attack(id)
		make_punch(id, 50)
		cs_set_weapon_ammo(iWpnID, --iClip)
		
		return FMRES_IGNORED
	}
	
	return FMRES_IGNORED
}
public fw_UpdateClientData_Post(id, sendweapons, handle)
{
	if(!is_user_alive(id))
		return FMRES_IGNORED
		
	if(!g_HasRifle[id])
		return FMRES_IGNORED
		
	
	if(g_iCurWpn[id] != CSW_WPN)
		return FMRES_IGNORED
		
	set_cd(handle, CD_flNextAttack, halflife_time() + 0.001)
	return FMRES_HANDLED
}
public fw_Deploy_Post(wpn)
{
	static id
	id = get_pdata_cbase(wpn, m_pPlayer, 4)
	
	if(is_user_connected(id) && g_HasRifle[id])
	{
		set_wpnanim(id, ANIM_DRAW)
	}
	return HAM_IGNORED
}
public fw_AddToPlayer(wpn, id)
{
	if(is_valid_ent(wpn) && is_user_connected(id) && entity_get_int(wpn, EV_INT_WEAPONKEY) == WPNKEY)
	{
		g_HasRifle[id] = true
		entity_set_int(wpn, EV_INT_WEAPONKEY, 0)
		return HAM_HANDLED
	}
	return HAM_IGNORED
}
public fw_PostFrame(wpn)
{
	static id
	id = get_pdata_cbase(wpn, m_pPlayer, 4)

	if(is_user_alive(id) && g_HasRifle[id])
	{
		static Float:flNextAttack, iBpAmmo, iClip, iInReload
		iInReload = get_pdata_int(wpn, m_fInReload, 4)
		flNextAttack = get_pdata_float(id, m_flNextAttack, 5)
		iBpAmmo = cs_get_user_bpammo(id, CSW_WPN)
		iClip = cs_get_weapon_ammo(wpn)
		
		if(iInReload && flNextAttack <= 0.0)
		{
			new iRemClip = min(WPN_MAXCLIP - iClip, iBpAmmo)
			cs_set_weapon_ammo(wpn, iClip + iRemClip)
			cs_set_user_bpammo(id, CSW_WPN, iBpAmmo-iRemClip)
			iInReload = 0
			set_pdata_int(wpn, m_fInReload, 0, 4)
		}
		static iButton
		iButton = get_user_button(id)

		if((iButton & IN_ATTACK2 && get_pdata_float(wpn, m_flNextSecondaryAttack, 4) <= 0.0) || (iButton & IN_ATTACK && get_pdata_float(wpn, m_flNextPrimaryAttack, 4) <= 0.0))
			return
		
		if(iButton & IN_RELOAD && !iInReload)
		{
			if(iClip >= WPN_MAXCLIP)
			{
				entity_set_int(id, EV_INT_button, iButton & ~IN_RELOAD)
				set_wpnanim(id, 0)
			}
			else if(iClip == WPN_MAXCLIP)
			{
				if(iBpAmmo)
				{
					reload(id, wpn, 1)
				}
			}
		}
	}
}
public fw_Reload_Post(wpn)
{
	static id
	id = get_pdata_cbase(wpn, m_pPlayer, 4)
	
	if(is_user_alive(id) && g_HasRifle[id] && get_pdata_int(wpn, m_fInReload, 4))
	{		
		reload(id, wpn)
	}
}
public primary_attack(id)
{
	set_wpnanim(id, ANIM_FIRE)
	entity_set_vector(id, EV_VEC_punchangle, Float:{ -1.5, 0.0, 0.0 })
	emit_sound(id, CHAN_WEAPON, snd_fire[random_num(0, sizeof snd_fire - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

	static iTarget, iBody, iEndOrigin[3], iStartOrigin[3]
	get_user_origin(id, iStartOrigin, 1) 
	get_user_origin(id, iEndOrigin, 3)
	fire_effects(iStartOrigin, iEndOrigin)
	get_user_aiming(id, iTarget, iBody)
	
	new iEnt = create_entity("info_target")
	
	static Float:flOrigin[3]
	IVecFVec(iEndOrigin, flOrigin)
	entity_set_origin(iEnt, flOrigin)
	remove_entity(iEnt)
	
	if(is_user_alive(iTarget))
	{	
		if(HITSD > 0.0)
		{
			static Float:flVelocity[3]
			get_user_velocity(iTarget, flVelocity)
			xs_vec_mul_scalar(flVelocity, HITSD, flVelocity)
			set_user_velocity(iTarget, flVelocity)	
		}
		if(get_user_team ( id ) != get_user_team ( iTarget ))
		{
			new iHp = pev(iTarget, pev_health)
			new Float:iDamage, iBloodScale
			if(iBody == HIT_HEAD)
			{
				iDamage = DAMAGE
				iBloodScale = 10
			}
			else
			{
				iDamage = DAMAGE*DAMAGE_MULTI
				iBloodScale = 25
			}
			if(iHp > iDamage) 
			{
				make_blood(iTarget, iBloodScale)
				set_pev(iTarget, pev_health, iHp-iDamage)
				damage_effects(iTarget)
			}
			else if(iHp <= iDamage)
			{
				ExecuteHamB(Ham_Killed, iTarget, id, 2)
			}
		}
	}
	else
	{
		emit_sound(id, CHAN_WEAPON, snd_hit[random_num(0, sizeof snd_hit - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}
stock fire_effects(iStartOrigin[3], iEndOrigin[3])
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(0)    
	write_coord(iStartOrigin[0])
	write_coord(iStartOrigin[1])
	write_coord(iStartOrigin[2])
	write_coord(iEndOrigin[0])
	write_coord(iEndOrigin[1])
	write_coord(iEndOrigin[2])
	write_short(g_sprBeam)
	write_byte(1) 
	write_byte(5) 
	write_byte(10) 
	write_byte(25) 
	write_byte(0) 
	write_byte(0)     
	write_byte(255)      
	write_byte(0)      
	write_byte(100) 
	write_byte(0) 
	message_end()
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(3)
	write_coord(iEndOrigin[0])
	write_coord(iEndOrigin[1])
	write_coord(iEndOrigin[2])
	write_short(g_sprExp)
	write_byte(10)
	write_byte(15)
	write_byte(4)
	message_end()	
}
stock reload(id, wpn, force_reload = 0)
{
	set_pdata_float(id, m_flNextAttack, RELOADSPEED, 5)
	set_wpnanim(id, ANIM_RELOAD)
	emit_sound(id, CHAN_WEAPON, snd_reload[random_num(0, sizeof snd_reload - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	
	if(force_reload)
		set_pdata_int(wpn, m_fInReload, 1, 4)
}
stock damage_effects(id)
{
	message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, id)
	write_byte(0)
	write_byte(0)
	write_long(DMG_NERVEGAS)
	write_coord(0) 
	write_coord(0)
	write_coord(0)
	message_end()
	
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)
	write_short(1<<13)
	write_short(1<<14)
	write_short(0x0000)
	write_byte(0)
	write_byte(255)
	write_byte(0)
	write_byte(100) 
	message_end()
		
	message_begin(MSG_ONE, g_msgScreenShake, {0,0,0}, id)
	write_short(0xFFFF)
	write_short(1<<13)
	write_short(0xFFFF) 
	message_end()
}
stock make_blood(id, scale)
{
	new Float:iVictimOrigin[3]
	pev(id, pev_origin, iVictimOrigin)
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(115)
	write_coord(floatround(iVictimOrigin[0]+random_num(-20,20))) 
	write_coord(floatround(iVictimOrigin[1]+random_num(-20,20))) 
	write_coord(floatround(iVictimOrigin[2]+random_num(-20,20))) 
	write_short(g_sprBlood)
	write_short(g_sprBlood) 
	write_byte(248) 
	write_byte(scale) 
	message_end()
}
stock set_wpnanim(id, anim)
{
	entity_set_int(id, EV_INT_weaponanim, anim)
	message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, id)
	write_byte(anim)
	write_byte(entity_get_int(id, EV_INT_body))
	message_end()
}
stock make_punch(id, velamount) 
{
	static Float:flNewVelocity[3], Float:flCurrentVelocity[3]
	velocity_by_aim(id, -velamount, flNewVelocity)
	get_user_velocity(id, flCurrentVelocity)
	xs_vec_add(flNewVelocity, flCurrentVelocity, flNewVelocity)
	set_user_velocity(id, flNewVelocity)	
}
stock fm_give_item(index, const item[])
{
	if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
		return 0;

	new ent = fm_create_entity(item);
	if (!pev_valid(ent))
		return 0;
	
	new Float:origin[3];
	pev(index, pev_origin, origin);
	set_pev(ent, pev_origin, origin);
	set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
	dllfunc(DLLFunc_Spawn, ent);
	
	new save = pev(ent, pev_solid);
	dllfunc(DLLFunc_Touch, ent, index);
	if (pev(ent, pev_solid) != save)
		return ent;
	
	engfunc(EngFunc_RemoveEntity, ent);
	
	return -1;
}

public Player_TakeDamage ( iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits ) {
	
	if ( HaveBarlog [ iAttacker ] && get_user_weapon ( iAttacker ) == CSW_XM1014 && is_valid_player( iAttacker) ) {
		
		SetHamParamFloat( 4, fDamage * 3.0);
		return HAM_HANDLED;
		
	}
	
	if ( HaveFatal [ iAttacker ] && get_user_weapon ( iAttacker ) == CSW_M249 && is_valid_player( iAttacker) ) {
		
		SetHamParamFloat( 4, fDamage * 2.4);
		return HAM_HANDLED;
		
	}
	
	return HAM_IGNORED;
	
}
Image

Image
Rapidserver
CaPy.lNt
Membru, skill +1
Membru, skill +1
Posts: 146
Joined: 23 Mar 2013, 21:11
Detinator Steam: Nu
CS Status: studiez
Detinator server CS: DR.ECILA.RO
Reputatie: Restrictie PM
Has thanked: 34 times
Been thanked: 13 times
Contact:

30 Nov 2013, 11:39

Nu stie nimeni?
Image

Image
User avatar
anaconda cs
Membru, skill +3
Membru, skill +3
Posts: 1045
Joined: 13 Nov 2012, 06:39
Detinator Steam: Da
Detinator server CS: Dr.InDungi.Ro
SteamID: anaconda_indungi
Location: Iasi
Has thanked: 49 times
Been thanked: 45 times
Contact:

30 Nov 2013, 11:44

nici nu se compileaza
posteaza sursa calumea
Image
Image
CaPy.lNt
Membru, skill +1
Membru, skill +1
Posts: 146
Joined: 23 Mar 2013, 21:11
Detinator Steam: Nu
CS Status: studiez
Detinator server CS: DR.ECILA.RO
Reputatie: Restrictie PM
Has thanked: 34 times
Been thanked: 13 times
Contact:

30 Nov 2013, 12:23

Merge compilat..asa da el eroare..dar se compileaza
Image

Image
User avatar
ExoTiQ
Membru, skill +1
Membru, skill +1
Posts: 180
Joined: 21 Aug 2012, 20:44
Detinator Steam: Da
CS Status: Funny
Detinator server CS: Da
SteamID: Privat
Has thanked: 4 times
Been thanked: 52 times
Contact:

30 Nov 2013, 12:51

Plugin este scriptat foarte urat ,nu recomand sa-l folosesti.
Acolo unde ai eroarea in plus iti trebuie verificarea

Code: Select all

if ( !is_user_connected ( iVictim ) || !is_user_connected ( iAttacker ) ) 
Incearca asa , am verificat doar line 1692.

Momentan,activitate mai slaba.
.


*[Anti Auto-Connect] [Config exec Connect IP Checker] [60%] [Public]
*[SISA Zombie + CSO Shop] [79%] [Contracost]

*[Plugin Snow] [100%] [La cerere - Privat]

* Screen#1 / Screen#2 / Screen#3
Acest plugin este facut la cerere si nu o sa fie public !
O sa fie public doar daca il face public Askhanar.



CaPy.lNt
Membru, skill +1
Membru, skill +1
Posts: 146
Joined: 23 Mar 2013, 21:11
Detinator Steam: Nu
CS Status: studiez
Detinator server CS: DR.ECILA.RO
Reputatie: Restrictie PM
Has thanked: 34 times
Been thanked: 13 times
Contact:

30 Nov 2013, 14:16

Modificami si mie direct in plugin te rog..ca nu prea gasesc linia :|
Image

Image
User avatar
DaNNe.
Fost moderator
Fost moderator
Posts: 2808
Joined: 08 Nov 2013, 20:43
Detinator Steam: Da
CS Status: Activitate scăzută
SteamID: /id/FurienMaster
Reputatie: Nick anterior: DnD. Gold, Emrys
0.5/3
Fost moderator ajutator
Fost Membru Club eXtreamCS (doua luni)
Has thanked: 230 times
Been thanked: 128 times
Contact:

30 Nov 2013, 16:38

CaPy.lNt wrote:Modificami si mie direct in plugin te rog..ca nu prea gasesc linia :|
Nu sti sa cauti o linie?
In amxx-studio, la inceputul fiecarui rand ai un numar. Acel numar reprezinta linia.
Contact: Activitate scazuta.
CaPy.lNt
Membru, skill +1
Membru, skill +1
Posts: 146
Joined: 23 Mar 2013, 21:11
Detinator Steam: Nu
CS Status: studiez
Detinator server CS: DR.ECILA.RO
Reputatie: Restrictie PM
Has thanked: 34 times
Been thanked: 13 times
Contact:

30 Nov 2013, 17:31

Code: Select all

if ( HaveBarlog [ iAttacker ] && get_user_weapon ( iAttacker ) == CSW_XM1014 && is_valid_player( iAttacker) ) {
Asta e linia 1692 , e total diferit de ce mi-a dat ExoTiQ ..nu inteleg ce trebuie sa fac
Face-ti-mi si mie va rog..sunt planta la scripting:))
Image

Image
User avatar
CaPy @ Ecila
Membru, skill +1
Membru, skill +1
Posts: 144
Joined: 30 Nov 2013, 22:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: Dr&Furien.Ecila
Has thanked: 38 times
Been thanked: 9 times
Contact:

01 Dec 2013, 18:04

Chiar nu stie nimeni..?
Connect Furien.Scorpionii.Ro

Image
User avatar
FaTzZu
Fost moderator
Fost moderator
Posts: 1206
Joined: 22 Dec 2012, 18:37
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 114 times
Been thanked: 168 times
Contact:

01 Dec 2013, 18:07

| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <ColorChat>
#include <engine>
#include <xs>

#define PLUGIN "Furien Weapons Menu"
#define VERSION "1.0"
#define AUTHOR "Tr3fla & Edit By Blue" // si-a bagat si hades nasul pe aici

#define ADMIN_FLAG ADMIN_KICK
#define VIP_FLAG ADMIN_LEVEL_H

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

native set_user_credits ( id, credits );
native get_user_credits ( id );

const m_flNextSecondaryAttack =	47
/* AK47 Golden pentru VIP */
new const vGoldenAk[ 64 ] = "models/fw/v_goldenak.mdl"
new const pGoldenAk[ 64 ] = "models/fw/p_goldenak.mdl"

/* M4A1 Golden pentru VIP */
new const vGoldenM4[ 64 ] = "models/fw/v_goldenm4.mdl"
new const pGoldenM4[ 64 ] = "models/fw/p_goldenm4.mdl"

/* Deagle Golden pentru VIP */
new const vGDeagle[ 64 ] = "models/fw/v_gdeagle.mdl"
new const pGDeagle[ 64 ] = "models/fw/p_deagle.mdl"

new const vFatal [ 64 ] = "models/fw/v_fatal.mdl";
new const pFatal [ 64 ] = "models/fw/p_fatal.mdl";

new const vBarlog [ 64 ] = "models/fw/v_barlog.mdl";
new const pBarlog [ 64 ] = "models/fw/p_barlog.mdl";

//new m_spriteTexture

new bool: ArmaPrimita[ 33 ]
new bool: AreGoldenAK[ 33 ]
new bool: AreGoldenM4[ 33 ]
new bool: AreGDeagle[ 33 ]
new bool: HaveFatal [ 33 ];
new bool: HaveBarlog [ 33 ];

new normalTrace[33], lastTrace[33], cvEnabled, weapon2, dummy;

#define ENG_NULLENT		-1
#define EV_INT_WEAPONKEY	EV_INT_impulse
#define watergun_WEAPONKEY 893
#define MAX_PLAYERS  			  32
#define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)

#define TASK_FBURN				100
#define ID_FBURN					( taskid - TASK_FBURN )

#define MAX_CLIENTS				32

new bool:g_fRoundEnd

#define FIRE_DURATION		6
#define FIRE_DAMAGE		25

const USE_STOPPED = 0
const OFFSET_ACTIVE_ITEM = 373
const OFFSET_WEAPONOWNER = 41
const OFFSET_LINUX = 5
const OFFSET_LINUX_WEAPONS = 4

#define WEAP_LINUX_XTRA_OFF		4
#define m_fKnown					44
#define m_flNextPrimaryAttack 		46
#define m_iClip					51
#define PLAYER_LINUX_XTRA_OFF	5
#define m_flNextAttack				83

#define watergun_RELOAD_TIME 	3.5
#define watergun_RELOAD		1
#define watergun_DRAW		2
#define watergun_SHOOT1		3
#define watergun_SHOOT2		4

new g_flameSpr
new g_smokeSpr

new g_burning_duration[ MAX_CLIENTS + 1 ]

#define write_coord_f(%1)	engfunc(EngFunc_WriteCoord,%1)

new const Fire_Sounds[][] = { "weapons/waterp.wav" }

new watergun_V_MODEL[64] = "models/fw/v_waterg.mdl"
new watergun_P_MODEL[64] = "models/fw/p_waterg.mdl"
new watergun_W_MODEL[64] = "models/fw/w_waterg.mdl"

//new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 }

new cvar_dmg_watergun, cvar_recoil_watergun, cvar_clip_watergun, cvar_spd_watergun, cvar_watergun_ammo
new g_MaxPlayers, g_orig_event_watergun, g_IsInPrimaryAttack
new Float:cl_pushangle[MAX_PLAYERS + 1][3], m_iBlood[2]
new g_has_watergun[33], g_clip_ammo[33], g_watergun_TmpClip[33], oldweap[33]
new watergun_sprite

const PRIMARY_WEAPONS_BIT_SUM = 
(1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<
CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
			"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
			"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
			"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
			"weapon_ak47", "weapon_knife", "weapon_p90" }

			
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))

#define FIRERATE 0.2
#define HITSD 0.7
#define RELOADSPEED 5.0
#define DAMAGE 250.0
#define DAMAGE_MULTI 3.0

#define CSW_WPN CSW_FAMAS
new const weapon[] = "weapon_famas"

new const spr_beam[] = "sprites/plasma/plasma_beam.spr"
new const spr_exp[] = "sprites/plasma/plasma_exp.spr"
new const spr_blood[] = "sprites/blood.spr"
new const snd_fire[][] = { "zombie_plague/plasma/plasma_fire.wav" }
new const snd_reload[][] = { "zombie_plague/plasma/plasma_reload.wav" }
new const snd_hit[][] = { "zombie_plague/plasma/plasma_hit.wav" }

new bool:g_HasRifle[33]
new g_iCurWpn[33], Float:g_flLastFireTime[33]
new g_sprBeam, g_sprExp, g_sprBlood, g_msgDamage, g_msgScreenFade, g_msgScreenShake

const m_pPlayer = 		41
const m_fInReload =		54
const m_pActiveItem = 		373
const m_flTimeWeaponIdle = 	48

const UNIT_SECOND =		(1<<12)
const WPN_MAXCLIP =		25
const ANIM_FIRE = 		5
const ANIM_DRAW = 		10
const ANIM_RELOAD =		9
const EV_INT_WEAPONKEY = 	EV_INT_impulse
const WPNKEY = 			2816

public plugin_init( ) {
	register_plugin( PLUGIN, VERSION, AUTHOR )
	
	register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" )
	//register_event("CurWeapon", "GoldenEffect", "be", "1=1", "3>0" )
	
	
	cvEnabled = register_cvar("fwm_enabled","1");
	register_event("ResetHUD","event_resethud","b");		//
	register_clcmd("fullupdate","cmd_fullupdate");
	
	register_forward(FM_TraceLine,"fw_traceline");
	register_forward(FM_PlayerPostThink,"fw_playerpostthink");	//
	
	RegisterHam( Ham_Spawn, "player", "fwPlayerSpawn", true )
	RegisterHam ( Ham_TakeDamage, "player", "Player_TakeDamage" );
	RegisterHam( Ham_TakeDamage, "player", "fwTakeDamage" )
	
	register_clcmd( "say /weapons", "ClcmdWeaponsMenus" )
	register_event ( "CurWeapon", "CurrWeapon2", "be", "1=1" );
	
	register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
	register_event("CurWeapon","CurrentWeapon","be","1=1")
	RegisterHam(Ham_Item_AddToPlayer, "weapon_mp5navy", "fw_watergun_AddToPlayer")
	RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1)
	RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1)
	for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
	if (WEAPONENTNAMES[0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES, "fw_Item_Deploy_Post", 1)
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "fw_watergun_PrimaryAttack")
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "fw_watergun_PrimaryAttack_Post", 1)
	RegisterHam(Ham_Item_PostFrame, "weapon_mp5navy", "watergun_ItemPostFrame")
	RegisterHam(Ham_Weapon_Reload, "weapon_mp5navy", "watergun_Reload")
	RegisterHam(Ham_Weapon_Reload, "weapon_mp5navy", "watergun_Reload_Post", 1)
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
	RegisterHam( Ham_Spawn, "player", "PlayerSpawn_Post", 1 );
	register_forward(FM_SetModel, "fw_SetModel")
	register_event( "DeathMsg", "EV_DeathMsg", "a" );
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post_fw", 1)
	register_forward(FM_PlaybackEvent, "fwPlaybackEvent")
	
	//RegisterHam(Ham_TraceAttack, "worldspawn", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_breakable", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_wall", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_door", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_door_rotating", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_plat", "fw_TraceAttack", 1)
	//RegisterHam(Ham_TraceAttack, "func_rotating", "fw_TraceAttack", 1)

	cvar_dmg_watergun = register_cvar("zp_watergun_dmg", "0.86")
	cvar_recoil_watergun = register_cvar("zp_watergun_recoil", "1.01")
	cvar_clip_watergun = register_cvar("zp_watergun_clip", "40")
	cvar_spd_watergun = register_cvar("zp_watergun_spd", "1.02")
	cvar_watergun_ammo = register_cvar("zp_watergun_ammo", "200")
	
	
	g_MaxPlayers = get_maxplayers()
	
	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0");
	register_event("CurWeapon", "event_CurWeapon", "b", "1=1")	

	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	RegisterHam(Ham_Item_Deploy, weapon, "fw_Deploy_Post", 1)
	RegisterHam(Ham_Item_AddToPlayer, weapon, "fw_AddToPlayer")
	RegisterHam(Ham_Weapon_Reload, weapon, "fw_Reload_Post", 1)
	RegisterHam(Ham_Item_PostFrame, weapon, "fw_PostFrame")
	
	g_msgDamage = get_user_msgid("Damage")
	g_msgScreenFade = get_user_msgid("ScreenFade")
	g_msgScreenShake = get_user_msgid("ScreenShake")
	
}

public plugin_precache( ) {
	precache_model( vGoldenAk )
	precache_model( pGoldenAk )
	precache_model( vGoldenM4 )
	precache_model( pGoldenM4 )
	precache_model( vGDeagle )
	precache_model( pGDeagle )
	
	precache_model ( vBarlog );
	precache_model ( pBarlog );
	
	precache_model ( vFatal );
	precache_model ( pFatal );
	
	//m_spriteTexture = precache_model( "sprites/dot.spr" )
	
	precache_model(watergun_V_MODEL)
	precache_model(watergun_P_MODEL)
	precache_model(watergun_W_MODEL)
	for(new i = 0; i < sizeof Fire_Sounds; i++)
	precache_sound(Fire_Sounds)	
	m_iBlood[0] = precache_model("sprites/blood.spr")
	m_iBlood[1] = precache_model("sprites/bloodspray.spr")
	watergun_sprite = precache_model("sprites/watergun.spr")

	g_flameSpr = precache_model( "sprites/flame.spr" );
	g_smokeSpr = precache_model( "sprites/black_smoke3.spr" );

	register_forward(FM_PrecacheEvent, "fwPrecacheEvent_Post", 1)
	
	precache_model("models/fw/plasma/v_plasma.mdl")
	precache_model("models/fw/plasma/p_plasma.mdl")

	g_sprBlood = precache_model(spr_blood)
	g_sprBeam = precache_model(spr_beam)
	g_sprExp = precache_model(spr_exp)
	
	static i
	for(i = 0; i < sizeof snd_fire; i++)
		precache_sound(snd_fire)
	for(i = 0; i < sizeof snd_hit; i++)
		precache_sound(snd_hit)
	for(i = 0; i < sizeof snd_reload; i++)
		precache_sound(snd_reload)	
		
}

public fwPlayerSpawn( id ) {
	AreGoldenAK[ id ] = false
	AreGoldenM4[ id ] = false
	AreGDeagle[ id ] = false
	ArmaPrimita[ id ] = false
	HaveFatal [ id ] = false;
	HaveBarlog [ id ] = false;
	
	if( is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_CT ) {
		strip_user_weapons( id )
		PopUpWeaponsMenu( id )
		give_item( id, "weapon_knife" )
		give_item( id, "weapon_usp" )
		cs_set_user_bpammo( id, CSW_USP, 100 )
	}
	else if( is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_T ) {
		strip_user_weapons( id ) 
		give_item( id, "weapon_knife" )
		give_item( id, "weapon_hegrenade" )
		give_item( id, "weapon_flashbang" )
		give_item( id, "weapon_smokegrenade" )
		cs_set_user_bpammo( id, CSW_FLASHBANG, 2 )
	}
}

public PopUpWeaponsMenu( id ) {
	new FurienWeaponsMenu = menu_create( "\yAnti-Furien\r Weapons", "FurienWeaponsHandler" )
	
	menu_additem( FurienWeaponsMenu, "Arme\y Hunter", "1", 0 )
	menu_additem( FurienWeaponsMenu, "Arme\r V.I.P", "2", 0 )
	
	// aici si-a bagat hades ownage nasul
	
	menu_additem ( FurienWeaponsMenu, "\wCiuruitoare \r[Special] \y[25 CREDITE]", "3", 0 );
	menu_additem ( FurienWeaponsMenu, "\wArma Fatala \r[Special] \y[80 CREDITE]", "4", 0 );
	menu_additem ( FurienWeaponsMenu, "\wDragon \r[Special] \y[45 CREDITE]", "5", 0 );
	
	menu_setprop( FurienWeaponsMenu, MPROP_EXIT, MEXIT_ALL )
	menu_display( id, FurienWeaponsMenu, 0 )
}

public FurienWeaponsHandler( id, FurienWeaponsMenu, item ) {
	
	if ( get_user_team ( id ) != 2 ) return 1;
	
	if( item == MENU_EXIT ) {
		menu_destroy( FurienWeaponsMenu )
		return PLUGIN_HANDLED
	}
	
	switch( item ) {
		case 0 : {
			ArmeNormale( id ) 
		}
		case 1 : {
			if( get_user_flags( id ) & VIP_FLAG ) {
				ArmeVIP( id ) 
			}
			else {
				ColorChat( id, GREEN, "^4[Furien Weapons]^1 Aceste arme sunt rezervate numai pentru^3 V.I.P^1." )
				PopUpWeaponsMenu( id )
			}

		}
		
		case 2:
		{
			
			new iCredits = get_user_credits(id) - 25;
			if( iCredits < 0 )
			{
				ColorChat ( id, GREEN, "^4[Furien Weapons]^1 Nu ai destule credite, credite necesare:^3 25^1." );
				return 1;
			}
			else
			{
				set_user_credits ( id, iCredits );
				ArmaPrimita[ id ] = true;
				HaveFatal [ id ] = true;
				give_item ( id, "weapon_m249" );
				cs_set_user_bpammo ( id, CSW_M249, 300 );
				CurrWeapon2 ( id );
			}
			
			
			return 1;
		}
		
		case 3:
		{
			
			
			
			new iCredits = get_user_credits(id) - 80;
			if( iCredits < 0 )
			{
				ColorChat ( id, GREEN, "^4[Furien Weapons]^1 Nu ai destule credite, credite necesare:^3 80^1." );
				return 1;
			}
			else
			{
				set_user_credits ( id, iCredits );
				ArmaPrimita[ id ] = true;
				give_laser ( id );
			}
			
			return 1;
		}
		
		case 4:
		{
			new iCredits = get_user_credits(id) - 45;
			if( iCredits < 0 )
			{
				ColorChat ( id, GREEN, "^4[Furien Weapons]^1 Nu ai destule credite, credite necesare:^3 45^1." );
				return 1;
			}
			else
			{
				set_user_credits ( id, iCredits );
				ArmaPrimita[ id ] = true;
				HaveBarlog [ id ] = true;
				give_item ( id, "weapon_xm1014" );
				cs_set_user_bpammo ( id, CSW_XM1014, 200 );
				CurrWeapon2 ( id );
			}
			
			return 1;
		}
	}
	return PLUGIN_HANDLED
}
public ArmeNormale( id ) {
	
	new MeniuArmeNormale = menu_create( "\wMeniu are pentru\r Playeri", "ArmeNormaleHandler" )
	
	menu_additem( MeniuArmeNormale, "\r AK47", "1", 0 )
	menu_additem( MeniuArmeNormale, "M4A1", "2", 0 )
	menu_additem( MeniuArmeNormale, "Mp5 Navy", "3", 0 )
	menu_additem( MeniuArmeNormale, "XM1014", "4", 0 )
	menu_additem( MeniuArmeNormale, "\r M3", "5", 0 )
	menu_additem( MeniuArmeNormale, "\r GALIL", "6", 0 )
	menu_additem( MeniuArmeNormale, "\r P\y90", "7", 0 )
	
	
	menu_setprop( MeniuArmeNormale, MPROP_EXIT, MEXIT_ALL )
	menu_display( id, MeniuArmeNormale, 0 )
}

public ArmeNormaleHandler( id, MeniuArmeNormale, item ) {
	if( !is_user_alive( id ) ) {
		ColorChat( id, GREEN, "^4[Furien Weapons]^1 Nu iti poti alege arma atunci cand esti mort!" )
		return PLUGIN_HANDLED
	}
	
	if ( get_user_team ( id ) != 2 ) return 1;
	
	if( item == MENU_EXIT ) {
		menu_destroy( MeniuArmeNormale )
		return PLUGIN_HANDLED 
	}
	
	switch( item ) {
		case 0 : {
			give_item( id, "weapon_ak47" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_AK47, 200 )
			ArmaPrimita[ id ] = true
		}
		case 1 : {
			give_item( id, "weapon_m4a1" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M4A1, 200 )
			ArmaPrimita[ id ] = true
		}
		case 2 : {
			give_item( id, "weapon_mp5navy" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_MP5NAVY, 200 )
			ArmaPrimita[ id ] = true
		}
		case 3 : {
			give_item( id, "weapon_xm1014" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_XM1014, 200 )
			ArmaPrimita[ id ] = true
		}
		
		case 4 : {
			give_item( id, "weapon_m3" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M3, 30 )
			ArmaPrimita[ id ] = true
		}
		
		case 5 : {
			give_item( id, "weapon_galil" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_GALIL, 200 )
			ArmaPrimita[ id ] = true
		}
		case 6 : {
			give_item( id, "weapon_p90" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_P90, 200 )
			ArmaPrimita[ id ] = true
		}
		
		
	}
	menu_destroy( MeniuArmeNormale )
	return PLUGIN_HANDLED
}

public ArmeVIP( id ) {
	new MeniuArmeVIP = menu_create( "\yArme \r*\w V\r.\wI\r.\wP\r *", "ArmeVIPHandler" )
	
	menu_additem( MeniuArmeVIP, "Golden AK47\r  (\y2x DMG\r)", "1", 0 )
	menu_additem( MeniuArmeVIP, "Golden M4A1\r (\y2x DMG\r)", "2", 0 )					
	menu_additem( MeniuArmeVIP, "Golden DEAGLE\r   (\y2x DMG\r)", "3", 0 )			
	menu_additem( MeniuArmeVIP, "Ciuruitoarea\r   (\y100 GL\r)", "4", 0 )
	
	menu_setprop( MeniuArmeVIP, MPROP_EXIT, MEXIT_ALL )
	menu_display( id, MeniuArmeVIP, 0 )
}

public ArmeVIPHandler( id, MeniuArmeVIP, item ) {
	if( !is_user_alive( id ) ) {
		ColorChat( id, GREEN, "^4[Furien Weapons]^1 Nu iti poti alege arma atunci cand esti mort!" )
		return PLUGIN_HANDLED
	}
	
	if ( get_user_team ( id ) != 2 ) return 1;
	
	if( item == MENU_EXIT ) {
		menu_destroy( MeniuArmeVIP )
		return PLUGIN_HANDLED
	}
	
	switch( item ) {
		case 0 : {
			give_item( id, "weapon_ak47" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_AK47, 250 )
			set_pev( id, pev_viewmodel2, vGoldenAk )
			set_pev( id, pev_weaponmodel2, pGoldenAk )
			ArmaPrimita[ id ] = true
			AreGoldenAK[ id ] = true
		}
		case 1 : {
			give_item( id, "weapon_m4a1" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M4A1, 250 )
			set_pev( id, pev_viewmodel2, vGoldenM4 )
			set_pev( id, pev_weaponmodel2, pGoldenM4 )
			ArmaPrimita[ id ] = true
			AreGoldenM4[ id ] = true
		}
		case 2 : {
			give_item( id, "weapon_deagle" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_DEAGLE, 250 )
			set_pev( id, pev_viewmodel2, vGDeagle )
			set_pev( id, pev_weaponmodel2, pGDeagle )
			ArmaPrimita[ id ] = true
			AreGDeagle[ id ] = true
		}
		case 3 : {
			give_item( id, "weapon_m249" )
			give_item( id, "weapon_smokegrenade" )
			cs_set_user_bpammo( id, CSW_M249, 200 )
			ArmaPrimita[ id ] = true
		}
	}
	menu_destroy( MeniuArmeVIP )
	return PLUGIN_HANDLED
}

public ClcmdWeaponsMenus( id ) {
	if( !is_user_alive( id ) ) {
		ColorChat( id,GREEN, "^4[Furien Weapons]^1 Nu poti sa-ti alegeti arma atunci cand esti mort!" )
		return 
	}
	
	if( ArmaPrimita[ id ] ) {
		ColorChat( id, GREEN,"^4[Furien Weapons]^1 Ti-ai ales deja arma in aceasta runda!" )
		return 
	}
	
	if( cs_get_user_team( id ) == CS_TEAM_CT ) {
		PopUpWeaponsMenu( id )
	}
}

public Event_CurWeapon( id ) {
	new Arma = read_data( 2 )
	
	if( Arma == CSW_AK47 && AreGoldenAK[ id ] ) {
		set_pev( id, pev_viewmodel2, vGoldenAk )
		set_pev( id, pev_weaponmodel2, pGoldenAk )
	}
	
	if( Arma == CSW_M4A1 && AreGoldenM4[ id ] ) {
		set_pev( id, pev_viewmodel2, vGoldenM4 )
		set_pev( id, pev_weaponmodel2, pGoldenM4 )
	}
	
	if( Arma == CSW_DEAGLE && AreGDeagle[ id ] ) {
		set_pev( id, pev_viewmodel2, vGDeagle )
		set_pev( id, pev_weaponmodel2, pGDeagle )
	}
	
	

}

public CurrWeapon2 ( id ) {
	
	if ( get_user_weapon ( id ) == CSW_M249 && HaveFatal [ id ] ) {
		
		set_pev ( id, pev_viewmodel2, vFatal );
		set_pev ( id, pev_weaponmodel2, pFatal );
		
	}
	
	if ( get_user_weapon ( id ) == CSW_XM1014 && HaveBarlog [ id ] ) {
		
		set_pev ( id, pev_viewmodel2, vBarlog );
		set_pev ( id, pev_weaponmodel2, pBarlog );
		
	}
	
}

public fwTakeDamage( Victim, Inflictor, Attacker, Float:Damage ) {
	if( is_valid_player( Attacker ) && get_user_weapon( Attacker ) == CSW_AK47 && AreGoldenAK[ Attacker ] ) {
		SetHamParamFloat( 4, Damage * 2 )
	}
	
	if( is_valid_player( Attacker) && get_user_weapon( Attacker ) == CSW_M4A1 && AreGoldenM4[ Attacker ] ) {
		SetHamParamFloat( 4, Damage * 2 )
	}
	
	if( is_valid_player( Attacker ) && get_user_weapon( Attacker ) == CSW_DEAGLE && AreGDeagle[ Attacker ] ) {
		SetHamParamFloat( 4, Damage * 2 )
	}
	

}

//public GoldenEffect( id ) {
//	new clip,ammo
//	new Arma = get_user_weapon(id,clip,ammo)

//	if (Arma == CSW_AK47 && AreGoldenAK[ id ] || Arma == CSW_M4A1 && AreGoldenM4[ id ] || Arma == CSW_MP5NAVY && AreGoldenMP5[ id ]  ) {
//		new vec1[ 3 ], vec2[ 3 ]
//		get_user_origin( id, vec1, 1 ) 
//		get_user_origin( id, vec2, 4 ) 
//
//		message_begin( MSG_BROADCAST,SVC_TEMPENTITY )
//		write_byte ( 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 )  
//		write_byte( 5 ) 
//		write_byte( 2 ) 
//		write_byte( 10 ) 
//		write_byte( 0  ) 
//		write_byte( 255  )     
//		write_byte( 215  )       
//		write_byte(  0 )       
//		write_byte( 200 ) 
//		write_byte( 150 ) 
//		message_end( )
//	}
//}

/* Edit lucylucy */


// reset normal trace id on join or leave
public client_connect(id)
{
	normalTrace[id] = 0;
	g_has_watergun[id] = false

	g_HasRifle[id] = false
}

public client_disconnect(id)
{
	normalTrace[id] = 0;
	g_has_watergun[id] = false
	g_HasRifle[id] = false
	remove_task(id + TASK_FBURN )
}

// player spawns, and some other such things
public event_resethud(id)
{
	lastTrace[id] = 0;
}

// block forced resethud call
public cmd_fullupdate(id)
{
	return PLUGIN_HANDLED;
}

// traceline hook, meat and bones of the entire plugin
public fw_traceline(Float:vecStart[3],Float:vecEnd[3],ignoreM,id,pentru) // pentToSkip == id, for clarity
{
	if(!is_user_connected(id))
		return FMRES_IGNORED;
	
	// grab normal trace
	if(!normalTrace[id])
	{
		normalTrace[id] = pentru;
		return FMRES_IGNORED;
	}
	
	// ignore normal trace
	else if(pentru == normalTrace[id])
		return FMRES_IGNORED;
	
	// no functionality
	if(!get_pcvar_num(cvEnabled))
		return FMRES_IGNORED;
	
	// not a player entity, or player is dead
	if(!is_user_alive(id))
		return FMRES_IGNORED;
	
	// not shooting anything
	if(!(pev(id,pev_button) & IN_ATTACK))
		return FMRES_IGNORED;
	
	weapon2 = get_user_weapon(id,dummy,dummy);
	
	// using a shotgun, expect multiple tracelines
	if(weapon2 == CSW_M3 || weapon2 == CSW_XM1014)
		return FMRES_IGNORED;
	
	// this is a second traceline, for shooting through walls
	if(pentru == lastTrace[id])
	{
		// values sure to throw off any traceline
		set_tr(TR_vecEndPos,Float:{4096.0,4096.0,4096.0});
		set_tr(TR_AllSolid,1);
		set_tr(TR_pHit,0);
		set_tr(TR_iHitgroup,0);
		set_tr(TR_flFraction,1.0);
		
		return FMRES_SUPERCEDE;
	}
	
	// remeber traceline index for next time
	lastTrace[id] = pentru;
	
	return FMRES_IGNORED;
}

// finished client calculations, reset our traceline index
public fw_playerpostthink(id)
{
	lastTrace[id] = 0;
}




public plugin_natives ()
{
	register_native("give_weapon_watergun", "native_give_weapon_add", 1)
}
public native_give_weapon_add(id)
{
	give_watergun(id)
}

public fwPrecacheEvent_Post(type, const name[])
{
	if (equal("events/mp5n.sc", name))
	{
		g_orig_event_watergun = get_orig_retval()
		return FMRES_HANDLED
	}
	return FMRES_IGNORED
}

public fw_SetModel(entity, model[])
{
	if(!is_valid_ent(entity))
		return FMRES_IGNORED
	
	static szClassName[33]
	entity_get_string(entity, EV_SZ_classname, szClassName, charsmax(szClassName))
		
	if(!equal(szClassName, "weaponbox"))
		return FMRES_IGNORED
	
	static iOwner
	
	iOwner = entity_get_edict(entity, EV_ENT_owner)
	
	if(equal(model, "models/w_mp5.mdl"))
	{
		static iStoredAugID
		
		iStoredAugID = find_ent_by_owner(ENG_NULLENT, "weapon_mp5navy", entity)
	
		if(!is_valid_ent(iStoredAugID))
			return FMRES_IGNORED
	
		if(g_has_watergun[iOwner])
		{
			entity_set_int(iStoredAugID, EV_INT_WEAPONKEY, watergun_WEAPONKEY)
			
			g_has_watergun[iOwner] = false
			
			entity_set_model(entity, watergun_W_MODEL)
			
			return FMRES_SUPERCEDE
		}
	}
	return FMRES_IGNORED
}

public EV_DeathMsg( )
{
	static pevVictim;
	pevVictim = read_data( 2 )
	
	if( !is_user_connected( pevVictim ) )
		return
		
	remove_task( pevVictim + TASK_FBURN )
}

public PlayerSpawn_Post( Player )
{
	if( !is_user_alive( Player ) )
		return;
		
	g_burning_duration[ Player ] = 0
}

public give_watergun(id)
{
	drop_weapons(id, 1)
	new iWep2 = give_item(id,"weapon_mp5navy")
	if( iWep2 > 0 )
	{
		cs_set_weapon_ammo(iWep2, get_pcvar_num(cvar_clip_watergun))
		cs_set_user_bpammo (id, CSW_MP5NAVY, get_pcvar_num(cvar_watergun_ammo))	
		UTIL_PlayWeaponAnimation(id, watergun_DRAW)
		set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
	}
	g_has_watergun[id] = true
}

public fw_watergun_AddToPlayer(watergun, id)
{
	if(!is_valid_ent(watergun) || !is_user_connected(id))
		return HAM_IGNORED
	
	if(entity_get_int(watergun, EV_INT_WEAPONKEY) == watergun_WEAPONKEY)
	{
		g_has_watergun[id] = true
		
		entity_set_int(watergun, EV_INT_WEAPONKEY, 0)
		
		return HAM_HANDLED
	}
	return HAM_IGNORED
}

public fw_UseStationary_Post(entity, caller, activator, use_type)
{
	if (use_type == USE_STOPPED && is_user_connected(caller))
		replace_weapon_models(caller, get_user_weapon(caller))
}

public fw_Item_Deploy_Post(weapon_ent)
{
	static owner
	owner = fm_cs_get_weapon_ent_owner(weapon_ent)
	
	static weaponid
	weaponid = cs_get_weapon_id(weapon_ent)
	
	replace_weapon_models(owner, weaponid)
}

public CurrentWeapon(id)
{
	
     replace_weapon_models(id, read_data(2))

     if(read_data(2) != CSW_MP5NAVY || !g_has_watergun[id])
          return
     
     static Float:iSpeed
     if(g_has_watergun[id])
          iSpeed = get_pcvar_float(cvar_spd_watergun)
     
     static weapon[32],Ent
     get_weaponname(read_data(2),weapon,31)
     Ent = find_ent_by_owner(-1,weapon,id)
     if(Ent)
     {
          static Float:Delay
          Delay = get_pdata_float( Ent, 46, 4) * iSpeed
          if (Delay > 0.0)
          {
               set_pdata_float(Ent, 46, Delay, 4)
          }
     }
}

replace_weapon_models(id, weaponid)
{
	
	
	
	switch (weaponid)
	{
		case CSW_MP5NAVY:
		{
			
			if(g_has_watergun[id])
			{
				set_pev(id, pev_viewmodel2, watergun_V_MODEL)
				set_pev(id, pev_weaponmodel2, watergun_P_MODEL)
				if(oldweap[id] != CSW_MP5NAVY) 
				{
					UTIL_PlayWeaponAnimation(id, watergun_DRAW)
					set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
				}
			}
		}
	}
	oldweap[id] = weaponid
}

public fw_UpdateClientData_Post_fw(Player, SendWeapons, CD_Handle)
{
	if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_MP5NAVY || !g_has_watergun[Player]))
		return FMRES_IGNORED
	
	set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.001)
	return FMRES_HANDLED
}

public fw_watergun_PrimaryAttack(Weapon)
{
	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	if (!g_has_watergun[Player])
		return
	
	g_IsInPrimaryAttack = 1
	pev(Player,pev_punchangle,cl_pushangle[Player])
	
	g_clip_ammo[Player] = cs_get_weapon_ammo(Weapon)
}

public fwPlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
	if ((eventid != g_orig_event_watergun) || !g_IsInPrimaryAttack)
		return FMRES_IGNORED
	if (!(1 <= invoker <= g_MaxPlayers))
    return FMRES_IGNORED

	playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
	return FMRES_SUPERCEDE
}

public fw_watergun_PrimaryAttack_Post(Weapon)
{
	g_IsInPrimaryAttack = 0
	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	new szClip, szAmmo
	get_user_weapon(Player, szClip, szAmmo)
	
	if(!is_user_alive(Player))
		return

	if(g_has_watergun[Player])
	{
		if (!g_clip_ammo[Player])
			return

		new Float:push[3]
		pev(Player,pev_punchangle,push)
		xs_vec_sub(push,cl_pushangle[Player],push)
		
		xs_vec_mul_scalar(push,get_pcvar_float(cvar_recoil_watergun),push)
		xs_vec_add(push,cl_pushangle[Player],push)
		set_pev(Player,pev_punchangle,push)
		
		emit_sound(Player, CHAN_WEAPON, Fire_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
		UTIL_PlayWeaponAnimation(Player, random_num(watergun_SHOOT1, watergun_SHOOT2))

		static Float:plrViewAngles[3], Float:VecEnd[3], Float:VecDir[3], Float:PlrOrigin[3]
		pev(Player, pev_v_angle, plrViewAngles)

		static Float:VecSrc[3], Float:VecDst[3]
	
		//VecSrc = pev->origin + pev->view_ofs
		pev(Player, pev_origin, PlrOrigin)
		pev(Player, pev_view_ofs, VecSrc)
		xs_vec_add(VecSrc, PlrOrigin, VecSrc)

		//VecDst = VecDir * 8192.0
		angle_vector(plrViewAngles, ANGLEVECTOR_FORWARD, VecDir);
		xs_vec_mul_scalar(VecDir, 8192.0, VecDst);
		xs_vec_add(VecDst, VecSrc, VecDst);
	
		new hTrace = create_tr2()
		engfunc(EngFunc_TraceLine, VecSrc, VecDst, 0, Player, hTrace)
		get_tr2(hTrace, TR_vecEndPos, VecEnd);

		create_tracer_water(Player, VecSrc, VecEnd)	
	}
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
	if(!is_user_alive(attacker))
		return;

	if (victim != attacker && is_user_connected(attacker))
	{
		if(get_user_weapon(attacker) == CSW_MP5NAVY)
		{
			if(g_has_watergun[attacker])
			{
				SetHamParamFloat(4, damage * get_pcvar_float(cvar_dmg_watergun))

				if( !task_exists( victim + TASK_FBURN ) )
				{
					g_burning_duration[ victim ] += FIRE_DURATION * 5
				
					set_task( 0.2, "CTask__BurningFlame", victim + TASK_FBURN, _, _, "b" )
				}
			}
		}
	}
}

public message_DeathMsg(msg_id, msg_dest, id)
{
	static szTruncatedWeapon[33], iAttacker, iVictim
	
	get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
	
	iAttacker = get_msg_arg_int(1)
	iVictim = get_msg_arg_int(2)
	
	if(!is_user_connected(iAttacker) || iAttacker == iVictim)
		return PLUGIN_CONTINUE
	
	if(equal(szTruncatedWeapon, "mp5navy") && get_user_weapon(iAttacker) == CSW_MP5NAVY)
	{
		if(g_has_watergun[iAttacker])
			set_msg_arg_string(4, "mp5navy")
	}
	return PLUGIN_CONTINUE
}

stock fm_cs_get_current_weapon_ent(id)
{
	return get_pdata_cbase(id, OFFSET_ACTIVE_ITEM, OFFSET_LINUX)
}

stock fm_cs_get_weapon_ent_owner(ent)
{
	return get_pdata_cbase(ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS)
}

stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
{
	set_pev(Player, pev_weaponanim, Sequence)
	
	message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
	write_byte(Sequence)
	write_byte(pev(Player, pev_body))
	message_end()
}

public watergun_ItemPostFrame(weapon_entity) 
{
     new id = pev(weapon_entity, pev_owner)
     if (!is_user_connected(id))
          return HAM_IGNORED

     if (!g_has_watergun[id])
          return HAM_IGNORED

     static iClipExtra
     
     iClipExtra = get_pcvar_num(cvar_clip_watergun)
     new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, PLAYER_LINUX_XTRA_OFF)

     new iBpAmmo = cs_get_user_bpammo(id, CSW_MP5NAVY);
     new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)

     new fInReload = get_pdata_int(weapon_entity, m_fInReload, WEAP_LINUX_XTRA_OFF) 

     if( fInReload && flNextAttack <= 0.0 )
     {
	     new j = min(iClipExtra - iClip, iBpAmmo)
	
	     set_pdata_int(weapon_entity, m_iClip, iClip + j, WEAP_LINUX_XTRA_OFF)
	     cs_set_user_bpammo(id, CSW_MP5NAVY, iBpAmmo-j)
		
	     set_pdata_int(weapon_entity, m_fInReload, 0, WEAP_LINUX_XTRA_OFF)
	     fInReload = 0
     }
     return HAM_IGNORED
}

public watergun_Reload(weapon_entity) 
{
     new id = pev(weapon_entity, pev_owner)
     if (!is_user_connected(id))
          return HAM_IGNORED

     if (!g_has_watergun[id])
          return HAM_IGNORED

     static iClipExtra

     if(g_has_watergun[id])
          iClipExtra = get_pcvar_num(cvar_clip_watergun)

     g_watergun_TmpClip[id] = -1

     new iBpAmmo = cs_get_user_bpammo(id, CSW_MP5NAVY)
     new iClip = get_pdata_int(weapon_entity, m_iClip, WEAP_LINUX_XTRA_OFF)

     if (iBpAmmo <= 0)
          return HAM_SUPERCEDE

     if (iClip >= iClipExtra)
          return HAM_SUPERCEDE

     g_watergun_TmpClip[id] = iClip

     return HAM_IGNORED
}

public watergun_Reload_Post(weapon_entity) 
{
	new id = pev(weapon_entity, pev_owner)
	if (!is_user_connected(id))
		return HAM_IGNORED

	if (!g_has_watergun[id])
		return HAM_IGNORED

	if (g_watergun_TmpClip[id] == -1)
		return HAM_IGNORED

	set_pdata_int(weapon_entity, m_iClip, g_watergun_TmpClip[id], WEAP_LINUX_XTRA_OFF)

	set_pdata_float(weapon_entity, m_flTimeWeaponIdle, watergun_RELOAD_TIME, WEAP_LINUX_XTRA_OFF)

	set_pdata_float(id, m_flNextAttack, watergun_RELOAD_TIME, PLAYER_LINUX_XTRA_OFF)

	set_pdata_int(weapon_entity, m_fInReload, 1, WEAP_LINUX_XTRA_OFF)

	UTIL_PlayWeaponAnimation(id, watergun_RELOAD)

	return HAM_IGNORED
}

stock create_tracer_water(id, Float:fVec1[3], Float:fVec2[3])
{
	static iVec1[3]
	FVecIVec(fVec1, iVec1)

	static Float:origin[3], Float:vSrc[3], Float:angles[3], Float:v_forward[3], Float:v_right[3], Float:v_up[3], Float:gun_position[3], Float:player_origin[3], Float:player_view_offset[3]
	pev(id, pev_v_angle, angles)
	engfunc(EngFunc_MakeVectors, angles)
	global_get(glb_v_forward, v_forward)
	global_get(glb_v_right, v_right)
	global_get(glb_v_up, v_up)

	//m_pPlayer->GetGunPosition( ) = pev->origin + pev->view_ofs
	pev(id, pev_origin, player_origin)
	pev(id, pev_view_ofs, player_view_offset)
	xs_vec_add(player_origin, player_view_offset, gun_position)

	xs_vec_mul_scalar(v_forward, 24.0, v_forward)
	xs_vec_mul_scalar(v_right, 3.0, v_right)

	if ((pev(id, pev_flags) & FL_DUCKING) == FL_DUCKING)
		xs_vec_mul_scalar(v_up, 6.0, v_up)
	else
		xs_vec_mul_scalar(v_up, -2.0, v_up)

	xs_vec_add(gun_position, v_forward, origin)
	xs_vec_add(origin, v_right, origin)
	xs_vec_add(origin, v_up, origin)

	vSrc[0] = origin[0]
	vSrc[1] = origin[1]
	vSrc[2] = origin[2]

	new Float:dist = get_distance_f(vSrc, fVec2)
	new CountDrops = floatround(dist / 50.0)
	
	if (CountDrops > 20)
		CountDrops = 20
	
	if (CountDrops < 2)
		CountDrops = 2

	message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1)
	write_byte(TE_SPRITETRAIL)
	engfunc(EngFunc_WriteCoord, vSrc[0])
	engfunc(EngFunc_WriteCoord, vSrc[1])
	engfunc(EngFunc_WriteCoord, vSrc[2])
	engfunc(EngFunc_WriteCoord, fVec2[0])
	engfunc(EngFunc_WriteCoord, fVec2[1])
	engfunc(EngFunc_WriteCoord, fVec2[2])
	write_short(watergun_sprite)
	write_byte(CountDrops)
	write_byte(0)
	write_byte(1)
	write_byte(60)
	write_byte(10)
	message_end()

	message_begin(MSG_PAS, SVC_TEMPENTITY, iVec1)
	write_byte(TE_BEAMPOINTS)
	engfunc(EngFunc_WriteCoord, fVec2[0])
	engfunc(EngFunc_WriteCoord, fVec2[1])
	engfunc(EngFunc_WriteCoord, fVec2[2])
	engfunc(EngFunc_WriteCoord, vSrc[0])
	engfunc(EngFunc_WriteCoord, vSrc[1])
	engfunc(EngFunc_WriteCoord, vSrc[2])
	write_short(watergun_sprite)
	write_byte(6)
	write_byte(200) 
	write_byte(1)
	write_byte(100)
	write_byte(0)
	write_byte(64); write_byte(64); write_byte(192);
	write_byte(192)
	write_byte(250) 
	message_end()
}

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

public CTask__BurningFlame( taskid )
{
	// Get player origin and flags
	static origin[3], flags
	get_user_origin(ID_FBURN, origin)
	flags = pev(ID_FBURN, pev_flags)
	
	// Madness mode - in water - burning stopped
	if ((flags & FL_INWATER) || g_burning_duration[ID_FBURN] < 1 || g_fRoundEnd || !is_user_alive(ID_FBURN))
	{
		// Smoke sprite
		message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
		write_byte(TE_SMOKE) // TE id
		write_coord(origin[0]) // x
		write_coord(origin[1]) // y
		write_coord(origin[2]-50) // z
		write_short(g_smokeSpr) // sprite
		write_byte(random_num(15, 20)) // scale
		write_byte(random_num(10, 20)) // framerate
		message_end()
		
		// Task not needed anymore
		remove_task(taskid)
		return
	}
	
	// Get player's health
	static health
	health = pev(ID_FBURN, pev_health)
	
	// Take damage from the fire
	if (health - FIRE_DAMAGE > 0)
		fm_set_user_health(ID_FBURN, health - FIRE_DAMAGE)
	
	// Flame sprite
	message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
	write_byte(TE_SPRITE) // TE id
	write_coord(origin[0]+random_num(-5, 5)) // x
	write_coord(origin[1]+random_num(-5, 5)) // y
	write_coord(origin[2]+random_num(-10, 10)) // z
	write_short(g_flameSpr) // sprite
	write_byte(random_num(5, 10)) // scale
	write_byte(200) // brightness
	message_end()

	
	g_burning_duration[ID_FBURN]--
}

stock fm_set_user_health( index, health ) 
	health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index);

	
public event_CurWeapon(id)
{
	if(!is_user_alive(id))
	return PLUGIN_CONTINUE
		
	g_iCurWpn[id] = read_data(2)
	
		
	if(!g_HasRifle[id] || g_iCurWpn[id] != CSW_WPN) 
		return PLUGIN_CONTINUE
		
	entity_set_string(id, EV_SZ_viewmodel, "models/fw/plasma/v_plasma.mdl")
	entity_set_string(id, EV_SZ_weaponmodel, "models/fw/plasma/p_plasma.mdl")
	return PLUGIN_CONTINUE
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
	if(is_user_alive(victim))
	{
		g_HasRifle[victim] = false
		return HAM_HANDLED
	}
	return HAM_IGNORED
}

public Event_NewRound()
{
	for (new i = 1; i <= get_maxplayers(); i++)
	{
		g_HasRifle = false
	}
}

public give_laser(id)
{
		
	new bool:HasWpn = bool:user_has_weapon(id, CSW_WPN)
		
	if(!g_HasRifle[id] && !HasWpn)
	{
		g_HasRifle[id] = true	
		fm_give_item(id, weapon)	
		cs_set_user_bpammo(id, CSW_WPN, 100)	
		engclient_cmd(id, weapon)
	}

	
	return PLUGIN_CONTINUE
}
public fw_CmdStart(id, handle, seed)
{
	if(!is_user_alive(id))
		return FMRES_IGNORED
	
	if(!g_HasRifle[id])
		return FMRES_IGNORED
		

	
	if(g_iCurWpn[id] != CSW_WPN)
		return FMRES_IGNORED
		
	static iButton
	iButton = get_uc(handle, UC_Buttons)
	
	if(iButton & IN_ATTACK)
	{
		set_uc(handle, UC_Buttons, iButton & ~IN_ATTACK)
		
		static Float:flCurTime
		flCurTime = halflife_time()
		
		if(flCurTime - g_flLastFireTime[id] < FIRERATE)
			return FMRES_IGNORED
			
		static iWpnID, iClip
		iWpnID = get_pdata_cbase(id, m_pActiveItem, 5)
		iClip = cs_get_weapon_ammo(iWpnID)
		
		if(get_pdata_int(iWpnID, m_fInReload, 4))
			return FMRES_IGNORED
		
		set_pdata_float(iWpnID, m_flNextPrimaryAttack, FIRERATE, 4)
		set_pdata_float(iWpnID, m_flNextSecondaryAttack, FIRERATE, 4)
		set_pdata_float(iWpnID, m_flTimeWeaponIdle, FIRERATE, 4)
		g_flLastFireTime[id] = flCurTime
		if(iClip <= 0)
		{
			ExecuteHamB(Ham_Weapon_PlayEmptySound, iWpnID)
			return FMRES_IGNORED
		}
		primary_attack(id)
		make_punch(id, 50)
		cs_set_weapon_ammo(iWpnID, --iClip)
		
		return FMRES_IGNORED
	}
	
	return FMRES_IGNORED
}
public fw_UpdateClientData_Post(id, sendweapons, handle)
{
	if(!is_user_alive(id))
		return FMRES_IGNORED
		
	if(!g_HasRifle[id])
		return FMRES_IGNORED
		
	
	if(g_iCurWpn[id] != CSW_WPN)
		return FMRES_IGNORED
		
	set_cd(handle, CD_flNextAttack, halflife_time() + 0.001)
	return FMRES_HANDLED
}
public fw_Deploy_Post(wpn)
{
	static id
	id = get_pdata_cbase(wpn, m_pPlayer, 4)
	
	if(is_user_connected(id) && g_HasRifle[id])
	{
		set_wpnanim(id, ANIM_DRAW)
	}
	return HAM_IGNORED
}
public fw_AddToPlayer(wpn, id)
{
	if(is_valid_ent(wpn) && is_user_connected(id) && entity_get_int(wpn, EV_INT_WEAPONKEY) == WPNKEY)
	{
		g_HasRifle[id] = true
		entity_set_int(wpn, EV_INT_WEAPONKEY, 0)
		return HAM_HANDLED
	}
	return HAM_IGNORED
}
public fw_PostFrame(wpn)
{
	static id
	id = get_pdata_cbase(wpn, m_pPlayer, 4)

	if(is_user_alive(id) && g_HasRifle[id])
	{
		static Float:flNextAttack, iBpAmmo, iClip, iInReload
		iInReload = get_pdata_int(wpn, m_fInReload, 4)
		flNextAttack = get_pdata_float(id, m_flNextAttack, 5)
		iBpAmmo = cs_get_user_bpammo(id, CSW_WPN)
		iClip = cs_get_weapon_ammo(wpn)
		
		if(iInReload && flNextAttack <= 0.0)
		{
			new iRemClip = min(WPN_MAXCLIP - iClip, iBpAmmo)
			cs_set_weapon_ammo(wpn, iClip + iRemClip)
			cs_set_user_bpammo(id, CSW_WPN, iBpAmmo-iRemClip)
			iInReload = 0
			set_pdata_int(wpn, m_fInReload, 0, 4)
		}
		static iButton
		iButton = get_user_button(id)

		if((iButton & IN_ATTACK2 && get_pdata_float(wpn, m_flNextSecondaryAttack, 4) <= 0.0) || (iButton & IN_ATTACK && get_pdata_float(wpn, m_flNextPrimaryAttack, 4) <= 0.0))
			return
		
		if(iButton & IN_RELOAD && !iInReload)
		{
			if(iClip >= WPN_MAXCLIP)
			{
				entity_set_int(id, EV_INT_button, iButton & ~IN_RELOAD)
				set_wpnanim(id, 0)
			}
			else if(iClip == WPN_MAXCLIP)
			{
				if(iBpAmmo)
				{
					reload(id, wpn, 1)
				}
			}
		}
	}
}
public fw_Reload_Post(wpn)
{
	static id
	id = get_pdata_cbase(wpn, m_pPlayer, 4)
	
	if(is_user_alive(id) && g_HasRifle[id] && get_pdata_int(wpn, m_fInReload, 4))
	{		
		reload(id, wpn)
	}
}
public primary_attack(id)
{
	set_wpnanim(id, ANIM_FIRE)
	entity_set_vector(id, EV_VEC_punchangle, Float:{ -1.5, 0.0, 0.0 })
	emit_sound(id, CHAN_WEAPON, snd_fire[random_num(0, sizeof snd_fire - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

	static iTarget, iBody, iEndOrigin[3], iStartOrigin[3]
	get_user_origin(id, iStartOrigin, 1) 
	get_user_origin(id, iEndOrigin, 3)
	fire_effects(iStartOrigin, iEndOrigin)
	get_user_aiming(id, iTarget, iBody)
	
	new iEnt = create_entity("info_target")
	
	static Float:flOrigin[3]
	IVecFVec(iEndOrigin, flOrigin)
	entity_set_origin(iEnt, flOrigin)
	remove_entity(iEnt)
	
	if(is_user_alive(iTarget))
	{	
		if(HITSD > 0.0)
		{
			static Float:flVelocity[3]
			get_user_velocity(iTarget, flVelocity)
			xs_vec_mul_scalar(flVelocity, HITSD, flVelocity)
			set_user_velocity(iTarget, flVelocity)	
		}
		if(get_user_team ( id ) != get_user_team ( iTarget ))
		{
			new iHp = pev(iTarget, pev_health)
			new Float:iDamage, iBloodScale
			if(iBody == HIT_HEAD)
			{
				iDamage = DAMAGE
				iBloodScale = 10
			}
			else
			{
				iDamage = DAMAGE*DAMAGE_MULTI
				iBloodScale = 25
			}
			if(iHp > iDamage) 
			{
				make_blood(iTarget, iBloodScale)
				set_pev(iTarget, pev_health, iHp-iDamage)
				damage_effects(iTarget)
			}
			else if(iHp <= iDamage)
			{
				ExecuteHamB(Ham_Killed, iTarget, id, 2)
			}
		}
	}
	else
	{
		emit_sound(id, CHAN_WEAPON, snd_hit[random_num(0, sizeof snd_hit - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}
stock fire_effects(iStartOrigin[3], iEndOrigin[3])
{
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
	write_byte(0)    
	write_coord(iStartOrigin[0])
	write_coord(iStartOrigin[1])
	write_coord(iStartOrigin[2])
	write_coord(iEndOrigin[0])
	write_coord(iEndOrigin[1])
	write_coord(iEndOrigin[2])
	write_short(g_sprBeam)
	write_byte(1) 
	write_byte(5) 
	write_byte(10) 
	write_byte(25) 
	write_byte(0) 
	write_byte(0)     
	write_byte(255)      
	write_byte(0)      
	write_byte(100) 
	write_byte(0) 
	message_end()
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(3)
	write_coord(iEndOrigin[0])
	write_coord(iEndOrigin[1])
	write_coord(iEndOrigin[2])
	write_short(g_sprExp)
	write_byte(10)
	write_byte(15)
	write_byte(4)
	message_end()	
}
stock reload(id, wpn, force_reload = 0)
{
	set_pdata_float(id, m_flNextAttack, RELOADSPEED, 5)
	set_wpnanim(id, ANIM_RELOAD)
	emit_sound(id, CHAN_WEAPON, snd_reload[random_num(0, sizeof snd_reload - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	
	if(force_reload)
		set_pdata_int(wpn, m_fInReload, 1, 4)
}
stock damage_effects(id)
{
	message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, id)
	write_byte(0)
	write_byte(0)
	write_long(DMG_NERVEGAS)
	write_coord(0) 
	write_coord(0)
	write_coord(0)
	message_end()
	
	message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, {0,0,0}, id)
	write_short(1<<13)
	write_short(1<<14)
	write_short(0x0000)
	write_byte(0)
	write_byte(255)
	write_byte(0)
	write_byte(100) 
	message_end()
		
	message_begin(MSG_ONE, g_msgScreenShake, {0,0,0}, id)
	write_short(0xFFFF)
	write_short(1<<13)
	write_short(0xFFFF) 
	message_end()
}
stock make_blood(id, scale)
{
	new Float:iVictimOrigin[3]
	pev(id, pev_origin, iVictimOrigin)
	
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
	write_byte(115)
	write_coord(floatround(iVictimOrigin[0]+random_num(-20,20))) 
	write_coord(floatround(iVictimOrigin[1]+random_num(-20,20))) 
	write_coord(floatround(iVictimOrigin[2]+random_num(-20,20))) 
	write_short(g_sprBlood)
	write_short(g_sprBlood) 
	write_byte(248) 
	write_byte(scale) 
	message_end()
}
stock set_wpnanim(id, anim)
{
	entity_set_int(id, EV_INT_weaponanim, anim)
	message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, id)
	write_byte(anim)
	write_byte(entity_get_int(id, EV_INT_body))
	message_end()
}
stock make_punch(id, velamount) 
{
	static Float:flNewVelocity[3], Float:flCurrentVelocity[3]
	velocity_by_aim(id, -velamount, flNewVelocity)
	get_user_velocity(id, flCurrentVelocity)
	xs_vec_add(flNewVelocity, flCurrentVelocity, flNewVelocity)
	set_user_velocity(id, flNewVelocity)	
}
stock fm_give_item(index, const item[])
{
	if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
		return 0;

	new ent = fm_create_entity(item);
	if (!pev_valid(ent))
		return 0;
	
	new Float:origin[3];
	pev(index, pev_origin, origin);
	set_pev(ent, pev_origin, origin);
	set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
	dllfunc(DLLFunc_Spawn, ent);
	
	new save = pev(ent, pev_solid);
	dllfunc(DLLFunc_Touch, ent, index);
	if (pev(ent, pev_solid) != save)
		return ent;
	
	engfunc(EngFunc_RemoveEntity, ent);
	
	return -1;
}

public Player_TakeDamage ( iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits ) {
	
	if ( !is_user_connected ( iVictim ) || !is_user_connected ( iAttacker ) ) 
		return HAM_IGNORED;
	
	if ( HaveBarlog [ iAttacker ] && get_user_weapon ( iAttacker ) == CSW_XM1014 && is_valid_player( iAttacker) ) {
		
		SetHamParamFloat( 4, fDamage * 3.0);
		return HAM_HANDLED;
		
	}
	
	if ( HaveFatal [ iAttacker ] && get_user_weapon ( iAttacker ) == CSW_M249 && is_valid_player( iAttacker) ) {
		
		SetHamParamFloat( 4, fDamage * 2.4);
		return HAM_HANDLED;
		
	}
	
	return HAM_IGNORED;
	
}
A fool's brain digests philosophy into folly, science into superstition, and art into pedantry.

#RETIRED.
User avatar
CaPy @ Ecila
Membru, skill +1
Membru, skill +1
Posts: 144
Joined: 30 Nov 2013, 22:23
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: Dr&Furien.Ecila
Has thanked: 38 times
Been thanked: 9 times
Contact:

01 Dec 2013, 19:10

Mersi frate :)
Connect Furien.Scorpionii.Ro

Image
Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests