Raised This Month: $ Target: $400
 0% 

[ZP] Delete 2 things


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
strangeguy
Senior Member
Join Date: Mar 2019
Old 12-27-2019 , 08:01   [ZP] Delete 2 things
Reply With Quote #1

Can anyone help me to delete supplybox and chicken for this plugin. I would like only egg as bonus box.

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <zombieplague>

#define PLUGIN "[ZP] Drop itens"
#define VERSION "1.0"
#define AUTHOR "Biel-oGrande"

new g_model_supplybox[] = "models/zombie_plague/w_supplybox.mdl"
new g_model_egg[] = "models/zombie_plague/w_egg.mdl"
new g_model_chicken[] = "models/zombie_plague/w_chicken.mdl"

new g_sound_supplybox[] = "zombie_plague/supplybox_pickup.wav"
new g_sound_egg[] = "zombie_plague/egg_pickup.wav"
new g_sound_chicken[] = "zombie_plague/chicken_pickup.wav"

new cvar_min_ap, cvar_max_ap

public plugin_init() {
	
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	cvar_min_ap = register_cvar("zp_min_ap","1")
	cvar_max_ap = register_cvar("zp_max_ap","5")
	
	register_logevent("round_start", 2, "1=Round_Start")
	
	register_event("DeathMsg", "player_death", "a")
	
	register_forward(FM_Touch, "fwdTouch")
}

public plugin_precache()  {
	
	precache_model(g_model_supplybox)
	precache_sound(g_sound_supplybox)
	
	precache_model(g_model_egg)
	precache_sound(g_sound_egg)
	
	precache_model(g_model_chicken)
	precache_sound(g_sound_chicken)
}

public round_start() {
	
	new ent = -1
	while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "supplybox")) != 0) {
		
		engfunc(EngFunc_RemoveEntity, ent)
	}
	while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "egg")) != 0) {
		
		engfunc(EngFunc_RemoveEntity, ent)
	}
	while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "chicken")) != 0) {
		
		engfunc(EngFunc_RemoveEntity, ent)
	}
}

public player_death() {
	
	new victim = read_data(2)
	
	switch(random_num(1,3)) {
		
		case 1: drop_supplybox(victim)
			case 2: drop_egg(victim)
			case 3: drop_chicken(victim)
		}
	
	return PLUGIN_CONTINUE
}

public drop_supplybox(id) {
	
	new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	
	new Float:origin[3]
	pev(id, pev_origin, origin)
	
	set_pev(ent, pev_origin, origin)
	set_pev(ent, pev_classname, "supplybox")
	engfunc(EngFunc_SetModel, ent, g_model_supplybox)
	set_pev(ent, pev_solid, SOLID_TRIGGER)
	set_pev(ent, pev_movetype, MOVETYPE_NOCLIP)
	engfunc(EngFunc_DropToFloor, ent)
	
	set_pev(ent, pev_renderfx, kRenderFxGlowShell)
	set_pev(ent, pev_rendercolor, Float:{0.0, 0.0, 150.0})
}

public drop_egg(id) {
	
	new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	
	new Float:origin[3]
	pev(id, pev_origin, origin)

	set_pev(ent, pev_origin, origin)
	set_pev(ent, pev_classname, "egg")
	engfunc(EngFunc_SetModel, ent, g_model_egg)
	set_pev(ent, pev_solid, SOLID_TRIGGER)
	set_pev(ent, pev_movetype, MOVETYPE_BOUNCE)
	engfunc(EngFunc_DropToFloor, ent)
	
	set_pev(ent, pev_renderfx, kRenderFxGlowShell)
	set_pev(ent, pev_rendercolor, Float:{0.0, 150.0, 000.0})
}

public drop_chicken(id) {
	
	new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
	
	new Float:origin[3]
	pev(id, pev_origin, origin)
	
	set_pev(ent, pev_origin, origin)
	set_pev(ent, pev_classname, "chicken")
	engfunc(EngFunc_SetModel, ent, g_model_chicken)
	set_pev(ent, pev_solid, SOLID_TRIGGER)
	set_pev(ent, pev_movetype, MOVETYPE_NOCLIP)
	engfunc(EngFunc_DropToFloor, ent)
	
	set_pev(ent, pev_renderfx, kRenderFxGlowShell)
	set_pev(ent, pev_rendercolor, Float:{150.0, 150.0, 150.0})
}

public fwdTouch(ent, id) { 
	
	if(!pev_valid(ent) || !is_user_alive(id)) return FMRES_IGNORED
	
	new classname[32]
	pev(ent, pev_classname, classname, charsmax(classname))
	
	if(equali(classname, "supplybox")) {
		
		emit_sound(id, CHAN_AUTO, g_sound_supplybox, 1.0, ATTN_NORM, 0, PITCH_NORM)
		engfunc(EngFunc_RemoveEntity, ent)
		give(id)
	}
	if(equali(classname, "egg")) {
		
		emit_sound(id, CHAN_AUTO, g_sound_egg, 1.0, ATTN_NORM, 0, PITCH_NORM)
		engfunc(EngFunc_RemoveEntity, ent)
		give(id)
	}
	if(equali(classname, "chicken")) {
		
		emit_sound(id, CHAN_AUTO, g_sound_chicken, 1.0, ATTN_NORM, 0, PITCH_NORM)
		engfunc(EngFunc_RemoveEntity, ent)
		give(id)
	}
	return FMRES_IGNORED
}

public give(id) {
	
	new iRandom = random_num(get_pcvar_num(cvar_min_ap), get_pcvar_num(cvar_max_ap))	
	
	zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + iRandom)
	
	client_print(id, print_center, "[ %d ] Ammopacks", iRandom)
}
strangeguy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode