Raised This Month: $9 Target: $400
 2% 

[ZP] Screen fade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
strangeguy
Member
Join Date: Mar 2019
Old 12-29-2019 , 05:01   [ZP] Screen fade
Reply With Quote #1

Hi!
Can anyone add to my bonus egg screen fade when I touch it?

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"
#define NUM_SPRITES		4


//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)
	set_pev(ent, pev_effects, EF_LIGHT)
    engfunc(EngFunc_DropToFloor, ent)
    
    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)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1250\\ deff0\\ deflang1045{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

Last edited by strangeguy; 12-29-2019 at 05:02.
strangeguy is offline
ZaX
Member
Join Date: Jan 2015
Old 12-29-2019 , 20:01   Re: [ZP] Screen fade
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <zombieplague>

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


//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_apcvar_max_ap

public plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
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_FindEntityByStringent"classname""egg")) != 0) {
        
        
engfunc(EngFunc_RemoveEntityent)
    }
    
/*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_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    new 
Float:origin[3]
    
pev(idpev_originorigin)
    
    
set_pev(entpev_originorigin)
    
set_pev(entpev_classname"egg")
    
engfunc(EngFunc_SetModelentg_model_egg)
    
set_pev(entpev_solidSOLID_TRIGGER)
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    
set_pev(entpev_effectsEF_LIGHT)
    
engfunc(EngFunc_DropToFloorent)
    
    
set_pev(entpev_rendercolorFloat:{0.0150.0000.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(entid) { 
    
    if(!
pev_valid(ent) || !is_user_alive(id)) return FMRES_IGNORED
    
    
new classname[32]
    
pev(entpev_classnameclassnamecharsmax(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(idCHAN_AUTOg_sound_egg1.0ATTN_NORM0PITCH_NORM)
        
engfunc(EngFunc_RemoveEntityent)
        
ScreenFade(id1.00/*Red*/255 /*Green*//*Blue*/255)
        
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(idzp_get_user_ammo_packs(id) + iRandom)
    
    
client_print(idprint_center"[ %d ] Ammopacks"iRandom)
}

stock ScreenFade(plrFloat:fDurationredgreenbluealpha)
{
    new 
plr plr get_maxplayers();
    if( !
)
    {
        return 
0;
    }
    
    
message_begin(plr MSG_ONE MSG_ALLget_user_msgid"ScreenFade"), {000}, plr);
    
write_short(floatround(4096.0 fDurationfloatround_round));
    
write_short(floatround(4096.0 fDurationfloatround_round));
    
write_short(4096);
    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_byte(alpha);
    
message_end();
    
    return 
1;

ZaX is offline
strangeguy
Member
Join Date: Mar 2019
Old 12-30-2019 , 05:28   Re: [ZP] Screen fade
Reply With Quote #3

Quote:
Originally Posted by ZaX View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <zombieplague>

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


//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_apcvar_max_ap

public plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
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_FindEntityByStringent"classname""egg")) != 0) {
        
        
engfunc(EngFunc_RemoveEntityent)
    }
    
/*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_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    new 
Float:origin[3]
    
pev(idpev_originorigin)
    
    
set_pev(entpev_originorigin)
    
set_pev(entpev_classname"egg")
    
engfunc(EngFunc_SetModelentg_model_egg)
    
set_pev(entpev_solidSOLID_TRIGGER)
    
set_pev(entpev_movetypeMOVETYPE_BOUNCE)
    
set_pev(entpev_effectsEF_LIGHT)
    
engfunc(EngFunc_DropToFloorent)
    
    
set_pev(entpev_rendercolorFloat:{0.0150.0000.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(entid) { 
    
    if(!
pev_valid(ent) || !is_user_alive(id)) return FMRES_IGNORED
    
    
new classname[32]
    
pev(entpev_classnameclassnamecharsmax(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(idCHAN_AUTOg_sound_egg1.0ATTN_NORM0PITCH_NORM)
        
engfunc(EngFunc_RemoveEntityent)
        
ScreenFade(id1.00/*Red*/255 /*Green*//*Blue*/255)
        
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(idzp_get_user_ammo_packs(id) + iRandom)
    
    
client_print(idprint_center"[ %d ] Ammopacks"iRandom)
}

stock ScreenFade(plrFloat:fDurationredgreenbluealpha)
{
    new 
plr plr get_maxplayers();
    if( !
)
    {
        return 
0;
    }
    
    
message_begin(plr MSG_ONE MSG_ALLget_user_msgid"ScreenFade"), {000}, plr);
    
write_short(floatround(4096.0 fDurationfloatround_round));
    
write_short(floatround(4096.0 fDurationfloatround_round));
    
write_short(4096);
    
write_byte(red);
    
write_byte(green);
    
write_byte(blue);
    
write_byte(alpha);
    
message_end();
    
    return 
1;

That's work thank you so much
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 19:55.


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