AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ZP] Bonus Box Screenfade (https://forums.alliedmods.net/showthread.php?t=318702)

strangeguy 09-15-2019 15:34

[ZP] Bonus Box Screenfade
 
Hi!
Can anyone help me with add to this script screen fade if I touch the box? Like this https://zapodaj.net/images/baa3eeb8b46e2.jpg

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


LearninG 09-15-2019 16:36

Re: [ZP] Bonus Box Screenfade
 
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; }

strangeguy 09-15-2019 17:12

Re: [ZP] Bonus Box Screenfade
 
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();
                }
        }
}


LearninG 09-15-2019 17:28

Re: [ZP] Bonus Box Screenfade
 
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
}


strangeguy 09-16-2019 10:59

Re: [ZP] Bonus Box Screenfade
 
Quote:

Originally Posted by LearninG (Post 2667094)
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"

Natsheh 09-16-2019 11:08

Re: [ZP] Bonus Box Screenfade
 
Never remove the entity directly on touch instead set entity think dead

pev_flags = FL_KILLME

LearninG 09-16-2019 11:15

Re: [ZP] Bonus Box Screenfade
 
Quote:

Originally Posted by strangeguy (Post 2667156)
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 ?

strangeguy 09-16-2019 11:50

Re: [ZP] Bonus Box Screenfade
 
Quote:

Originally Posted by LearninG (Post 2667158)
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)


LearninG 09-16-2019 12:27

Re: [ZP] Bonus Box Screenfade
 
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; }

strangeguy 09-16-2019 12:42

Re: [ZP] Bonus Box Screenfade
 
Quote:

Originally Posted by LearninG (Post 2667162)
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


All times are GMT -4. The time now is 17:22.

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