Raised This Month: $ Target: $400
 0% 

[ZP] Bonus Box Screenfade


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
strangeguy
Senior Member
Join Date: Mar 2019
Old 09-15-2019 , 15:34   [ZP] Bonus Box Screenfade
Reply With Quote #1

Hi!
Can anyone help me with add to this script screen fade if I touch the box? Like this

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

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

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

#define Prefix "AddonsZM"

new g_sprite

new g_model[] = "models/zombie_plague/w_supplybox.mdl"
new g_sound[] = "zombie_plague/supplybox_pickup.wav"

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

public plugin_precache()  {
	
	precache_model(g_model)
	precache_sound(g_sound)
}

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

public player_death() {
	
	new victim = read_data(2)
	
	if(random_num(0, 1) == 0)  {
		
		drop_supplybox(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)
	set_pev(ent, pev_solid, SOLID_TRIGGER)
	set_pev(ent, pev_movetype, MOVETYPE_NOCLIP)
	engfunc(EngFunc_DropToFloor, ent)
	
	set_pev(ent,pev_mins,Float:{-10.0,-10.0,0.0})
	set_pev(ent,pev_maxs,Float:{10.0,10.0,50.0})
	set_pev(ent,pev_size,Float:{-1.0,-3.0,0.0,1.0,1.0,10.0})
	engfunc(EngFunc_SetSize,ent,Float:{-1.0,-3.0,0.0},Float:{1.0,1.0,10.0})
	
	set_pev(ent, pev_avelocity,Float:{0.0,50.0,0.0})
}

public icon_light(ent) {
	
	static Float:origin[3]
	pev(ent, pev_origin, origin)
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_SPRITE)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2] + 40.0)
	write_short(g_sprite)
	write_byte(2)
	write_byte(100)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, origin, 0)
	write_byte(TE_DLIGHT)
	engfunc(EngFunc_WriteCoord, origin[0])
	engfunc(EngFunc_WriteCoord, origin[1])
	engfunc(EngFunc_WriteCoord, origin[2])
	write_byte(5)
	write_byte(100)
	write_byte(100)
	write_byte(100)
	write_byte(2)
	write_byte(0)
	message_end()
}

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, 1.0, ATTN_NORM, 0, PITCH_NORM)
		engfunc(EngFunc_RemoveEntity, ent)
		remove_task(ent)
		
		if(zp_get_user_zombie(id))
			zombie_item(id)
		else
			human_item(id)
	}
	return FMRES_IGNORED
}

public human_item(id) {
	
	new szName[32]
	get_user_name(id, szName, 31)
	
	switch (random_num(0, 10)) {
		
		case 0..3: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e nao ganhou nada.",Prefix, szName)
		}
		case 4..6: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBoxx e ganhou !y2 !gAmmoPacks.",Prefix, szName)
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 2)
		}
		case 7, 8: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e ganhou !yvisao noturna.",Prefix, szName)
			zp_set_user_nightvision(id, 1) 
		}
		case 9: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e ganhou !y25 !gDe vida.",Prefix, szName)
			set_user_health(id, get_user_health(id) + 25)
		}
		case 10: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e ganhou !y10 !gDe Colete.",Prefix, szName)
			set_user_armor(id, get_user_armor(id) + 10)
		}
	}
}

public zombie_item(id) {
	
	new szName[32]
	get_user_name(id, szName, 31)	
	
	switch (random_num(0, 9)) {
		
		case 0..3: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e nao ganhou nada.",Prefix, szName)
		}
		case 4..6: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e ganhou !y2 !gAmmoPacks.",Prefix, szName)
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 2)
		}
		case 7, 8: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e ganhou !y300 !gDe vida.",Prefix, szName)
			set_user_health(id, get_user_health(id) + 300)
		}
		case 9: {
			
			client_print_color(0, "!g[%s] !y%s !tPegou a SupplyBox e ganhou !yfuria.",Prefix, szName)
			zp_force_buy_extra_item(id, 2, 1)
		}
	}
}

stock client_print_color(const id, const input[], any:...) {
	
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4")
	replace_all(msg, 190, "!y", "^1")
	replace_all(msg, 190, "!t", "^3")
	replace_all(msg, 190, "!team2", "^0")
	
	if(id)
		players[0] = id;
	else
		get_players(players, count, "ch")
	
	for (new i = 0; i < count; i++) {
		
		if(is_user_connected(players[i])) {
			
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}
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 17:22.


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