Raised This Month: $105 Target: $400
 26% 

[ZP] Death Drop Items


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
strangeguy
Member
Join Date: Mar 2019
Old 12-28-2019 , 05:47   [ZP] Death Drop Items
Reply With Quote #1

Hi!
Can someone delete supplybox and chicken for this script. I want 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)
}

Last edited by strangeguy; 12-28-2019 at 05:48.
strangeguy is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 12-28-2019 , 09:11   Re: [ZP] Death Drop Items
Reply With Quote #2

Untested:

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)         drop_egg(victim)         /*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) }
__________________


My Plugins:
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
strangeguy
Member
Join Date: Mar 2019
Old 12-28-2019 , 12:31   Re: [ZP] Death Drop Items
Reply With Quote #3

Quote:
Originally Posted by Napoleon_be View Post
Untested:

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)         drop_egg(victim)         /*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) }
Thank you so much it works
strangeguy is offline
Reply


Thread Tools
Display Modes

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 21:59.


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