Biohazard SHOP [ Adaugare extra iteme usor ]

Pluginuri pentru modul AmxModX.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Gabriel eXtream
Membru, skill +2
Membru, skill +2
Posts: 953
Joined: 20 Aug 2012, 16:43
Detinator Steam: Da
CS Status: Can't be touched
Reputatie: Fost Moderator ajutator
Nume anterior: BlueSky#, EcHoO.
0.3 / 3
Utilizator neserios ( tepar )
Fond eXtream: 0
Location: Bucuresti
Has thanked: 67 times
Been thanked: 125 times

01 Apr 2014, 18:24

Descriere: Acesta este un shop pentru modul biohazard cu ajutorul caruia se pot adauga Extra Iteme

Descarcare: Aveti sursele mai jos
Nume: Bio SHOP
Versiune: 1.0
Versiune: Dias
Link oficial: ExtreamCS

Instalare:
1. Fisierul bio_shop.sma il puneti in addons/amxmodx/scripting
2. Fisierul bio_shop.amxx il puneti in addons/amxmodx/plugins
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:

Code: Select all

bio_shop.amxx
..


Comenzi administrative (se tasteaza in consola si trebuie sa fiti administrator):
/shop - Accesati shop-il



Module necesare (se sterge ; din fata modulului de mai jos; acestea le gasiti in fisierul amxmodx\configs\modules.ini):
- CStrike
Bio_Shop.sma | Afiseaza codul
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <biohazard>

#define PLUGIN "[Bio] Addon: Shop"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define TEAM_ZOMBIE 1
#define TEAM_HUMAN 2

new g_item
new Array:Item_Name, Array:Item_Cost, Array:Item_Desc, Array:Item_Team
new g_selected_forward

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("say /shop", "open_menu_shop")
	
	g_selected_forward = CreateMultiForward("bio_item_selected", ET_IGNORE, FP_CELL, FP_CELL)
}

public plugin_natives()
{
	register_native("bio_register_item", "native_register_item", 1)
	register_native("bio_open_shop", "open_menu_shop", 1)
}

public plugin_precache()
{
	Item_Name = ArrayCreate(64, 1)
	Item_Cost = ArrayCreate(1, 1)
	Item_Desc = ArrayCreate(64, 1)
	Item_Team = ArrayCreate(1, 1)
}

public open_menu_shop(id)
{
	if(!is_user_alive(id))
	{
		client_printc(id, "!g[Biohazard]!n Esti !tmort!n. Nu poti cumpara !tNimic!n !!!")
		return PLUGIN_HANDLED
	}
	
	if(g_item == 0)
	{
		client_printc(id, "!g[Biohazard]!n Comanda a fost dezactivata!!!")
		return PLUGIN_HANDLED		
	}
	
	static temp_menu[64]
	static menu, temp_string1[33], temp_integer1, temp_string2[33], temp_string3[5]
	
	if(!is_user_zombie(id))
	{
		menu = menu_create("Biohazard Shop:", "menu1_handle_human")
		
		for(new i = 0; i < g_item; i++)
		{
			if(ArrayGetCell(Item_Team, i) == TEAM_HUMAN)
			{
				ArrayGetString(Item_Name, i, temp_string1, sizeof(temp_string1))
				temp_integer1 = ArrayGetCell(Item_Cost, i)
				ArrayGetString(Item_Desc, i, temp_string2, sizeof(temp_string2))
				
				formatex(temp_menu, sizeof(temp_menu), "%s \r%i \y%s", temp_string1, temp_integer1, temp_string2)
				
				num_to_str(i, temp_string3, sizeof(temp_string3))
				menu_additem(menu, temp_menu, temp_string3)
			}
		}
		
		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
		menu_display(id, menu, 0)	
		
	} else {
		menu = menu_create("Biohazard Shop:", "menu1_handle_zombie")
		
		for(new i = 0; i < g_item; i++)
		{
			if(ArrayGetCell(Item_Team, i) == TEAM_ZOMBIE) 
			{
				ArrayGetString(Item_Name, i, temp_string1, sizeof(temp_string1))
				temp_integer1 = ArrayGetCell(Item_Cost, i)
				ArrayGetString(Item_Desc, i, temp_string2, sizeof(temp_string2))
				
				formatex(temp_menu, sizeof(temp_menu), "%s \r%i \y%s", temp_string1, temp_integer1, temp_string2)
				
				num_to_str(i, temp_string3, sizeof(temp_string3))
				menu_additem(menu, temp_menu, temp_string3)			
			}
		}
		
		menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
		menu_display(id, menu, 0)	
	}
	
	return PLUGIN_CONTINUE
}

public menu1_handle_human(id, menu, item)
{
	if(item == MENU_EXIT || is_user_zombie(id))
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static data[6], szName[64], access, callback
	static temp_integer1
	menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
	
	temp_integer1 = str_to_num(data)
	
	static cost, wp_name[64], wp_desc[64]
	cost = ArrayGetCell(Item_Cost, temp_integer1)
	ArrayGetString(Item_Name, temp_integer1, wp_name, sizeof(wp_name))
	ArrayGetString(Item_Desc, temp_integer1, wp_desc, sizeof(wp_desc))
	
	if(cs_get_user_money(id) >= cost)
	{
		client_printc(id, "!g[Bio Shop]!n Ai cumparat: !t%s!n care a costat !t%i$!n !!!", wp_name, cost)
		client_printc(id, "!g[Bio Shop]!n !t%s!n !!!", wp_desc)
		
		cs_set_user_money(id, cs_get_user_money(id) - cost)
		
		static g_dummy
		ExecuteForward(g_selected_forward, g_dummy, id, temp_integer1)
	} else {
		client_printc(id, "!g[Bio Shop]!n Nu ai suficenti bani pentru a cumpara: !t%s!n. Bani necesari: !t%i$!n !!!", wp_name, cost)
	}
		
	return PLUGIN_CONTINUE
}

public menu1_handle_zombie(id, menu, item)
{
	if(item == MENU_EXIT || !is_user_zombie(id))
	{
		menu_destroy(menu)
		return PLUGIN_HANDLED
	}
	
	static data[6], szName[64], access, callback
	static temp_integer1
	menu_item_getinfo(menu, item, access, data, charsmax(data), szName, charsmax(szName), callback)
	
	temp_integer1 = str_to_num(data)
	
	static cost, name[32], desc[32]
	cost = ArrayGetCell(Item_Cost, temp_integer1)
	ArrayGetString(Item_Name, temp_integer1, name, sizeof(name))
	ArrayGetString(Item_Desc, temp_integer1, desc, sizeof(desc))

	if(cs_get_user_money(id) >= cost)
	{
		client_printc(id, "!g[Bio Shop]!n Ai cumparat !t%s!n care costa !t%i$!n !!!", name, cost)
		client_printc(id, "!g[Bio Shop]!n !t%s!n !!!", desc)
		
		cs_set_user_money(id, cs_get_user_money(id) - cost)
		
		static g_dummy
		ExecuteForward(g_selected_forward, g_dummy, id, temp_integer1)
	} else {
		client_printc(id, "!g[Bio Shop]!n Nu ai suficenti bani pentru a cumpara : !t%s!n. Costa:!t%i$!n !!!", name, cost)
	}
		
	return PLUGIN_CONTINUE	
}

public native_register_item(const item_name[], const item_cost, const item_desc[], const item_team)
{
	param_convert(1)
	param_convert(3)
	
	ArrayPushString(Item_Name, item_name)
	ArrayPushCell(Item_Cost, item_cost)
	ArrayPushString(Item_Desc, item_desc)
	ArrayPushCell(Item_Team, item_team)
	
	g_item++
	
	return g_item - 1
}

client_printc(index, const text[], any:...)
{
	new szMsg[128];
	vformat(szMsg, sizeof(szMsg) - 1, text, 3);

	replace_all(szMsg, sizeof(szMsg) - 1, "!g", "^x04");
	replace_all(szMsg, sizeof(szMsg) - 1, "!n", "^x01");
	replace_all(szMsg, sizeof(szMsg) - 1, "!t", "^x03");

	message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, index);
	write_byte(index);
	write_string(szMsg);
	message_end();
}
bio_shop.inc | Afiseaza codul
#define TEAM_ZOMBIE 1
#define TEAM_HUMAN 2

// Natives
native bio_register_item(const item_name[], const item_cost, const item_desc[], const item_team)
native bio_open_shop(id)

// Forwards
forward bio_item_selected(id, item)


Si ca bonus cateva extra iteme

DeadlyShot Humans Only - All damage to head | Afiseaza codul
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <biohazard>
#include <bio_shop>
#include <cstrike>

#define TASK_HUD 5345634
#define TASK_REMOVE 2423423

new bool:has_item[33]
new bool:using_item[33]

new sync_hud1
new cvar_deadlyshot_cost
new cvar_deadlyshot_time

new g_deadlyshot

public plugin_init()
{
	register_plugin("[Bio] Extra Item: Deadly Shot (Human)", "1.0", "Dias")
	
	register_event("HLTV", "event_newround", "a", "1=0", "2=0")
	RegisterHam(Ham_TraceAttack, "player", "fw_traceattack")
	
	cvar_deadlyshot_cost = register_cvar("bh_ds_cost", "15000")
	cvar_deadlyshot_time = register_cvar("bh_ds_time", "10.0")
	
	sync_hud1 = CreateHudSyncObj(random_num(1, 10))
	g_deadlyshot = bio_register_item("Deadly Shot", get_pcvar_num(cvar_deadlyshot_cost), "Only HeadShot", TEAM_HUMAN)
}

public event_newround(id)
{
	remove_ds(id)
}

public bio_item_selected(id, itemid)
{
	if(itemid != g_deadlyshot)
		return PLUGIN_HANDLED
		
	if(!has_item[id] || using_item[id])
	{
		has_item[id] = true
		using_item[id] = false
		
		set_task(0.1, "show_hud", id+TASK_HUD, _, _, "b")
	} else {
		color_saytext(id, "!g[Bio]!y You can't buy !rDeadly Shot!y at this time...")
		cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(cvar_deadlyshot_cost))
	}
	
	return PLUGIN_CONTINUE
}

public event_infect(id)
{
	remove_ds(id)
}

public show_hud(id)
{
	id -= TASK_HUD

	set_hudmessage(0, 255, 0, -1.0, 0.88, 0, 2.0, 1.0)	
	
	if(has_item[id])
	{
		ShowSyncHudMsg(id, sync_hud1, "[E] -> Active Deadly Shot")
	} else if(using_item[id]) {
		ShowSyncHudMsg(id, sync_hud1, "Deadly Shot - Actived")		
	} else {
		set_hudmessage(0, 255, 0, -1.0, 0.88, 0, 2.0, 5.0)
		ShowSyncHudMsg(id, sync_hud1, "Deadly Shot - Disable")
		if(task_exists(id+TASK_HUD)) remove_task(id+TASK_HUD)
	}
}

public client_PostThink(id)
{
	static Button
	Button = get_user_button(id)
	
	if(Button & IN_USE)
	{
		if(has_item[id] && !using_item[id])
		{
			has_item[id] = false
			using_item[id] = true
			
			set_task(get_pcvar_float(cvar_deadlyshot_time), "remove_headshot_mode", id+TASK_REMOVE)
		}
	}
}

public fw_traceattack(victim, attacker, Float:damage, direction[3], traceresult, dmgbits)
{
	if(using_item[attacker])
	{
		set_tr2(traceresult, TR_iHitgroup, HIT_HEAD)
	}
}

public remove_ds(id)
{
	if(has_item[id] || using_item[id])
	{
		has_item[id] = false
		using_item[id] = false		
		
		if(task_exists(id+TASK_HUD)) remove_task(id+TASK_HUD)
		if(task_exists(id+TASK_REMOVE)) remove_task(id+TASK_REMOVE)
	}	
}

public remove_headshot_mode(id)
{
	id -= TASK_REMOVE
	
	has_item[id] = false
	using_item[id] = false
	
	if(task_exists(id+TASK_HUD)) remove_task(id+TASK_HUD)
	
	set_hudmessage(0, 255, 0, -1.0, 0.88, 0, 2.0, 5.0)
	ShowSyncHudMsg(id, sync_hud1, "Deadly Shot - Disable")	
}

color_saytext(player, const message[], any:...)
{
	new text[301]
	format(text, 300, "%s", message)

	new dest
	if (player) dest = MSG_ONE
	else dest = MSG_ALL
	
	message_begin(dest, get_user_msgid("SayText"), {0,0,0}, player)
	write_byte(1)
	write_string(check_text(text))
	return message_end()
}

check_text(text1[])
{
	new text[301]
	format(text, 300, "%s", text1)
	replace(text, 300, "!g", "^x04")
	replace(text, 300, "!r", "^x03")
	replace(text, 300, "!y", "^x01")
	return text
}
Bio HAmmer - Humans Only | Afiseaza codul
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <biohazard>
#include <bio_shop>

#define PLUGIN "[Bio] Shop: Hammer"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define is_user_valid_connected(%1) (1 <= %1 <= get_maxplayers() && is_user_connected(%1))

new const v_model[] = "models/biohazard/v_hammer.mdl"
new const p_model[] = "models/biohazard/p_hammer.mdl"

new bool:had_hammer[33]
new g_attacking[33]

new g_hammer

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "fw_hammer_deploy")
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_hammer_pri_attack")
	RegisterHam(Ham_TakeDamage, "player", "fw_hammer_takedmg")
	RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_SecondaryAttack")
	RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_SecondaryAttack_Post", 1)	
	RegisterHam(Ham_Spawn, "player", "fw_spawn_post", 1)
	
	register_forward(FM_TraceLine, "fw_TraceLine")
	register_forward(FM_TraceHull, "fw_TraceHull")	
	
	register_event("CurWeapon", "event_curweapon", "be", "1=1")
	register_clcmd("lastinv", "check_lastinv")
	
	g_hammer = bio_register_item("Hammer", 9500, "Attack far enemy and x5 dmg", TEAM_HUMAN)
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheModel, v_model)
	engfunc(EngFunc_PrecacheModel, p_model)
}

public bio_item_selected(id, item)
{
	if(item == g_hammer)
	{
		had_hammer[id] = true
		engclient_cmd(id, "weapon_knife")
	}
}

public fw_spawn_post(id)
{
	had_hammer[id] = false
}

public event_infect(id)
{
	had_hammer[id] = false
}

public fw_hammer_deploy(ent)
{
	static id
	id = pev(ent, pev_owner)
	
	if(is_user_alive(id) && had_hammer[id])
		play_weapon_anim(id, 1)
}

public check_lastinv(id)
{
	if(get_user_weapon(id) == CSW_KNIFE && had_hammer[id])
		play_weapon_anim(id, 1)
}

public event_curweapon(id)
{
	if(!is_user_alive(id) || get_user_weapon(id) != CSW_KNIFE)
		return PLUGIN_HANDLED
		
	if(is_user_zombie(id))
		return PLUGIN_HANDLED
	
	if(!had_hammer[id])
		return PLUGIN_HANDLED
	
	set_pev(id, pev_viewmodel2, v_model)
	set_pev(id, pev_weaponmodel2, p_model)
	
	return PLUGIN_CONTINUE
}

public fw_hammer_pri_attack(ent)
{
	if(!pev_valid(ent))
		return HAM_IGNORED
	
	static id
	id = pev(ent, pev_owner)
	
	if(!had_hammer[id])
		return HAM_IGNORED
	
	play_weapon_anim(id, 0)
	
	return HAM_SUPERCEDE
}

public fw_hammer_takedmg(victim, inflictor, attacker, Float:damage, damagebits)
{
	if(!is_user_alive(victim) || !is_user_alive(attacker))
		return HAM_IGNORED
		
	if(!is_user_zombie(victim))
		return HAM_IGNORED
		
	if(!had_hammer[attacker])
		return HAM_IGNORED
		
	SetHamParamFloat(4, damage * 5.0)
	
	return HAM_HANDLED
}

public fw_SecondaryAttack(weapon_ent)
{
	// Not valid
	if (!pev_valid(weapon_ent))
		return;
	
	// Get owner
	static owner
	owner = pev(weapon_ent, pev_owner)
	
	// Replace these for zombie only
	if (!is_user_valid_connected(owner))
		return;
	
	g_attacking[owner] = 2
}

public fw_SecondaryAttack_Post(weapon_ent)
{
	// Not valid
	if (!pev_valid(weapon_ent))
		return;
	
	// Get owner
	static owner
	owner = pev(weapon_ent, pev_owner)
	
	// Replace these for zombie only
	if (!is_user_valid_connected(owner))
		return;
	
	g_attacking[owner] = 0
}

public fw_TraceLine(Float:vector_start[3], Float:vector_end[3], ignored_monster, id, handle)
{
	// Replace these for zombie only
	if (!is_user_valid_connected(id))
		return FMRES_IGNORED;
	
	// Not alive
	if (!is_user_alive(id))
		return FMRES_IGNORED;
	
	// Not using knife
	if (get_user_weapon(id) != CSW_KNIFE)
		return FMRES_IGNORED;
		
	if(!had_hammer[id])
		return FMRES_IGNORED		
	
	// Not attacking
	if (!g_attacking[id])
		return FMRES_IGNORED;
	
	pev(id, pev_v_angle, vector_end)
	angle_vector(vector_end, ANGLEVECTOR_FORWARD, vector_end)
	
	if (g_attacking[id] == 1)
		xs_vec_mul_scalar(vector_end, 70.0, vector_end)
	else
		xs_vec_mul_scalar(vector_end, 85.0, vector_end)
	
	xs_vec_add(vector_start, vector_end, vector_end)
	engfunc(EngFunc_TraceLine, vector_start, vector_end, ignored_monster, id, handle)
	
	return FMRES_SUPERCEDE;
}

public fw_TraceHull(Float:vector_start[3], Float:vector_end[3], ignored_monster, hull, id, handle)
{
	// Replace these for zombie only
	if (!is_user_valid_connected(id))
		return FMRES_IGNORED;
	
	// Not alive
	if (!is_user_alive(id))
		return FMRES_IGNORED;
	
	// Not using knife
	if (get_user_weapon(id) != CSW_KNIFE)
		return FMRES_IGNORED;
		
	if(!had_hammer[id])
		return FMRES_IGNORED
	
	// Not attacking
	if (!g_attacking[id])
		return FMRES_IGNORED;
	
	pev(id, pev_v_angle, vector_end)
	angle_vector(vector_end, ANGLEVECTOR_FORWARD, vector_end)
	
	if (g_attacking[id] == 1)
		xs_vec_mul_scalar(vector_end, 70.0, vector_end)
	else
		xs_vec_mul_scalar(vector_end, 85.0, vector_end)
	
	xs_vec_add(vector_start, vector_end, vector_end)
	engfunc(EngFunc_TraceHull, vector_start, vector_end, ignored_monster, hull, id, handle)
	
	return FMRES_SUPERCEDE;
}

stock play_weapon_anim(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()
}
Knock Back Grenade - Zombies | Afiseaza codul
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <biohazard>
#include <bio_shop>

#define PLUGIN "[Bio] Extra Item: Jump Bomb"
#define VERSION "1.0"
#define AUTHOR "Dias"

#define PEV_NADE_TYPE pev_flTimeStepSound
#define NADE_TYPE_KNOCK 1111

new g_jump_bomb
new g_has_jump_bomb[33]
new g_knockbomb_spr_id

new const knockbomb_sound_exp[] = "bio9/zombi_bomb_exp.wav"
new const knockbomb_spr_exp[] = "sprites/bio9/zombiebomb_exp.spr"

new const v_model[] = "models/bio9/v_zombibomb.mdl"
new const p_model[] = "models/bio9/p_zombibomb.mdl"
new const w_model[] = "models/bio9/w_zombibomb.mdl"

new cvar_radius, cvar_power

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")
	register_forward(FM_SetModel, "fw_SetModel")
	register_event("DeathMsg", "event_death", "a")
	register_event("CurWeapon", "event_weapon", "be", "1=1")
	
	cvar_radius = register_cvar("bh_knockbomb_radius", "250.0")
	cvar_power = register_cvar("bh_knockbomb_power", "100.0")
	
	g_jump_bomb = bio_register_item("Jump Bomb", 3500, "Make Human KnockBack", TEAM_ZOMBIE)
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheSound, knockbomb_sound_exp)
	
	engfunc(EngFunc_PrecacheModel, v_model)
	engfunc(EngFunc_PrecacheModel, p_model)
	engfunc(EngFunc_PrecacheModel, w_model)
	
	g_knockbomb_spr_id = engfunc(EngFunc_PrecacheModel, knockbomb_spr_exp)
}

public bio_item_selected(id, item)
{
	if(item != g_jump_bomb)
		return PLUGIN_HANDLED
		
	g_has_jump_bomb[id] = true
	fm_give_item(id, "weapon_hegrenade")
	
	return PLUGIN_CONTINUE
}

public event_weapon(id)
{
	static curweapon
	curweapon = get_user_weapon(id)
	
	if (is_user_zombie(id) && curweapon)
	{
		// set model zonbie bom
		if (g_has_jump_bomb[id] && curweapon == CSW_HEGRENADE)
		{
			set_pev(id, pev_viewmodel2, v_model)
			set_pev(id, pev_weaponmodel2, p_model)
		}
	}
}

public fw_SetModel(entity, const model[])
{
	// check valid ent
	if (!is_valid_ent(entity)) return FMRES_IGNORED

	// We don't care
	if (strlen(model) < 8) return FMRES_IGNORED;

// ######## Zombie Bomb
	// Get damage time of grenade
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	// Grenade not yet thrown
	if (dmgtime == 0.0)
		return FMRES_IGNORED;
	
	// Get attacker
	static attacker
	attacker = pev(entity, pev_owner)
	
	if(!g_has_jump_bomb[attacker])
		return FMRES_IGNORED
	
	// Get whether grenade's owner is a zombie
	if (is_user_zombie(attacker))
	{
		if (model[9] == 'h' && model[10] == 'e') // Zombie Bomb
		{
			// Set grenade type on the thrown grenade entity
			set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_KNOCK)
			engfunc(EngFunc_SetModel, entity, w_model)
		
			return FMRES_SUPERCEDE
		}
	}

	return FMRES_IGNORED
}

public event_death()
{
	static victim
	victim = read_data(2)
	
	if(g_has_jump_bomb[victim])
		g_has_jump_bomb[victim] = false
}

public fw_ThinkGrenade(entity)
{
	// Invalid entity
	if (!pev_valid(entity)) return FMRES_IGNORED;
	
	// Get damage time of grenade
	static Float:dmgtime
	pev(entity, pev_dmgtime, dmgtime)
	
	// Check if it's time to go off
	if (dmgtime > get_gametime())
		return HAM_IGNORED;
		
	static owner
	owner = pev(entity, pev_owner)
	
	if(!g_has_jump_bomb[owner])
		return HAM_IGNORED
	
	// Check if it's one of our custom nades
	switch (pev(entity, PEV_NADE_TYPE))
	{
		case NADE_TYPE_KNOCK:
		{
			knockbomb_explode(entity)
		}
		default: return HAM_IGNORED;
	}
	
	return HAM_SUPERCEDE;
}

public knockbomb_explode(ent)
{
	// Get origin
	static Float:originF[3]
	pev(ent, pev_origin, originF)
	
	// Make the explosion
	EffectZombieBomExp(ent)
	
	// explode sound
	engfunc(EngFunc_EmitSound, ent, CHAN_WEAPON, knockbomb_sound_exp, 1.0, ATTN_NORM, 0, PITCH_NORM)
	
	// Get attacker
	static attacker
	attacker = pev(ent, pev_owner)
	
	// Collisions
	static victim
	victim = -1
	
	new Float:fOrigin[3],Float:fDistance,Float:fDamage
	while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, get_pcvar_float(cvar_radius))) != 0)
	{
		// Only effect alive non-spawnprotected humans
		if (!is_user_alive(victim))
			continue;
		
		// get value
		pev(victim, pev_origin, fOrigin)
		fDistance = get_distance_f(fOrigin, originF)
		fDamage = get_pcvar_float(cvar_power) - floatmul(get_pcvar_float(cvar_power), floatdiv(fDistance, get_pcvar_float(cvar_radius)))//get the damage value
		fDamage *= estimate_take_hurt(originF, victim, 0)//adjust
		if ( fDamage < 0 )
			continue

		// create effect
		manage_effect_action(victim, fOrigin, originF, fDistance, fDamage * 35.0)
		ExecuteHam(Ham_TakeDamage, victim, attacker, attacker, 0, DMG_BULLET)
	}
	
	g_has_jump_bomb[attacker] = false
	
	// Get rid of the grenade
	engfunc(EngFunc_RemoveEntity, ent)
}
public EffectZombieBomExp(id)
{
	static Float:origin[3];
	pev(id,pev_origin,origin);
    
	message_begin(MSG_BROADCAST,SVC_TEMPENTITY); 
	write_byte(TE_EXPLOSION); // TE_EXPLOSION
	write_coord(floatround(origin[0])); // origin x
	write_coord(floatround(origin[1])); // origin y
	write_coord(floatround(origin[2])); // origin z
	write_short(g_knockbomb_spr_id); // sprites
	write_byte(40); // scale in 0.1's
	write_byte(30); // framerate
	write_byte(14); // flags 
	message_end(); // message end
}
public manage_effect_action(iEnt, Float:fEntOrigin[3], Float:fPoint[3], Float:fDistance, Float:fDamage)
{
	//return 1
	new Float:Velocity[3]
	pev(iEnt, pev_velocity, Velocity)
	
	new Float:fTime = floatdiv(fDistance, fDamage)
	new Float:fVelocity[3]
	fVelocity[0] = floatdiv((fEntOrigin[0] - fPoint[0]), fTime)
	fVelocity[1] = floatdiv((fEntOrigin[1] - fPoint[1]), fTime)
	fVelocity[2] = floatdiv((fEntOrigin[2] - fPoint[2]), fTime)
	set_pev(iEnt, pev_velocity, fVelocity)
	return 1
}

stock fm_give_item(id, const item[])
{
	static ent
	ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
	if (!pev_valid(ent)) return;
	
	static Float:originF[3]
	pev(id, pev_origin, originF)
	set_pev(ent, pev_origin, originF)
	set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
	dllfunc(DLLFunc_Spawn, ent)
	
	static save
	save = pev(ent, pev_solid)
	dllfunc(DLLFunc_Touch, ent, id)
	if (pev(ent, pev_solid) != save)
		return;
	
	engfunc(EngFunc_RemoveEntity, ent)
}

stock Float:estimate_take_hurt(Float:fPoint[3], ent, ignored) 
{
	new Float:fOrigin[3]
	new tr
	new Float:fFraction
	pev(ent, pev_origin, fOrigin)
	//UTIL_TraceLine ( vecSpot, vecSpot + Vector ( 0, 0, -40 ),  ignore_monsters, ENT(pev), & tr)
	engfunc(EngFunc_TraceLine, fPoint, fOrigin, DONT_IGNORE_MONSTERS, ignored, tr)
	get_tr2(tr, TR_flFraction, fFraction)
	if ( fFraction == 1.0 || get_tr2( tr, TR_pHit ) == ent )//no valid enity between the explode point & player
		return 1.0
	return 0.6//if has fraise, lessen blast hurt
}

Puteti sa va faceti si voi Extra iteme usor

Code: Select all

native bio_register_item(const item_name[], const item_cost, const item_desc[], const item_team)
RoyalServer
User avatar
YONTU
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2466
Joined: 10 May 2013, 14:25
Detinator Steam: Nu
CS Status: Everyone is looking at ur shoes
Reputatie: Moderator ajutator
Fost scripter eXtreamCS
Location: Gura Humorului
Has thanked: 256 times
Been thanked: 288 times
Contact:

01 Apr 2014, 18:27

Bat pariu ca intr-o saptamana o sa fie vreo 10 servere de biohazard pe extream :)) !
Nu trebuia...
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș


Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114

Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
User avatar
ARTUR.HAZ
Administrator
Administrator
Posts: 7652
Joined: 04 Oct 2013, 14:32
Detinator Steam: Da
Reputatie: Administrator
Has thanked: 146 times
Been thanked: 123 times
Contact:

05 Apr 2014, 08:37

Frumos plugin-ul.
Felicitari.
User avatar
CryWolf
Administrator
Administrator
Posts: 6505
Joined: 07 Aug 2008, 16:33
Detinator Steam: Da
Reputatie: Administrator
Fost Scripter
Manager CS2.eXtream.Ro
Fost Detinator ZM.eXtream.Ro
Fost manager CS.eXtream.Ro
Fost manager CSGO.eXtream.Ro
Fost manager global
Location: Botosani
Discord: crywolf1989
Has thanked: 202 times
Been thanked: 850 times
Contact:

05 Apr 2014, 09:09

multumiri, ma bucur ca nu sa uitat in totalitate acest mod, deoarece a fost si este unul dintre cele mai frumoase daca stie cine sa faca serverul.
NU IMI MAI DA-TI PM CU CERERE AJUTOR/SAMD, FOLOSITI FORUMUL, CITESC MAJORITATEA TOPICURILOR.
www.dark-arena.com , SERVERE CS / CS2 / L4D AU REVENIT ONLINE.
www.diasporaiptv.ro - SERVICII PREMIUM IPTV

Image

Image
User avatar
Gabriel eXtream
Membru, skill +2
Membru, skill +2
Posts: 953
Joined: 20 Aug 2012, 16:43
Detinator Steam: Da
CS Status: Can't be touched
Reputatie: Fost Moderator ajutator
Nume anterior: BlueSky#, EcHoO.
0.3 / 3
Utilizator neserios ( tepar )
Fond eXtream: 0
Location: Bucuresti
Has thanked: 67 times
Been thanked: 125 times

05 Apr 2014, 10:57

Niklaus wrote:multumiri, ma bucur ca nu sa uitat in totalitate acest mod, deoarece a fost si este unul dintre cele mai frumoase daca stie cine sa faca serverul.
Asa este, ma jucam prin 2009-2010 ( daca nu ma inseala memoria ) pe un server de biohazard, cred ca era singurul in ROMANIA, era foarte populat, acest mod este cel mai placut pentru mine, vroiam sa-mi deschid server dar mi-am dat seama ca nu castig nimic din asta, fiind atatea servere si toate full de bind-uri.
User avatar
S3ekEr^
Utilizator neserios (tepar)
Utilizator neserios (tepar)
Posts: 3475
Joined: 06 Dec 2009, 12:47
Detinator Steam: Nu
Reputatie: Nume anterior: The Seeker , Reptyle
Fost Scripter
Fost super moderator
Utilizator neserios ( tepar )
Has thanked: 117 times
Been thanked: 329 times

06 Apr 2014, 11:13

EcHoO. wrote:
Niklaus wrote:multumiri, ma bucur ca nu sa uitat in totalitate acest mod, deoarece a fost si este unul dintre cele mai frumoase daca stie cine sa faca serverul.
Asa este, ma jucam prin 2009-2010 ( daca nu ma inseala memoria ) pe un server de biohazard, cred ca era singurul in ROMANIA, era foarte populat, acest mod este cel mai placut pentru mine, vroiam sa-mi deschid server dar mi-am dat seama ca nu castig nimic din asta, fiind atatea servere si toate full de bind-uri.
Exact :))
cTm # Like
Membru, skill 0
Membru, skill 0
Posts: 47
Joined: 04 Sep 2014, 18:12
Detinator Steam: Da
Fond eXtream: 0
Contact:

11 Sep 2014, 18:35

cum activez shopul? :)
YONTU # eXtreamCS
Membru, skill 0
Membru, skill 0
Posts: 36
Joined: 31 Aug 2014, 19:13
Detinator Steam: Nu
CS Status: Vreau sa fii cel mai bun dintre cei buni
Fond eXtream: 0
Contact:

12 Sep 2014, 10:36

cTm # Like wrote:cum activez shopul? :)
LOL, de ce iti mai faci server daca nu stii minimul necesar :-q !

Scrii in chat /shop ! @-)
cTm # Like
Membru, skill 0
Membru, skill 0
Posts: 47
Joined: 04 Sep 2014, 18:12
Detinator Steam: Da
Fond eXtream: 0
Contact:

12 Sep 2014, 13:21

=)) i trebuie nite cvauri si nu le am :| zice shopul este dezactivat :| inteligentule
User avatar
Gabriel eXtream
Membru, skill +2
Membru, skill +2
Posts: 953
Joined: 20 Aug 2012, 16:43
Detinator Steam: Da
CS Status: Can't be touched
Reputatie: Fost Moderator ajutator
Nume anterior: BlueSky#, EcHoO.
0.3 / 3
Utilizator neserios ( tepar )
Fond eXtream: 0
Location: Bucuresti
Has thanked: 67 times
Been thanked: 125 times

16 Sep 2014, 23:15

cTm # Like wrote:=)) i trebuie nite cvauri si nu le am :| zice shopul este dezactivat :| inteligentule
Trebuie sa ai macar 1 extra item
Post Reply

Return to “AmxModX”

  • Information
  • Who is online

    Users browsing this forum: Bing [Bot], Yandex [Bot] and 11 guests