Skocz do zawartości

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

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

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

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

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Jak zrobić, że ktoś z daną flagą może wykonać komendę?


  • Zamknięty Temat jest zamknięty
6 odpowiedzi w tym temacie

#1 assasinos

    Życzliwy

  • Użytkownik

Reputacja: 0
zer0.

  • Postów:21
Offline

Napisano 29.08.2009 12:45

Mam na serwerze plugin VIP ( http://forums.superc...p?showtopic=352 ) i chcę teraz zrobić coś takiego, że tylko VIP ma możliwość kupienia tej broni. Jak to zrobić? Nie wykluczam także innych możliwości, więc chciałbym tutaj sposób, a nie tylko wyedytowany plugin :P

Proszę o szybką odpowiedź :)
  • +
  • -
  • 0

#2 DK

    Wszechobecny

  • Użytkownik

Reputacja: 49
Pomocny

  • Postów:411
  • GG:
  • Steam:steam
  • Lokalizacja:KrK / Wadowice
Offline

Napisano 29.08.2009 13:34

znajdz ADMIN_USER i zmien na ADMIN_LEVEL_H powino działać
  • +
  • -
  • 0

#3 assasinos

    Życzliwy

  • Autor tematu
  • Użytkownik

Reputacja: 0
zer0.

  • Postów:21
Offline

Napisano 29.08.2009 14:21

Zamieniłem, przekompilowałem i dalej każdy może używać :/
  • +
  • -
  • 0

#4 Vertricus

    Godlike

  • Przyjaciel

Reputacja: 426
Wszechobecny

  • Postów:1549
  • Lokalizacja:.
Offline

Napisano 29.08.2009 14:52

Na pewno zmieniłeś to co DK mówił?
register_clcmd("say /buyft", "cmd_BuyFlamethrower", ADMIN_USER, "- Buys a flamethrower")
	register_clcmd("say_team /buyft", "cmd_BuyFlamethrower", ADMIN_USER, "- Buys a flamethrower")

na
register_clcmd("say /buyft", "cmd_BuyFlamethrower", ADMIN_LEVEL_H, "- Buys a flamethrower")
	register_clcmd("say_team /buyft", "cmd_BuyFlamethrower", ADMIN_LEVEL_H, "- Buys a flamethrower")


Jeszcze można dodać w cmd_BuyFlamethrower przed else jeden else if z sprawdzeniem czy nie ma flagi.
  • +
  • -
  • 0

#5 DK

    Wszechobecny

  • Użytkownik

Reputacja: 49
Pomocny

  • Postów:411
  • GG:
  • Steam:steam
  • Lokalizacja:KrK / Wadowice
Offline

Napisano 29.08.2009 15:55

/*
				[ZP] Extra Item : Flamethrower
				     ( weapon for HUMANS )
				
					     by Fry!


	Description :

			Now on Zombie mod has appeared new weapon, that is Flamethrower.
			You can burn zombies alive, but don't forget that this weapon will cost to You some ammo packs.


	Cvars :

			zp_ft_client_buy <1|0> 		- This means that You can buy this weapon, default is 1.
			zp_ft_cost "26" 		- This means how much flamethrower cost to You.
			zp_ft_fuelcost "2" 		- How much Fuel for Flamethrower will cost.
			zp_ft_fueltank "100" 		- How much fuel ammo will be in one clip.
			zp_ft_damage "199" 		- How much damage will do to zombies.
			zp_ft_xplode_dmg "100" 		- How much damage will be if it will explode.
			zp_ft_damage_dis "120" 		- How far You can shoot flames.
			zp_ft_splash_dis "75" 		- How far fire will splash.
			zp_ft_ammo_after_kill "15"	- How much ammo packs You will get when You kill zombie
			zp_ft_frags_after_kill "5"	- How much frags You can get when You kill zombie
	

	Commands :

			To buy flamethrower You can use chat messages too.
			say /buyft to buy flamethrower or say_team /buyft
	
			+attack2 - buy fuel for flamethrower


	Credits :

			Cheap_Suit - For his flamethrower plugin. <img src='http://amxx.pl/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />


	Changelog :

			29/10/2008 - v0.1 - First release
			31/10/2008 - v0.3 - rewrited all plugin, fixed some of my mistakes
			01/11/2008 - v0.4 - completely fixed bug due zombies could use flamethrower to kill humans.
			03/11/2008 - v0.4.1 - removed one annoying code line due players after dropcan't pick up it again.
			06/11/2008 - v0.5 - added feature that admins can buy this weapon only, added after you kill somebody you can get some ammo packs, added you can change by cvar how much frags you will gain after you kill zombie, added how much ammo packs you will lose when you kill a team mate and how much frags you will lose when kill a team mate.
			12/11/2008 - v0.7 - fixed index of bounds, and posibility that zombie sometimes still has a flamethrower, fixed that zombie can't drop flamethrower all the time, fixed friendly fire work too, so you can't kill team mate anymore, so I removed lose frags and ammo packs if kill team mate.
			22/11/2008 - v0.8 - after infection your flamethrower will be removed now and removed cstrike and fun module.
			25/02/2009 - v0.8.5 - removed admin commands, removed toggle cvar, removed buyzone and buy time too, removed unnecessary concmd, fixed zombies drop flamethrower after being infected.

*/

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <csx>
#include <xs>
#include <zombieplague>
#include <amxmisc>

#define PLUGIN "[ZP] Extra Item : Flamethrower"
#define VERSION "0.8.5"
#define AUTHOR "Fry!"

new wpn_ft, sprite_fire, sprite_burn, sprite_xplo
new g_item_name[] = "Flamethrower"
new g_itemid_ft, g_restarted, g_client_buy, g_damage, g_xplode_dmg, g_cost, g_fuelcost,
g_fueltank, g_damage_dis, g_splash_dis, g_ammo_packs_after_kill, g_frags_after_kill
new g_FuelTank[33], g_Activated[33], g_hasFlamethrower[33], g_FireFlamethrower[33], g_BuyFuel[33]
new Float:g_Delay[33]


public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_cvar("zp_extra_flamethrower", VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
	
	g_client_buy = register_cvar("zp_ft_client_buy", "1")
	g_cost = register_cvar("zp_ft_cost", "26")
	g_fuelcost = register_cvar("zp_ft_fuelcost", "2")
	g_fueltank = register_cvar("zp_ft_fueltank", "100")
	g_damage = register_cvar("zp_ft_damage", "199")
	g_xplode_dmg = register_cvar("zp_ft_xplode_dmg", "100")
	g_damage_dis = register_cvar("zp_ft_damage_dis", "120")
	g_splash_dis = register_cvar("zp_ft_splash_dis", "75")
	g_ammo_packs_after_kill = register_cvar("zp_ft_ammo_after_kill", "15")
	g_frags_after_kill = register_cvar("zp_ft_frags_after_kill", "5")
	
	g_itemid_ft = zp_register_extra_item(g_item_name, get_pcvar_num(g_cost), ZP_TEAM_HUMAN)

	register_clcmd("say /buyft", "cmd_BuyFlamethrower", ADMIN_LEVEL_H, "- Buys a flamethrower")
	register_clcmd("say_team /buyft", "cmd_BuyFlamethrower", ADMIN_LEVEL_H, "- Buys a flamethrower")
		
	register_event("DeathMsg", "Event_DeathMsg", "a")
	register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
	register_event("TextMsg", "Event_WeaponDrop", "be", "2=#Weapon_Cannot_Be_Dropped")
	register_event("TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
	
	register_forward(FM_CmdStart, "fw_CmdStart")
	register_forward(FM_PlayerPostThink, "fw_PlayerPostThink")
	register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
	
	register_think("flamethrower", "think_Flamethrower")
	register_touch("flamethrower", "player", "touch_Flamethrower")
	
	wpn_ft = custom_weapon_add("weapon_flamethrower", 0, "flamethrower")
}

public plugin_precache()
{
	precache_sound("flamethrower.wav")
	precache_sound("items/ammopickup2.wav")
	
	sprite_xplo = precache_model("sprites/zerogxplode.spr")
	sprite_fire = precache_model("sprites/explode1.spr")
	sprite_burn = precache_model("sprites/xfire.spr")
	
	precache_model("models/v_knife.mdl")
	precache_model("models/p_knife.mdl")
	precache_model("models/shield/v_shield_knife.mdl")
	precache_model("models/shield/p_shield_knife.mdl")
	precache_model("models/w_flamethrower.mdl")
	precache_model("models/v_flamethrower.mdl")
	precache_model("models/p_flamethrower.mdl")
}

public zp_extra_item_selected(player, itemid)
{
	if(itemid == g_itemid_ft)
	{
		g_hasFlamethrower[player] = 1
		g_FuelTank[player] = get_pcvar_num(g_fueltank)
		
		new temp[2], weaponID = get_user_weapon(player, temp[0], temp[1])
		if(weaponID == CSW_KNIFE) 
		{
			g_Activated[player] = true
			set_flamethrower_model(player)
		}
		
		client_cmd(player, "spk items/ammopickup2")
		client_print(player, print_chat, "You bought a flamethrower (press 3 to use)")
  	}
	return PLUGIN_CONTINUE
}

public cmd_BuyFlamethrower(id, level, cid)
{
	if (!cmd_access(id, level, cid, 3))
		return PLUGIN_HANDLED

	if (!get_pcvar_num(g_client_buy))
		return PLUGIN_CONTINUE
		
	new user_packs = zp_get_user_ammo_packs(id)
	new cost_packs = get_pcvar_num(g_cost)
	
	if(!is_user_alive(id)) 
		client_print(id, print_center, "You cant buy when your dead!")
	else if(g_hasFlamethrower[id])
		client_print(id, print_center, "You already own that weapon.")
	else if(user_packs < cost_packs)
		client_print(id, print_center, "You don't have enough ammo packs (%d)", cost_packs)
	else
	{
		g_hasFlamethrower[id] = 1
		g_FuelTank[id] = get_pcvar_num(g_fueltank)
		
		new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
		if(weaponID == CSW_KNIFE) 
		{
			g_Activated[id] = true
			set_flamethrower_model(id)
		}
		
    		zp_set_user_ammo_packs(id, user_packs - cost_packs)
		client_cmd(id, "spk items/ammopickup2")
		client_print(id, print_chat, "You bought a flamethrower (press 3 to use)")
  	}
	return PLUGIN_HANDLED
}

public Event_GameRestart() 
{
	g_restarted = 1
}

public Event_NewRound() 
{
	if(g_restarted)
	{
		new Players[32], iNum = 0
		get_players(Players, iNum)
		for(new i = 0; i < iNum; i++) 
		{
			new id = Players[i]
			
			g_FuelTank[id] = 0
			g_Activated[id] = 0
			g_hasFlamethrower[id] = 0
	
			new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
			if(weaponID == CSW_KNIFE) 
				set_knife_model(id)
			
			g_restarted = 0
		}
	}
	
	new flamethrowers = -1
	while((flamethrowers = find_ent_by_class(flamethrowers, "flamethrower")))
		remove_entity(flamethrowers)

}

public Event_WeaponDrop(id)
{
	if(!is_user_alive(id) || !g_Activated[id])
		return PLUGIN_CONTINUE
	
	g_hasFlamethrower[id] = 0
	drop_flamethrower(id)
	return PLUGIN_HANDLED
}

public Event_DeathMsg() 
{ 
	new id = read_data(2)
	if(!is_user_connected(id) || !g_hasFlamethrower[id]) 
	{
		Event_WeaponDrop(id)
	}

	return PLUGIN_CONTINUE
}

public Event_CurWeapon(id)
{
	if(!is_user_alive(id) || !g_hasFlamethrower[id]) 
		return PLUGIN_CONTINUE
	
	new WeaponID = read_data(2)
	switch(WeaponID) 
	{
		case CSW_KNIFE:
		{
			set_task(0.3, "task_ActivateFlamethrower", id)
			set_flamethrower_model(id)
			entity_set_int(id, EV_INT_weaponanim, 9)
		}
		default: g_Activated[id] = 0
	}
	return PLUGIN_CONTINUE
}

public touch_Flamethrower(ent, id)
{
	if(!is_valid_ent(ent) || !is_user_alive(id) || zp_get_user_zombie(id)) 
		return PLUGIN_CONTINUE
	
	if(g_hasFlamethrower[id])
		return PLUGIN_CONTINUE
	
	if(has_shield(id))
		return PLUGIN_CONTINUE
	
	g_hasFlamethrower[id] = 1
	client_cmd(id, "spk items/ammopickup2")
	g_FuelTank[id] = entity_get_int(ent, EV_INT_iuser4)
	show_fuel_percentage(id)
	
	new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
	if(weaponID == CSW_KNIFE) 
	{
		g_Activated[id] = true
		set_flamethrower_model(id)
		entity_set_int(id, EV_INT_weaponanim, 9)
	}
	remove_entity(ent)
	
	return PLUGIN_CONTINUE
}

public fw_UpdateClientData_Post(id, sendweapons, cd_handle) 
{
	if(!g_hasFlamethrower[id] || !g_Activated[id])
		return FMRES_IGNORED
		
	set_cd(cd_handle, CD_ID, 0)
	return FMRES_HANDLED
}

public fw_CmdStart(id, uc_handle, seed) 
{
	if(!g_hasFlamethrower[id] || !g_Activated[id] || zp_get_user_zombie(id))
		return FMRES_IGNORED
	
	if(zp_get_user_zombie(id))
	{
		Event_WeaponDrop(id)
		return FMRES_IGNORED
	}
	
	new buttons = get_uc(uc_handle, UC_Buttons)
	if(buttons & IN_ATTACK)
	{
		g_FireFlamethrower[id] = 1
	
		buttons &= ~IN_ATTACK
		set_uc(uc_handle, UC_Buttons, buttons)
	} else 
		g_FireFlamethrower[id] = 0
		
	if(buttons & IN_ATTACK2) 
	{
		g_BuyFuel[id] = 1
		
		buttons &= ~IN_ATTACK2
		set_uc(uc_handle, UC_Buttons, buttons)
	} else 
		g_BuyFuel[id] = 0
	return FMRES_HANDLED
}

public fw_PlayerPostThink(id)
{
	if(!is_user_connected(id) || !is_user_alive(id))
		return FMRES_IGNORED
		
	if(zp_get_user_zombie(id))
	{
		Event_WeaponDrop(id)
		return FMRES_IGNORED
	}
		
	if(!g_hasFlamethrower[id] || !g_Activated[id])
		return FMRES_IGNORED
		
	if(entity_get_int(id, EV_INT_waterlevel) > 1)
		return FMRES_IGNORED

	if(has_shield(id))
	{
		drop_flamethrower(id)
		return FMRES_IGNORED
	}
		
	if(g_BuyFuel[id])
	{
		if((g_Delay[id] + 0.2) < get_gametime())
		{
			buy_fuel(id)
			g_Delay[id] = get_gametime()
		}
	}
	
	if(g_FireFlamethrower[id])
	{
		if(g_FuelTank[id] > 0)
		{
			if((g_Delay[id] + 0.2) < get_gametime())
			{
				g_FuelTank[id] -= 1
				g_Delay[id] = get_gametime()
			}
			
			new Float:fOrigin[3], Float:fVelocity[3]
			entity_get_vector(id,EV_VEC_origin, fOrigin)
			VelocityByAim(id, 35, fVelocity)
		
			new Float:fTemp[3], iFireOrigin[3]
			xs_vec_add(fOrigin, fVelocity, fTemp)
			FVecIVec(fTemp, iFireOrigin)
			
			new Float:fFireVelocity[3], iFireVelocity[3]
			VelocityByAim(id, get_pcvar_num(g_damage_dis), fFireVelocity)
			FVecIVec(fFireVelocity, iFireVelocity)
			
			create_flames_n_sounds(id, iFireOrigin, iFireVelocity)
			
			new doDamage
			switch(get_cvar_num("mp_friendlyfire"))
			{
				case 0: doDamage = 0
				case 1: doDamage = 0
			}
			
			show_fuel_percentage(id)
			direct_damage(id, doDamage)
			indirect_damage(id, doDamage)
			custom_weapon_shot(wpn_ft, id)
		} else
			client_print(id, print_center, "Out of Fuel")
	}
	return FMRES_IGNORED
}

public think_Flamethrower(ent)
{
	if(is_valid_ent(ent) && entity_get_float(ent, EV_FL_health) < 950.0) 
	{
		new Float:fOrigin[3], iOrigin[3]
		entity_get_vector(ent, EV_VEC_origin, fOrigin)
		FVecIVec(fOrigin, iOrigin)
	
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(99)
		write_short(ent)
		message_end()
	
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(3)
		write_coord(iOrigin[0])
		write_coord(iOrigin[1])
		write_coord(iOrigin[2])
		write_short(sprite_xplo)
		write_byte(50)
		write_byte(15)
		write_byte(0)
		message_end()
		
		RadiusDamage(fOrigin, get_pcvar_num(g_xplode_dmg), entity_get_int(ent, EV_INT_iuser4))
		remove_entity(ent)
	}
	if(is_valid_ent(ent)) entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.01)
}

public create_flames_n_sounds(id, origin[3], velocity[3])
{
	message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
	write_byte(120)
	write_coord(origin[0])
	write_coord(origin[1])
	write_coord(origin[2])
	write_coord(velocity[0])
	write_coord(velocity[1])
	write_coord(velocity[2] + 5)
	write_short(sprite_fire)
	write_byte(1)
	write_byte(10)
	write_byte(1)
	write_byte(5)
	message_end()
	
	emit_sound(id, CHAN_WEAPON, "flamethrower.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}

public direct_damage(id, doDamage)
{
	new ent, body
	get_user_aiming(id, ent, body, get_pcvar_num(g_damage_dis) + 500)
	
	if(ent > 0 && is_user_alive(ent))
	{
		if(!doDamage)
		{
			if(zp_get_user_zombie(id) != zp_get_user_zombie(ent)) 
			{
				damage_user(id, ent, get_pcvar_num(g_damage))
				custom_weapon_dmg(wpn_ft, id, ent, get_pcvar_num(g_damage))
			}
		}
		else
		{
			damage_user(id, ent, get_pcvar_num(g_damage))	
			custom_weapon_dmg(wpn_ft, id, ent, get_pcvar_num(g_damage))
		}
	}
}

public indirect_damage(id, doDamage)
{
	new Players[32], iNum
	get_players(Players, iNum, "a")
	for(new i = 0; i < iNum; ++i) if(id != Players[i])
	{
		new target = Players[i]
	
		new Float:fOrigin[3], Float:fOrigin2[3]
		entity_get_vector(id,EV_VEC_origin, fOrigin)
		entity_get_vector(target, EV_VEC_origin, fOrigin2)
			
		new temp[3], Float:fAim[3]
		get_user_origin(id, temp, 3)
		IVecFVec(temp, fAim)
		
		new Float:fDistance = get_pcvar_num(g_damage_dis) + 500.0
		if(get_distance_f(fOrigin, fOrigin2) > fDistance)
			continue 
		
		new iDistance = get_distance_to_line(fOrigin, fOrigin2, fAim)
		if(iDistance > get_pcvar_num(g_splash_dis) || iDistance < 0 || !fm_is_ent_visible(id, target))
			continue 
			
		if(!doDamage)
		{
			if(zp_get_user_zombie(id) != zp_get_user_zombie(target))
			{
				damage_user(id, target, get_pcvar_num(g_damage))
				custom_weapon_dmg(wpn_ft, id, target, get_pcvar_num(g_damage))
			}
		}
		else 
		{
			damage_user(id, target, get_pcvar_num(g_damage) / 2)
			custom_weapon_dmg(wpn_ft, id, target, get_pcvar_num(g_damage) / 2)
		}
	}
}

public buy_fuel(id)
{
	if(g_FuelTank[id] >= get_pcvar_num(g_fueltank))
		return PLUGIN_CONTINUE
				
	new user_packs = zp_get_user_ammo_packs(id)
	new cost_packs = get_pcvar_num(g_fuelcost)
	if(user_packs >= cost_packs)
	{
		g_FuelTank[id] += 10
		show_fuel_percentage(id)
		zp_set_user_ammo_packs(id, user_packs - cost_packs)

		return PLUGIN_CONTINUE
	}	
	return PLUGIN_CONTINUE
}

public drop_flamethrower(id)
{
	new Float:fVelocity[3], Float:fOrigin[3]
	entity_get_vector(id, EV_VEC_origin, fOrigin)
	VelocityByAim(id, 34, fVelocity)
	
	fOrigin[0] += fVelocity[0]
	fOrigin[1] += fVelocity[1]

	VelocityByAim(id, 300, fVelocity)
	
	new ent = create_entity("info_target")
	if(is_valid_ent(ent))
	{
		entity_set_string(ent, EV_SZ_classname, "flamethrower")
		entity_set_model(ent, "models/w_flamethrower.mdl")
		entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
		entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
		entity_set_vector(ent, EV_VEC_origin, fOrigin)
		entity_set_vector(ent, EV_VEC_velocity, fVelocity)
		entity_set_int(ent, EV_INT_iuser4, g_FuelTank[id])
		entity_set_float(ent, EV_FL_takedamage, 1.0)
		entity_set_float(ent, EV_FL_health, 1000.0)
		entity_set_size(ent, Float:{-2.5, -2.5, -1.5}, Float:{2.5, 2.5, 1.5})
		entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.01)
	}
	
	g_FuelTank[id] = 0
	g_Activated[id] = 0
	g_hasFlamethrower[id] = 0
	
	if(has_shield(id))
		set_shield_model(id)
	else 
		set_knife_model(id)
		
	return PLUGIN_CONTINUE
}

public task_ActivateFlamethrower(id) 
{
	if(!is_user_connected(id) || !is_user_alive(id))
		return PLUGIN_CONTINUE
		
	if(zp_get_user_zombie(id))
	{
		Event_WeaponDrop(id)
		return PLUGIN_CONTINUE
	}
	
	new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1])
	if(weaponID == CSW_KNIFE) g_Activated[id] = 1
		
	return PLUGIN_CONTINUE
}

public show_fuel_percentage(id)
{
	set_hudmessage(255, 170, 0, 0.91, 0.95, _, _, 1.0, _, _, 4)
	show_hudmessage(id, "Fuel Tank: %d%%", get_percent(g_FuelTank[id], get_pcvar_num(g_fueltank)))
}

public set_flamethrower_model(id)
{
	entity_set_string(id, EV_SZ_viewmodel, "models/v_flamethrower.mdl")
	entity_set_string(id, EV_SZ_weaponmodel, "models/p_flamethrower.mdl")
}

public set_knife_model(id)
{
	entity_set_string(id, EV_SZ_viewmodel, "models/v_knife.mdl")
	entity_set_string(id, EV_SZ_weaponmodel, "models/p_knife.mdl")	
}

public set_shield_model(id)
{
	entity_set_string(id, EV_SZ_viewmodel, "models/shield/v_shield_knife.mdl")
	entity_set_string(id, EV_SZ_weaponmodel, "models/shield/p_shield_knife.mdl")
}

stock damage_user(id, victim, damage)
{
	new iHealth = get_user_health(victim)
	if(iHealth > damage) 
		fakedamage(victim, "weapon_flamethrower", float(damage), DMG_BURN)
	else
	{
		user_silentkill(victim)
		make_deathmsg(id, victim, 0, "flamethrower")
		
		new iOrigin[3]
		get_user_origin(victim, iOrigin, 0)
		
		message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
		write_byte(17)
		write_coord(iOrigin[0])
		write_coord(iOrigin[1])
		write_coord(iOrigin[2] + 10)
		write_short(sprite_burn)
		write_byte(30)
		write_byte(40)
		message_end()
			
		if(get_user_team(id) != zp_get_user_zombie(victim))
		{
			fm_set_user_frags(id, get_user_frags(id) + get_pcvar_num(g_frags_after_kill))
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + get_pcvar_num(g_ammo_packs_after_kill))
		}
		
		message_begin(MSG_ALL, get_user_msgid("ScoreInfo")) 
		write_byte(id) 
		write_short(get_user_frags(id)) 
		write_short(get_user_deaths(id)) 
		write_short(0) 
		write_short(get_user_team(id)) 
		message_end() 
		
		message_begin(MSG_ALL, get_user_msgid("ScoreInfo")) 
		write_byte(victim) 
		write_short(get_user_frags(victim))
		write_short(get_user_deaths(victim))
		write_short(0)
		write_short(get_user_team(victim))
		message_end()
	}
}

stock get_percent(value, tvalue) 
{       
	return floatround(floatmul(float(value) / float(tvalue) , 100.0))  
}

stock get_distance_to_line(Float:pos_start[3], Float:pos_end[3], Float:pos_object[3])  
{  
	new Float:vec_start_end[3], Float:vec_start_object[3], Float:vec_end_object[3], Float:vec_end_start[3]
	xs_vec_sub(pos_end, pos_start, vec_start_end) 		// vector from start to end 
	xs_vec_sub(pos_object, pos_start, vec_start_object) 	// vector from end to object 
	xs_vec_sub(pos_start, pos_end, vec_end_start) 		// vector from end to start 
	xs_vec_sub(pos_end, pos_object, vec_end_object) 		// vector object to end 
	
	new Float:len_start_object = getVecLen(vec_start_object) 
	new Float:angle_start = floatacos(xs_vec_dot(vec_start_end, vec_start_object) / (getVecLen(vec_start_end) * len_start_object), degrees)  
	new Float:angle_end = floatacos(xs_vec_dot(vec_end_start, vec_end_object) / (getVecLen(vec_end_start) * getVecLen(vec_end_object)), degrees)  

	if(angle_start <= 90.0 && angle_end <= 90.0) 
		return floatround(len_start_object * floatsin(angle_start, degrees)) 
	return -1  
}

stock Float:getVecLen(Float:Vec[3])
{ 
	new Float:VecNull[3] = {0.0, 0.0, 0.0}
	new Float:len = get_distance_f(Vec, VecNull)
	return len
}

stock bool:fm_is_ent_visible(index, entity) 
{
	new Float:origin[3], Float:view_ofs[3], Float:eyespos[3]
	pev(index, pev_origin, origin)
	pev(index, pev_view_ofs, view_ofs)
	xs_vec_add(origin, view_ofs, eyespos)

	new Float:entpos[3]
	pev(entity, pev_origin, entpos)
	engfunc(EngFunc_TraceLine, eyespos, entpos, 0, index)

	switch(pev(entity, pev_solid)) 
	{
		case SOLID_BBOX..SOLID_BSP: return global_get(glb_trace_ent) == entity
	}
	
	new Float:fraction
	global_get(glb_trace_fraction, fraction)
	if(fraction == 1.0)
		return true
		
	return false
}

stock bool:has_shield(id)
{
	new modelName[32]
	entity_get_string(id, EV_SZ_viewmodel, modelName, 31)

	if(containi(modelName, "v_shield_") != -1)
		return true
		
	return false
}

stock fm_set_user_frags(index, frags) 
{
	set_pev(index, pev_frags, float(frags))

	return 1
}


Zapomniałem dodać :

(id, level, cid)

	if (!cmd_access(id, level, cid, 3))
		return PLUGIN_HANDLED

  • +
  • -
  • 0

#6 ...

    Wszechmogący

  • Zbanowany

Reputacja: 166
Profesjonalista

  • Postów:612
  • Lokalizacja:Jasło
Offline

Napisano 29.08.2009 19:34

omg nie za duzo tego tekstu :D ?

robisz to po prostu tak:
if(get_user_flags(id) & ADMIN_***){
// moze wykonac
}


#7 assasinos

    Życzliwy

  • Autor tematu
  • Użytkownik

Reputacja: 0
zer0.

  • Postów:21
Offline

Napisano 30.08.2009 08:21

kyku, dzięki - pomogło ! :D

Tylko czy tego można użyć w każdym pluginie? Jak tak, to czy mam to wstawiać przy każdej funkcji, czy mogę "zamknąć" tym wszystkie na raz?

#edit
Jednak jest to półśrodek, bo w menu kupowania dodatkowych itemów w ZP można to kupić normalnie i edycja pluginu poszła w piach :<
  • +
  • -
  • 0




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

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