Raised This Month: $32 Target: $400
 8% 

[ZP] Bonus Box Screenfade


Post New Thread Reply   
 
Thread Tools Display Modes
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
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-15-2019 , 16:36   Re: [ZP] Bonus Box Screenfade
Reply With Quote #2

should be used on fwdTouch function :
Code:
stock ScreenFade(plr, Float:fDuration, red, green, blue, alpha) {     new i = plr ? plr : get_maxplayers();     if( !i )     {         return 0;     }         message_begin(plr ? MSG_ONE : MSG_ALL, get_user_msgid( "ScreenFade"), {0, 0, 0}, plr);     write_short(floatround(4096.0 * fDuration, floatround_round));     write_short(floatround(4096.0 * fDuration, floatround_round));     write_short(4096);     write_byte(red);     write_byte(green);     write_byte(blue);     write_byte(alpha);     message_end();         return 1; }
LearninG is offline
strangeguy
Senior Member
Join Date: Mar 2019
Old 09-15-2019 , 17:12   Re: [ZP] Bonus Box Screenfade
Reply With Quote #3

I don't know what I do wrong but this is not work for me. Look for edited code (with your ScreenFade)
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
}
stock ScreenFade(plr, Float:fDuration, red, green, blue, alpha)
{
    new i = plr ? plr : get_maxplayers();
    if( !i )
    {
        return 0;
    }
    
    message_begin(plr ? MSG_ONE : MSG_ALL, get_user_msgid( "ScreenFade"), {255, 255, 0}, plr);
    write_short(floatround(4096.0 * fDuration, floatround_round));
    write_short(floatround(4096.0 * fDuration, floatround_round));
    write_short(4096);
    write_byte(red);
    write_byte(green);
    write_byte(blue);
    write_byte(alpha);
    message_end();
    
    return 1;
}

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();
		}
	}
}

Last edited by strangeguy; 09-15-2019 at 17:13.
strangeguy is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-15-2019 , 17:28   Re: [ZP] Bonus Box Screenfade
Reply With Quote #4

Code:
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)
                ScreenFade(id, 3.0, 255, 255, 0, 0)
                engfunc(EngFunc_RemoveEntity, ent)
                remove_task(ent)
                
                if(zp_get_user_zombie(id))
                        zombie_item(id)
                else
                        human_item(id)
        }
        return FMRES_IGNORED
}

Last edited by LearninG; 09-15-2019 at 17:29.
LearninG is offline
strangeguy
Senior Member
Join Date: Mar 2019
Old 09-16-2019 , 10:59   Re: [ZP] Bonus Box Screenfade
Reply With Quote #5

Quote:
Originally Posted by LearninG View Post
Code:
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)
                ScreenFade(id, 3.0, 255, 255, 0, 0)
                engfunc(EngFunc_RemoveEntity, ent)
                remove_task(ent)
                
                if(zp_get_user_zombie(id))
                        zombie_item(id)
                else
                        human_item(id)
        }
        return FMRES_IGNORED
}
When I do this good I have this message in compiler "cstrike\addons\scripting\z.sma(119) : error 017: undefined symbol "ScreenFade"
strangeguy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-16-2019 , 11:08   Re: [ZP] Bonus Box Screenfade
Reply With Quote #6

Never remove the entity directly on touch instead set entity think dead

pev_flags = FL_KILLME
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-16-2019 at 11:09.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-16-2019 , 11:15   Re: [ZP] Bonus Box Screenfade
Reply With Quote #7

Quote:
Originally Posted by strangeguy View Post
When I do this good I have this message in compiler "cstrike\addons\scripting\z.sma(119) : error 017: undefined symbol "ScreenFade"
are you sure that you didn't remove stock ?
LearninG is offline
strangeguy
Senior Member
Join Date: Mar 2019
Old 09-16-2019 , 11:50   Re: [ZP] Bonus Box Screenfade
Reply With Quote #8

Quote:
Originally Posted by LearninG View Post
are you sure that you didn't remove stock ?
I'm add screenfade in this line. If you can just add for me screenfade in these script I would be very grateful because I'm very slow at it

Code:
emit_sound(id, CHAN_AUTO, g_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)                                                                             
ScreenFade(id, 3.0, 255, 255, 0, 0)
engfunc(EngFunc_RemoveEntity, ent)
remove_task(ent)

Last edited by strangeguy; 09-16-2019 at 11:50.
strangeguy is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-16-2019 , 12:27   Re: [ZP] Bonus Box Screenfade
Reply With Quote #9

let me know if it didn't work
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)         ScreenFade(id, 3.0, 255, 255, 0, 0)         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();         }     } } stock ScreenFade(plr, Float:fDuration, red, green, blue, alpha) {     new i = plr ? plr : get_maxplayers();     if( !i )     {         return 0;     }         message_begin(plr ? MSG_ONE : MSG_ALL, get_user_msgid( "ScreenFade"), {255, 255, 0}, plr);     write_short(floatround(4096.0 * fDuration, floatround_round));     write_short(floatround(4096.0 * fDuration, floatround_round));     write_short(4096);     write_byte(red);     write_byte(green);     write_byte(blue);     write_byte(alpha);     message_end();         return 1; }
LearninG is offline
strangeguy
Senior Member
Join Date: Mar 2019
Old 09-16-2019 , 12:42   Re: [ZP] Bonus Box Screenfade
Reply With Quote #10

Quote:
Originally Posted by LearninG View Post
let me know if it didn't work
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)         ScreenFade(id, 3.0, 255, 255, 0, 0)         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();         }     } } stock ScreenFade(plr, Float:fDuration, red, green, blue, alpha) {     new i = plr ? plr : get_maxplayers();     if( !i )     {         return 0;     }         message_begin(plr ? MSG_ONE : MSG_ALL, get_user_msgid( "ScreenFade"), {255, 255, 0}, plr);     write_short(floatround(4096.0 * fDuration, floatround_round));     write_short(floatround(4096.0 * fDuration, floatround_round));     write_short(4096);     write_byte(red);     write_byte(green);     write_byte(blue);     write_byte(alpha);     message_end();         return 1; }
Thanks for you that works <3
strangeguy is offline
Reply



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


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