Queria pedir a ajuda de alguem para me ajudar nesse plugin do evento de soltar SupplyBox.
Entao , esse plugin tem 2 problemas:
Primeiro , para criar box basta saber o comando , nao há nenhum tipo de flag para colocar a Supplybox e queria que alguem colocasse fazendo favor . (DE PREFERENCIA A FLAG A)
Segundo , a supplybox nasce onde estiver a mira de quem criou , eu queria que ela aparecesse em lugares aleatorio dos mapas.
SMA da Box:
Entao , esse plugin tem 2 problemas:
Primeiro , para criar box basta saber o comando , nao há nenhum tipo de flag para colocar a Supplybox e queria que alguem colocasse fazendo favor . (DE PREFERENCIA A FLAG A)
Segundo , a supplybox nasce onde estiver a mira de quem criou , eu queria que ela aparecesse em lugares aleatorio dos mapas.
SMA da Box:
- Código:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <zombieplague>
#include <hamsandwich>
#define PLUGIN "[ZP] Evento Puta Acha Acha"
#define VERSION "1.0"
#define AUTHOR "IGK Clan"
new Menu_SupplyBox_Acha_Acha
new const item_class_name[] = "puta_evento_acha_acha"
new g_models[][] = {"models/supplybox1.mdl"}
public plugin_precache()
{
for (new i = 0; i < sizeof g_models; i++)
precache_model(g_models[i])
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_Touch, "fwd_Touch")
register_event("HLTV", "round_start", "a", "1=0", "2=0")
register_clcmd("say /box", "suplebox_play_acha_acha")
register_clcmd("say /delbox", "suplebox_deleta_acha_acha")
}
public display_items_menu(id, level, cid)
{
if (cmd_access(id, level, cid, 0))
menu_display(id, Menu_SupplyBox_Acha_Acha, 0)
return PLUGIN_HANDLED
}
public menu_item(id, menu, item)
{
if( item < 0 )
return PLUGIN_CONTINUE
new cmd[3]
new maccess, callback
menu_item_getinfo(menu, item, maccess, cmd,2,_,_, callback)
new iChoice = str_to_num(cmd)
switch(iChoice)
{
case 1:
{
new origin[3]
get_user_origin(id, origin, 3)
add_supplybox_acha_acha(origin)
}
case 2:
deleta_all_supplybox_acha_acha()
case 3:
round_start()
}
menu_display(id, Menu_SupplyBox_Acha_Acha, 0)
return PLUGIN_CONTINUE
}
public suplebox_play_acha_acha(id)
{
new origin[3]
get_user_origin(id, origin, 3)
add_supplybox_acha_acha(origin)
}
public suplebox_deleta_acha_acha(id)
{
new origin[3]
get_user_origin(id, origin, 3)
deleta_all_supplybox_acha_acha
}
public add_supplybox_acha_acha(origin[3])
{
set_hudmessage(255, 0, 0, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "[BK|Evento] Foi Solto 1 SupplyBox")
new ent = fm_create_entity("info_target")
set_pev(ent, pev_classname, item_class_name)
engfunc(EngFunc_SetModel,ent, g_models[random_num(0, sizeof g_models - 1)])
set_pev(ent,pev_mins,Float:{-10.0,-10.0,0.0})
set_pev(ent,pev_maxs,Float:{10.0,10.0,25.0})
set_pev(ent,pev_size,Float:{-10.0,-10.0,0.0,10.0,10.0,25.0})
engfunc(EngFunc_SetSize,ent,Float:{-10.0,-10.0,0.0},Float:{10.0,10.0,25.0})
set_pev(ent,pev_solid,SOLID_BBOX)
set_pev(ent,pev_movetype,MOVETYPE_FLY)
new Float:fOrigin[3]
IVecFVec(origin, fOrigin)
set_pev(ent, pev_origin, fOrigin)
set_pev(ent,pev_renderfx,kRenderFxGlowShell)
switch(random_num(1,4))
{
case 1: set_pev(ent,pev_rendercolor,Float:{0.0,0.0,255.0})
case 2: set_pev(ent,pev_rendercolor,Float:{0.0,255.0,0.0})
case 3: set_pev(ent,pev_rendercolor,Float:{255.0,0.0,0.0})
case 4: set_pev(ent,pev_rendercolor,Float:{255.0,255.0,255.0})
}
}
public deleta_all_supplybox_acha_acha()
{
set_hudmessage(255, 0, 0, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "[BK|Evento] Todas as SupplyBox do mapa foram deletadas")
new ent = FM_NULLENT
static string_class[] = "classname"
while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))
set_pev(ent, pev_flags, FL_KILLME)
}
public fwd_Touch(toucher, touched)
{
if (!is_user_alive(toucher) || !pev_valid(touched))
return FMRES_IGNORED
new classname[32]
pev(touched, pev_classname, classname, 31)
if (!equal(classname, item_class_name))
return FMRES_IGNORED
give_item(toucher)
set_pev(touched, pev_effects, EF_NODRAW)
set_pev(touched, pev_solid, SOLID_NOT)
return FMRES_IGNORED
}
public removeEntity(ent)
{
if (pev_valid(ent))
engfunc(EngFunc_RemoveEntity, ent)
}
public give_item(id)
{
new ap_quantity
ap_quantity = random_num(150, 5)
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ap_quantity)
client_printcolor(0, "!g[BK|Evento]!t Alguem Achou !g%d!t Ammo pack na SupplyBox", ap_quantity)
}
public round_start()
{
new ent = FM_NULLENT
static string_class[] = "classname"
while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))
{
set_pev(ent, pev_effects, 0)
set_pev(ent, pev_solid, SOLID_BBOX)
}
}
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Chat Verde
replace_all(msg, 190, "!y", "^1") // Chat Normal
replace_all(msg, 190, "!t", "^3") // Chat Do Time Tr=Vermelho Ct=Azul Spec=Branco
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();
}
}
}
}