Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Klasa

Modyfikacja klasy Lowca

klasa

  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
1 odpowiedź w tym temacie

#1 AjZiS

    Pomocny

  • Użytkownik

Reputacja: 0
Nowy

  • Postów:47
  • Imię:Patryk
Offline

Napisano 01.12.2019 13:42

proszę o pomoc w modyfikacji klasy "Lowca" trochę próbowałem ale nie za bardzo się znam. Klasa ma zamiast scouta model łuku. Jak wybierzemy inną klasę ze scoutem to ma właśnie ten model łuku. Czy wystarczyłoby zmienić po prostu nazwę modeli ?

 

Lub może wykorzystać broń jaka nie będzie używana i zmienić tą linię ?

if(ma_klase[id]) //tutaj wstawiamy ma_klase lub ma_perk
	{
		if(weapon == CSW_SCOUT) //tutaj ustawiamy broń, jakiej model będziemy zmieniać
		{
			set_pev(id, pev_viewmodel2, "models/v_Shina_by_Oxigen.mdl")
			//tu dajemy ścieżkę do nowego modeli v_
		}
	}
}
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <fakemeta_util>
#include <xs>
        
new const nazwa[]   = "Lowca";
new const opis[]    = "";
new const bronie    = (1<<CSW_P228)|(1<<CSW_SCOUT)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG);
new const zdrowie   = 0;
new const kondycja  = 0;
new const inteligencja = 0;
new const wytrzymalosc = 0;
    
new ma_klase[33];

new const P_MODEL[] = "models/p_Shina_by_Oxigen.mdl"
new const V_MODEL[] = "models/v_Shina_by_Oxigen.mdl"
new const W_MODEL[] = "models/w_Shina_by_Oxigen.mdl"
new const ARROW_MODEL[] = "models/arrow.mdl"

#define BURN_CLASSNAME "flame"
#define BURN_MODEL "sprites/flame_burn01.spr"
#define POISON_MODEL "sprites/poison.spr"

// Settings
#define BASE_SPEED 1200
#define BONUS_SPEED 600

#define BURN_LIFE 10.0
#define BURN_PERIOD 2.0
#define BURN_DAMAGE 10.0

#define POISON_TIME 5.0
#define POISON_PERIOD 1.0
#define POISON_DAMAGE 5.0
#define SPEED_LOW_POISON 0.8
#define SLOW_POISON_TIME 3.0

#define NORMAL_DMG 45.0

#define SPEED_LOW_ICE 0.5
#define SLOW_ICE_TIME 7.0

#define EXPLODE_DAMAGE 90.0
#define EXPLODE_HITRADIUS 400

// Base number of arrows
#define NORMAL_AMMO 20
#define FIRE_AMMO 15
#define ICE_AMMO 10
#define POISON_AMMO 7
#define EXPLODE_AMMO 3

//Number of extra arrows
#define NORMAL_AMMO_BUY 5
#define FIRE_AMMO_BUY 4
#define ICE_AMMO_BUY 3
#define POISON_AMMO_BUY 2
#define EXPLODE_AMMO_BUY 1

// Cost of extra arrows
#define AMMO_COST 1000
#define NEXT_SHOT_TIME 0.97

new const ARROW_SHOOT[] = "crossbow_shoot1.wav"

new g_exp_sprid

new Float:g_start_time[33], Float:g_finish_time[33]

new Float:g_Burn[33], Float:g_Poisoned[33]
new g_slowed[33], g_pressed[33], Float:g_old_speed[33]

// Ammo 
new g_ammo[33], g_normal_ammo[33], g_fire_ammo[33], g_ice_ammo[33], g_poison_ammo[33], g_explode_ammo[33]

// Player variables
new g_HasBow[33] // whether player has bow
new bool:draw_wpn[33] 

new g_bow_mode[33], g_dmg_mode[33]

new g_MaxPlayers

// Render effects debug
new g_FrozenRenderingFx[33]
new Float:g_FrozenRenderingColor[33][3]
new g_FrozenRenderingRender[33]
new Float:g_FrozenRenderingAmount[33]

// Message ID's
new g_MsgDamage, g_msgBarTime

enum {
	anim_idle,
	anim_shot1,
	anim_shot2,
	anim_reload,
	anim_draw
}

enum
{
	NORMAL_MODE = 1,
	FIRE_MODE = 2,
	ICE_MODE = 3,
	POISON_MODE = 4,
	EXPLODE_MODE = 5
}

enum
{
	dmg_fire = 1,
	dmg_poison = 2
}

// Plugin precache
public plugin_precache()
{
	// Models
	precache_model(P_MODEL)
	precache_model(V_MODEL)
	precache_model(W_MODEL)
	precache_model(ARROW_MODEL)
	precache_model(BURN_MODEL)
	precache_model(POISON_MODEL)
	
	// Sounds
	precache_sound(ARROW_SHOOT)
	//precache_sound(GRENADE_DRAW)
	precache_sound("weapons/357_cock1.wav")

	g_exp_sprid = engfunc(EngFunc_PrecacheModel, "sprites/zerogxplode.spr")
}

public plugin_init()
{
	register_plugin(nazwa, "1.0", "amxx.pl");

	cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);   
	RegisterHam(Ham_Spawn, "player", "fwSpawn_Grawitacja", 1);
	RegisterHam(Ham_Spawn, "player", "give_bow", 2);


	register_event("Damage", "Damage_Wyrzucenie", "b", "2!=0");
	
	register_event("CurWeapon", "Event_CurrentWeapon", "be", "1=1")
	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0");
	
	register_event("CurWeapon", "CurWeapon", "be", "1=1")
	
	// Forwards
	RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_scout", "fw_bow_PrimaryAttack")
	RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_scout", "fw_bow_SecondaryAttack")
	RegisterHam(Ham_Weapon_Reload, "weapon_scout", "fw_bow_Reload")
	RegisterHam(Ham_Item_Deploy, "weapon_scout", "fw_bow_Deploy_Post", 1)
	register_think(BURN_CLASSNAME, "BurnThink")
	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	register_forward(FM_Touch, "fw_touch")
	register_clcmd("drop","dropcmd")

	// Messages
	g_MsgDamage = get_user_msgid("Damage")
	g_msgBarTime = get_user_msgid("BarTime")

	register_clcmd("say /kup", "money")
	register_clcmd("buyammo1", "buy_ammo")

	g_MaxPlayers = get_maxplayers()

}

public cod_class_enabled(id)
{
	client_print(id, print_chat, "Klasa zostala stworzona przez SKoRPiuS'a");
	
	if(!(get_user_flags(id) & ADMIN_LEVEL_G))
	{
		client_print(id, print_chat, "[Lowca] Nie masz uprawnien, aby uzywac tej klasy.")
		return COD_STOP;
	}

 	entity_set_float(id, EV_FL_gravity, 500.0/800.0);
	give_item(id, "weapon_hegrenade");
	give_item(id, "weapon_flashbang");
	give_item(id, "weapon_flashbang");
	give_item(id, "weapon_smokegrenade");
	cs_set_user_defuse(id, 1);
	ma_klase[id] = true;
	g_HasBow[id] = true;
   
	return COD_CONTINUE;
}

public cod_class_disabled(id)
{

 	entity_set_float(id, EV_FL_gravity, 1.0);
	ma_klase[id] = false;
	g_HasBow[id] = false;

}

public fwSpawn_Grawitacja(id)
{
	if(ma_klase[id])
		entity_set_float(id, EV_FL_gravity, 500.0/800.0);
}


public Damage_Wyrzucenie(id)
{
	new idattacker = get_user_attacker(id);

	if(!is_user_alive(idattacker))
		return;

	if(!ma_klase[idattacker])
		return;

	if(random_num(1, 6) != 1)
		return;

	client_cmd(id, "drop");
}
public money(id)
{
	cs_set_user_money(id, 16000)
}
public Event_NewRound()
{
	for (new i = 0; i < get_maxplayers(); i++)
    	{
		set_user_rendering(i, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)
		g_Poisoned[i]=0.0	
		g_Burn[i]=0.0	
		g_slowed[i] = false
	}
}

public dropcmd(id) {
	        if(g_HasBow[id] && get_user_weapon(id) == CSW_SCOUT) {
		new Float:Aim[3],Float:origin[3]
		VelocityByAim(id, 64, Aim)
		entity_get_vector(id,EV_VEC_origin,origin)
		
		origin[0] += Aim[0]
		origin[1] += Aim[1]
		
		new bow = create_entity("info_target")
		entity_set_string(bow,EV_SZ_classname,"bow")
		entity_set_model(bow,W_MODEL)	
		
		entity_set_size(bow,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
		entity_set_int(bow,EV_INT_solid,1)
		
		entity_set_int(bow,EV_INT_movetype,6)
		entity_set_vector(bow,EV_VEC_origin,origin)
		g_HasBow[id] = false
		remowegun(id)
		return PLUGIN_HANDLED
	} 
	        return PLUGIN_CONTINUE
}

// remove gun  and save all guns
public remowegun(id) { 
	new wpnList[32] 
	new number
	get_user_weapons(id,wpnList,number) 
	for (new i = 0;i < number ;i++) { 
		if (wpnList[i] == CSW_SCOUT) {
			fm_strip_user_gun(id, wpnList[i])
		}
	}
} 

public buy_ammo(id)
{
	if(!g_HasBow[id])
		return PLUGIN_CONTINUE

	if((cs_get_user_buyzone(id)) && (ma_klase[id]))
	{
		give_ammo(id)
		return PLUGIN_HANDLED
	}

	if(cs_get_user_money(id) <= AMMO_COST)
	{
		client_print(id, print_chat, "Kupiles Belty za 16 000$")
		return PLUGIN_CONTINUE
	}

	give_ammo(id)

	return PLUGIN_HANDLED
}

public give_ammo(id)
{
	if(g_normal_ammo[id] == NORMAL_AMMO && g_fire_ammo[id] == FIRE_AMMO && g_ice_ammo[id] == ICE_AMMO && g_poison_ammo[id] == POISON_AMMO && g_explode_ammo[id] == EXPLODE_AMMO)
		return PLUGIN_CONTINUE
		if(ma_klase[id])
		cs_set_user_money(id, cs_get_user_money(id) - AMMO_COST)
		g_normal_ammo[id] += NORMAL_AMMO_BUY
		g_fire_ammo[id] += FIRE_AMMO_BUY
		g_ice_ammo[id] += ICE_AMMO_BUY
		g_poison_ammo[id] += POISON_AMMO_BUY
		g_explode_ammo[id] += EXPLODE_AMMO_BUY
		if(g_normal_ammo[id] > NORMAL_AMMO) g_normal_ammo[id] = NORMAL_AMMO
		if(g_fire_ammo[id] > FIRE_AMMO) g_fire_ammo[id] = FIRE_AMMO
		if(g_ice_ammo[id] > ICE_AMMO) g_ice_ammo[id] = ICE_AMMO
		if(g_poison_ammo[id] > POISON_AMMO) g_poison_ammo[id] = POISON_AMMO
		if(g_explode_ammo[id] > EXPLODE_AMMO) g_explode_ammo[id] = EXPLODE_AMMO
		update_ammo(id)
		return PLUGIN_CONTINUE
}


//play anim
public playanim(player,anim)
{
	set_pev(player, pev_weaponanim, anim)
	message_begin(MSG_ONE, SVC_WEAPONANIM, {0, 0, 0}, player)
	write_byte(anim)
	write_byte(pev(player, pev_body))
	message_end()
}


// Client connected
public client_connect(id)
{
	// Reset all
	g_HasBow[id] = false
	g_finish_time[id] = 0.0
}

// Current weapon player is holding
public Event_CurrentWeapon(id)
{
	if (is_user_bot(id))
		return

	if(!is_user_connected(id))
		return
		
	if(ma_klase[id])
	
		return
	
	// Read weapon ID
	new weaponID = read_data(2)
	
	if (weaponID == CSW_SCOUT)
	{
		if (g_HasBow[id])
		{
			if(!draw_wpn[id])
			{
				playanim(id, anim_draw)
				update_ammo(id)
				//emit_sound(id, CHAN_WEAPON, GRENADE_DRAW, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
				// View model
				entity_set_string(id, EV_SZ_viewmodel, V_MODEL)
				
				// Player model
				entity_set_string(id, EV_SZ_weaponmodel, P_MODEL)
				draw_wpn[id] = true
			}
		}
		else
		{
			// View model
			entity_set_string(id, EV_SZ_viewmodel, "models/v_scout.mdl")
			
			// Player model
			entity_set_string(id, EV_SZ_weaponmodel, "models/p_scout.mdl")
		}
	} 
	else 
	{
		draw_wpn[id] = false
	}
}

public remove_bow() {
	new nextitem = find_ent_by_class(-1, "bow")
	while ((nextitem = find_ent_by_class(-1, "bow")) != 0) {
		remove_entity(nextitem)
	}
	return PLUGIN_CONTINUE
}		

// Player killed
public fw_PlayerKilled(victim, attacker, shouldgib)
{
	if (g_HasBow[victim])		
	{
		// Reset all
		g_HasBow[victim] = false
		set_user_rendering(victim, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)

		// Remove screen's bar
		message_begin(MSG_ONE, g_msgBarTime, _, victim)
		write_byte(0) // time
		write_byte(0) // unknown
		message_end()
		
		remowegun(victim)
	}
}

public give_bow(id)
{
	give_weapon(id)
	g_bow_mode[id] = NORMAL_MODE

	g_normal_ammo[id] = NORMAL_AMMO
	g_fire_ammo[id] = FIRE_AMMO
	g_ice_ammo[id] = ICE_AMMO
	g_poison_ammo[id] = POISON_AMMO
	g_explode_ammo[id] = EXPLODE_AMMO
	
	ma_klase[id] = true;
}

//give wpn
public give_weapon(id){
	g_HasBow[id] = true
	update_ammo(id)
}

public fw_bow_PrimaryAttack(Weapon)
{
	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	if (g_HasBow[Player])
	return HAM_SUPERCEDE

	return HAM_IGNORED
}

public fw_bow_SecondaryAttack(Weapon)
{
	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	if (g_HasBow[Player])
	return HAM_SUPERCEDE

	return HAM_IGNORED
}

public fw_bow_Reload(Weapon) 
{
     	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	if (g_HasBow[Player])
	return HAM_SUPERCEDE

	return HAM_IGNORED
}

public fw_bow_Deploy_Post(Weapon)
{
	new Player = get_pdata_cbase(Weapon, 41, 4)
	
	update_ammo(Player)
}

// Command start
public fw_CmdStart(id, uc_handle, seed) 
{
	if(!g_HasBow[id])
		return FMRES_IGNORED

	static CurButton, OldButton
	
	CurButton = get_uc(uc_handle, UC_Buttons)
	OldButton = (pev(id, pev_oldbuttons) & IN_ATTACK)
	
	if(get_gametime() - g_finish_time[id] > NEXT_SHOT_TIME)
	{
		// Attack1 button pressed
		if(CurButton & IN_ATTACK && !OldButton)
		{
			if(get_user_weapon(id) != CSW_SCOUT)
				return FMRES_IGNORED

			if((g_bow_mode[id] == NORMAL_MODE && g_normal_ammo[id] <= 0) || (g_bow_mode[id] == FIRE_MODE && g_fire_ammo[id] <= 0) || (g_bow_mode[id] == ICE_MODE && g_ice_ammo[id] <= 0) || (g_bow_mode[id] == POISON_MODE && g_poison_ammo[id] <= 0) || (g_bow_mode[id] == EXPLODE_MODE && g_explode_ammo[id] <= 0))
				return FMRES_IGNORED

			g_start_time[id] = get_gametime()

			// A bar appears in his screen
			message_begin(MSG_ONE_UNRELIABLE, g_msgBarTime, _, id)
			write_byte(3) // time
			write_byte(0) // unknown
			message_end()

			g_pressed[id] = true
		}

		if(CurButton & IN_ATTACK && OldButton)
		{
			if((g_bow_mode[id] == NORMAL_MODE && g_normal_ammo[id] <= 0) || (g_bow_mode[id] == FIRE_MODE && g_fire_ammo[id] <= 0) || (g_bow_mode[id] == ICE_MODE && g_ice_ammo[id] <= 0) || (g_bow_mode[id] == POISON_MODE && g_poison_ammo[id] <= 0) || (g_bow_mode[id] == EXPLODE_MODE && g_explode_ammo[id] <= 0))
				return FMRES_IGNORED

			if(!g_pressed[id])
				return FMRES_IGNORED
		
			if(get_user_weapon(id) != CSW_SCOUT)
			{
				g_finish_time[id] = get_gametime()
		
				FireArrow(id)

				// Remove screen's bar
				message_begin(MSG_ONE, g_msgBarTime, _, id)
				write_byte(0) // time
				write_byte(0) // unknown
				message_end()

				g_pressed[id] = false
			}
		}

		if(!(CurButton & IN_ATTACK) && OldButton)
		{			
			if(get_user_weapon(id) != CSW_SCOUT)
				return FMRES_IGNORED

			if((g_bow_mode[id] == NORMAL_MODE && g_normal_ammo[id] <= 0) || (g_bow_mode[id] == FIRE_MODE && g_fire_ammo[id] <= 0) || (g_bow_mode[id] == ICE_MODE && g_ice_ammo[id] <= 0) || (g_bow_mode[id] == POISON_MODE && g_poison_ammo[id] <= 0) || (g_bow_mode[id] == EXPLODE_MODE && g_explode_ammo[id] <= 0))
				return FMRES_IGNORED

			if(!g_pressed[id])
				return FMRES_IGNORED

			g_finish_time[id] = get_gametime()
		
			FireArrow(id)

			// Remove screen's bar
			message_begin(MSG_ONE, g_msgBarTime, _, id)
			write_byte(0) // time
			write_byte(0) // unknown
			message_end()

			g_pressed[id] = false
		}
	}

	if((CurButton & IN_ATTACK2) && !(pev(id, pev_oldbuttons) & IN_ATTACK2))
	{		
		if(get_user_weapon(id) != CSW_SCOUT)
			return FMRES_IGNORED

		if(!g_pressed[id])
		{
			cmdMenu(id)
		}
	}
		
	return FMRES_HANDLED
}

//block anim standard wpn 
public fw_UpdateClientData_Post(id, sendweapons, cd_handle) 
{	
	if (!is_user_alive(id)) 
	return FMRES_IGNORED

	// Block default sounds	
	if (get_user_weapon(id) == CSW_SCOUT && g_HasBow[id]) 
	{
		set_cd(cd_handle, CD_flNextAttack, halflife_time() + 0.001 ); 
	}

	return FMRES_HANDLED
}

// Fire gremade
public FireArrow(id)
{
	// Set animation
	playanim(id, anim_shot1)

	// Get origin. angle and velocity
	new velocity[33]
	new Float:fAngle[3], Float:fVelocity[3]
	pev(id, pev_v_angle, fAngle)
	
	// Create ent
	new arrow = create_entity("info_target")
	
	// Not grenade
	if (!arrow) return PLUGIN_HANDLED

	// Classname
	entity_set_string(arrow, EV_SZ_classname, "bow_arrow")
	
	// Model
	entity_set_model(arrow, ARROW_MODEL)

	if(g_bow_mode[id] == NORMAL_MODE)
	{
		set_rendering(arrow, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 25)
		g_normal_ammo[id]--
	}
	else if(g_bow_mode[id] == FIRE_MODE)
	{
		set_rendering(arrow, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)
		g_fire_ammo[id]--
	}
	else if(g_bow_mode[id] == ICE_MODE)
	{
		set_rendering(arrow, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25)
		g_ice_ammo[id]--
	}
	else if(g_bow_mode[id] == POISON_MODE)
	{
		set_rendering(arrow, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 25)
		g_poison_ammo[id]--
	}
	else if(g_bow_mode[id] == EXPLODE_MODE)
	{
		set_rendering(arrow, kRenderFxGlowShell, 150, 105, 0, kRenderNormal, 25)
		g_explode_ammo[id]--
	}

	update_ammo(id)

	new Float:vOrigin[3],Float:vUp[3]
	pev(id, pev_origin, vOrigin)
	
	global_get(glb_v_up, vUp)
	new up = 17
	vOrigin[0] = vOrigin[0] + vUp[0] * up
	vOrigin[1] = vOrigin[1] + vUp[1] * up
	vOrigin[2] = vOrigin[2] + vUp[2] * up
	
	// Origin
	entity_set_origin(arrow, vOrigin)
	
	// Angles
	entity_set_vector(arrow, EV_VEC_angles, fAngle)
	
	// Size
	new Float:MinBox[3] = {-1.0, -1.0, -1.0}
	new Float:MaxBox[3] = {1.0, 1.0, 1.0}
	entity_set_vector(arrow, EV_VEC_mins, MinBox)
	entity_set_vector(arrow, EV_VEC_maxs, MaxBox)
	
	// Interaction
	entity_set_int(arrow, EV_INT_solid, SOLID_SLIDEBOX)
	
	// Movetype
	entity_set_int(arrow, EV_INT_movetype, MOVETYPE_TOSS)
	
	// Owner
	entity_set_edict(arrow, EV_ENT_owner, id)
	
	// Velocity
	new Float: holdtime[33] 
	new Float: mnoji[33]

	holdtime[id] = g_finish_time[id] - g_start_time[id]

	if(holdtime[id] < 1.0) holdtime[id] = 1.0
	if(holdtime[id] > 3.0) holdtime[id] = 3.0

	
	mnoji[id] = BASE_SPEED + holdtime[id] * BONUS_SPEED
	velocity[id] = floatround(mnoji[id],floatround_round)
	VelocityByAim(id, velocity[id], fVelocity)
	
	entity_set_vector(arrow, EV_VEC_velocity, fVelocity)
	
	// Launch sound
	emit_sound(arrow, CHAN_WEAPON, ARROW_SHOOT, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

	return PLUGIN_CONTINUE
}	

// We hit something!!!
public pfn_touch(ptr, ptd)
{
	// If ent is valid
	if (pev_valid(ptr))
	{	
		// Get classnames
		static classname[32], classnameptd[32]
		pev(ptr, pev_classname, classname, 31)
		
		// Our ent
		if(equal(classname, "bow_arrow"))
		{
			// Get it's origin
			new Float:Origin[3]
			pev(ptr, pev_origin, Origin)

			new owner = pev(ptr, pev_owner)

			if(g_bow_mode[owner] == EXPLODE_MODE)
			{
				// Explosion
				engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, Origin, 0)
				write_byte(TE_EXPLOSION)
				engfunc(EngFunc_WriteCoord, Origin[0])
				engfunc(EngFunc_WriteCoord, Origin[1])
				engfunc(EngFunc_WriteCoord, Origin[2])
				write_short(g_exp_sprid)
				write_byte(40)
				write_byte(30)
				write_byte(0)
				message_end()

				check_radius_damage(ptr, owner)
			}

			if(is_user_alive(ptd))
			{
				if(cs_get_user_team(ptd) != cs_get_user_team(owner))
				{
					g_old_speed[ptd] = get_user_maxspeed(ptd)

					if(g_bow_mode[owner] == NORMAL_MODE)
					{
						ExecuteHamB(Ham_TakeDamage, ptd, ptr, owner, NORMAL_DMG, DMG_BULLET)
					}
					else if(g_bow_mode[owner] == FIRE_MODE)
					{
						g_dmg_mode[ptd] = dmg_fire
						CreateBurn(ptd, owner)
					}
					else if(g_bow_mode[owner] == ICE_MODE)
					{
						if(!g_slowed[ptd] && !g_Burn[ptd]) 
						{
							g_FrozenRenderingFx[ptd] = pev(ptd, pev_renderfx)
							pev(ptd, pev_rendercolor, g_FrozenRenderingColor[ptd])
							g_FrozenRenderingRender[ptd] = pev(ptd, pev_rendermode)
							pev(ptd, pev_renderamt, g_FrozenRenderingAmount[ptd])

							set_user_rendering(ptd, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
							set_user_maxspeed(ptd, get_user_maxspeed(ptd) * SPEED_LOW_ICE)
							g_slowed[ptd] = true
							set_task(SLOW_ICE_TIME, "make_speed", ptd, _, _, "a", 1)
				
							message_begin(MSG_ONE_UNRELIABLE, g_MsgDamage, _, ptd)
							write_byte(0) // damage save
							write_byte(0) // damage take
							write_long(DMG_DROWN) // damage type - DMG_FREEZE
							write_coord(0) // x
							write_coord(0) // y
							write_coord(0) // z
							message_end()
						}
					}
					else if(g_bow_mode[owner] == POISON_MODE)
					{
						if(!g_slowed[ptd]) 
						{
							set_user_maxspeed(ptd, get_user_maxspeed(ptd) * SPEED_LOW_POISON)
							g_slowed[ptd] = true
							set_task(SLOW_POISON_TIME, "make_speed", ptd, _, _, "a", 1)

							g_dmg_mode[ptd] = dmg_poison
							CreateBurn(ptd, owner)
						}
					}
				}
			}
			// We hit breakable
			if(pev_valid(ptd))
			{
				pev(ptd, pev_classname, classnameptd, 31)
				if (equali(classnameptd, "func_breakable"))
				{
					// Destroy it
					force_use(ptr,ptd)
				}
			}
			set_pev(ptr, pev_flags, FL_KILLME)
		}
	}	
	if(is_valid_ent(ptr)) 
	{
		new classname[32]
		entity_get_string(ptr,EV_SZ_classname,classname,31)
		
		if(equal(classname, "bow")) 
		{
			if(is_valid_ent(ptd)) 
			{
				new id = ptd
				if(id > 0 && id < 34) 
				{
					if(allowed_toucher(id))
					{
						// Pick up weapon
						give_weapon(id)
						remove_entity(ptr)
					}
				}
			}
		}
	}
}	

public CreateBurn(id, attacker)
{
	if(g_Burn[id] || g_Poisoned[id])
		return

	if(g_dmg_mode[id] == dmg_fire)
	{
		new ent=CreateAnimationSprite(attacker, BURN_CLASSNAME, BURN_MODEL, 1.0, 10.0)
	
		set_pev(ent, pev_solid, SOLID_NOT)
		set_pev(ent, pev_movetype, MOVETYPE_FOLLOW)
	
		set_pev(ent, pev_aiment, id)
	
		set_pev(ent, pev_fuser2, get_gametime()+BURN_LIFE)
	
		g_Burn[id]=get_gametime()+BURN_PERIOD
	}
	if(g_dmg_mode[id] == dmg_poison)
	{
		new ent=CreateAnimationSprite(attacker, BURN_CLASSNAME, POISON_MODEL, 1.0, 10.0)
	
		set_pev(ent, pev_solid, SOLID_NOT)
		set_pev(ent, pev_movetype, MOVETYPE_FOLLOW)
	
		set_pev(ent, pev_aiment, id)
	
		set_pev(ent, pev_fuser2, get_gametime()+POISON_TIME)
	
		g_Poisoned[id]=get_gametime()+POISON_PERIOD
	}
}

public BurnThink(ent)
{
	if(!pev_valid(ent))
		return
		
	static Float:life, aim_ent
	
	pev(ent,pev_fuser2, life)
	
	aim_ent=pev(ent, pev_aiment)

	if(g_dmg_mode[aim_ent] == dmg_fire)
	{	
		if(get_gametime()>life||!is_user_alive(aim_ent)/*||!zp_get_user_zombie(aim_ent)*/)
		{
			g_Burn[aim_ent]=0.0	
		
			fm_remove_entity(ent)
		
			return
		}
	
		if(get_gametime()>g_Burn[aim_ent])
		{
			ExecuteHamB(Ham_TakeDamage, aim_ent , ent ,pev(ent, pev_owner), BURN_DAMAGE, DMG_BURN)
		
			g_Burn[aim_ent]=get_gametime()+BURN_PERIOD
		}
	}
	if(g_dmg_mode[aim_ent] == dmg_poison)
	{
		if(get_gametime()>life||!is_user_alive(aim_ent)/*||!zp_get_user_zombie(aim_ent)*/)
		{
			g_Poisoned[aim_ent]=0.0	
		
			fm_remove_entity(ent)
		
			return
		}
	
		if(get_gametime()>g_Poisoned[aim_ent])
		{
			ExecuteHamB(Ham_TakeDamage, aim_ent , ent ,pev(ent, pev_owner), POISON_DAMAGE, DMG_ACID)
		
			g_Poisoned[aim_ent]=get_gametime()+POISON_PERIOD
		}
	}
}

public make_speed(id)
{
	if(is_user_alive(id) && g_slowed[id])
	{
		g_slowed[id] = false
		set_user_maxspeed(id, g_old_speed[id])
		fm_set_rendering_float(id, g_FrozenRenderingFx[id], g_FrozenRenderingColor[id], g_FrozenRenderingRender[id], g_FrozenRenderingAmount[id])
	}
}

public check_radius_damage(ent, attacker)
{
	for(new i = 0; i < g_MaxPlayers; i++)
	{
		if(!is_user_alive(i))
			continue
		if(cs_get_user_team(attacker) == cs_get_user_team(i))
			continue
		if(entity_range(ent, i) > EXPLODE_HITRADIUS)
			continue
			
		Do_TakeDamage(ent, i, attacker, can_see_fm(ent, i))
	}
}

public Do_TakeDamage(Ent, Victim, Attacker, can_see)
{
	static Float:Damage, Float:CurrentDis
	
	CurrentDis = entity_range(Ent, Victim)
	Damage = EXPLODE_DAMAGE - ((CurrentDis / EXPLODE_HITRADIUS) * EXPLODE_DAMAGE)
	
	if(Damage > 0)
	{
		static WeaponEnt
		WeaponEnt = fm_get_user_weapon_entity(Attacker, CSW_HEGRENADE)
		
		if(!pev_valid(WeaponEnt))
			WeaponEnt = 0

		if(!can_see)
			Damage /= 2
			
		ExecuteHamB(Ham_TakeDamage, Victim, WeaponEnt, Attacker, Damage, DMG_BULLET)
	}	
}

public update_ammo(id)
{
	if(!is_user_alive(id))
		return

	if(g_bow_mode[id] == NORMAL_MODE)
	{
		g_ammo[id] = g_normal_ammo[id]
	}
	else if(g_bow_mode[id] == FIRE_MODE)
	{
		g_ammo[id] = g_fire_ammo[id]
	}
	else if(g_bow_mode[id] == ICE_MODE)
	{
		g_ammo[id] = g_ice_ammo[id]
	}
	else if(g_bow_mode[id] == POISON_MODE)
	{
		g_ammo[id] = g_poison_ammo[id]
	}
	else if(g_bow_mode[id] == EXPLODE_MODE)
	{
		g_ammo[id] = g_explode_ammo[id]
	}
	
	static weapon_ent; weapon_ent = fm_find_ent_by_owner(-1, "weapon_scout", id)
	if(pev_valid(weapon_ent)) cs_set_weapon_ammo(weapon_ent, 1)	
	
	cs_set_user_bpammo(id, CSW_SCOUT, g_ammo[id])
	
	engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
	write_byte(1)
	write_byte(CSW_SCOUT)
	write_byte(-1)
	message_end()

	set_task(0.1, "hud_debug", id)
}

public hud_debug(id)
{
	engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, get_user_msgid("CurWeapon"), {0, 0, 0}, id)
	write_byte(1)
	write_byte(CSW_SCOUT)
	write_byte(-1)
	message_end()
}

public cmdMenu(id) {
       new i_Menu = menu_create("\rWybierz Strzale", "menu_handler");
       menu_additem(i_Menu, "\wZwykle Strzaly", "1", 0);
       menu_additem(i_Menu, "\wOgnisne Strzaly", "2", 0);
       menu_additem(i_Menu, "\wLodowe Strzaly", "3", 0);
       menu_additem(i_Menu, "\wZatrute Strzaly", "4", 0);
       menu_additem(i_Menu, "\wBombowe Strzaly", "5", 0);
       menu_setprop(i_Menu, MPROP_EXITNAME, "Exit");

       menu_display(id, i_Menu, 0)
}

public menu_handler(id, menu, item) {
       if( item < 0 ) return PLUGIN_CONTINUE;
       new cmd[3], access, callback;
       menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
       new Choise = str_to_num(cmd)
       switch (Choise) {
       case 1: {
               	g_bow_mode[id] = NORMAL_MODE
		update_ammo(id)
       }
       case 2: {
             	g_bow_mode[id] = FIRE_MODE
		update_ammo(id)
       }
       case 3: {
               	g_bow_mode[id] = ICE_MODE
		update_ammo(id)
       }
       case 4: {
               	g_bow_mode[id] = POISON_MODE
		update_ammo(id)
       }
       case 5: {
               	g_bow_mode[id] = EXPLODE_MODE
		update_ammo(id)
       }
       }
       return PLUGIN_HANDLED;
}

// Allowed toucher
stock allowed_toucher(player)
{
	if (g_HasBow[player])
		return false
	
	return true
}

stock print(const id, const input[], any:...)
{
    new iCount = 1, iPlayers[32]
    
    static szMsg[191]
    vformat(szMsg, charsmax(szMsg), input, 3)
    
    replace_all(szMsg, 190, "^x04", "^4") // green txt
    replace_all(szMsg, 190, "^x01", "^1") // orange txt
    replace_all(szMsg, 190, "^x03", "^3") // team txt
    replace_all(szMsg, 190, "^x00", "^0") // team txt
    
    if(id) iPlayers[0] = id
    else get_players(iPlayers, iCount, "ch")
        
    for (new i = 0; i < iCount; i++)
    {
        if (is_user_connected(iPlayers[i]))
        {
            message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i])
            write_byte(iPlayers[i])
            write_string(szMsg)
            message_end()
        }
    }
}  

stock CreateAnimationSprite(owner, const classname[], const model[], Float:scale, Float:framerate)
{
	new ent=fm_create_entity("env_sprite")

	set_pev(ent, pev_framerate, framerate)
	set_pev(ent, pev_model, model)

	dllfunc(DLLFunc_Spawn, ent)

	set_pev(ent, pev_classname, classname)
	set_pev(ent, pev_owner, owner)

	fm_entity_set_model(ent, model)
	fm_set_rendering(ent, kRenderFxNoDissipation, 255, 255, 255, kRenderGlow, 255)

	set_pev(ent, pev_framerate, framerate)
	set_pev(ent, pev_scale, scale)

	return ent
}

public can_see_fm(entindex1, entindex2)
{
	if (!entindex1 || !entindex2)
		return false

	if (pev_valid(entindex1) && pev_valid(entindex1))
	{
		new flags = pev(entindex1, pev_flags)
		if (flags & EF_NODRAW || flags & FL_NOTARGET)
		{
			return 0
		}

		new Float:lookerOrig[3]
		new Float:targetBaseOrig[3]
		new Float:targetOrig[3]
		new Float:temp[3]

		pev(entindex1, pev_origin, lookerOrig)
		pev(entindex1, pev_view_ofs, temp)
		lookerOrig[0] += temp[0]
		lookerOrig[1] += temp[1]
		lookerOrig[2] += temp[2]

		pev(entindex2, pev_origin, targetBaseOrig)
		pev(entindex2, pev_view_ofs, temp)
		targetOrig[0] = targetBaseOrig [0] + temp[0]
		targetOrig[1] = targetBaseOrig [1] + temp[1]
		targetOrig[2] = targetBaseOrig [2] + temp[2]

		engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the had of seen player
		if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
		{
			return 0
		} 
		else 
		{
			new Float:flFraction
			get_tr2(0, TraceResult:TR_flFraction, flFraction)
			if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
			{
				return 1
			}
			else
			{
				targetOrig[0] = targetBaseOrig [0]
				targetOrig[1] = targetBaseOrig [1]
				targetOrig[2] = targetBaseOrig [2]
				engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) //  checks the body of seen player
				get_tr2(0, TraceResult:TR_flFraction, flFraction)
				if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
				{
					return 1
				}
				else
				{
					targetOrig[0] = targetBaseOrig [0]
					targetOrig[1] = targetBaseOrig [1]
					targetOrig[2] = targetBaseOrig [2] - 17.0
					engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, entindex1, 0) 
					get_tr2(0, TraceResult:TR_flFraction, flFraction)
					if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == entindex2))
					{
						return 1
					}
				}
			}
		}
	}
	return 0
}

stock fm_set_rendering_float(entity, fx = kRenderFxNone, Float:color[3], render = kRenderNormal, Float:amount = 16.0)
{
	set_pev(entity, pev_renderfx, fx)
	set_pev(entity, pev_rendercolor, color)
	set_pev(entity, pev_rendermode, render)
	set_pev(entity, pev_renderamt, amount)
}
public CurWeapon(id)
{
	new weapon = read_data(2);

	if(ma_klase[id]) //tutaj wstawiamy ma_klase lub ma_perk
	{
		if(weapon == CSW_SCOUT) //tutaj ustawiamy broń, jakiej model będziemy zmieniać
		{
			set_pev(id, pev_viewmodel2, "models/v_Shina_by_Oxigen.mdl")
			//tu dajemy ścieżkę do nowego modeli v_
		}
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/


Użytkownik AjZiS edytował ten post 01.12.2019 13:50

  • +
  • -
  • 0

#2 AjZiS

    Pomocny

  • Autor tematu
  • Użytkownik

Reputacja: 0
Nowy

  • Postów:47
  • Imię:Patryk
Offline

Napisano 01.12.2019 14:37

Opanowane. 

Można zamknąć.


  • +
  • -
  • 0





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

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

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