Bom eu estava sem nada pra fazer e peguei a sma da galinha e editei colocando a models de uma Supply box, fico muito massa
Download das models e sounds aqui
http://adf.ly/1256340/banner/4shared.com/rar/Dhiiw4Wj/Supplybox.html
Download das models e sounds aqui
http://adf.ly/1256340/banner/4shared.com/rar/Dhiiw4Wj/Supplybox.html
Código:
#include <amxmodx>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>
#define PLUGIN "[ZP] Drop APs Random Mode"
#define VERSION "1.0"
#define AUTHOR "GuhRDS"
new const item_class_name[] = "dm_item"
new g_model[][] = { "models/Supply Box/supplyh_umbrella_pg.mdl" }
new g_sound[] = {"get_supplybox.wav"}
new cvar_mode
public plugin_precache()
{
for (new i = 0; i < sizeof g_model; i++)
precache_model(g_model[i])
precache_sound(g_sound)
}
public plugin_init()
{
// Register Plugin
register_plugin(PLUGIN, VERSION, AUTHOR)
// Cvars
cvar_mode = register_cvar("zp_drop_apmode", "4") // 0 - Desativado | 1 - Difícil | 2 - Médio(Balanceado) | 3 - Fácil | 4 - Sempre
// Others
register_event("HLTV", "round_start", "a", "1=0", "2=0")
register_forward(FM_Touch, "fwd_Touch")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}
public plugin_cfg()
{
new cfgdir[32]
get_configsdir(cfgdir, charsmax(cfgdir))
server_cmd("exec %s/zp_drop_ap.cfg", cfgdir)
}
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_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)
emit_sound(toucher, CHAN_AUTO, g_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
set_pev(touched, pev_effects, EF_NODRAW)
set_pev(touched, pev_solid, SOLID_NOT)
return FMRES_IGNORED
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
if (!is_user_connected(attacker) || !is_user_connected(victim) || attacker == victim || !attacker)
return HAM_IGNORED
// Desativado
if((get_pcvar_num(cvar_mode) == 0))
{
new random = random_num(1, 2)
if (random == 0)
{
new origin[3]
get_user_origin(victim, origin, 0)
addItem(origin)
}
}
// Difícil
if((get_pcvar_num(cvar_mode) == 1))
{
new random = random_num(0, 9)
if (random == 0 || random == 1 || random == 2 || random == 3 || random == 4)
{
new origin[3]
get_user_origin(victim, origin, 0)
addItem(origin)
}
}
// Médio(Balanceado)
if((get_pcvar_num(cvar_mode) == 2))
{
new random = random_num(0, 8)
if (random == 0 || random == 1 || random == 2 || random == 3 || random == 4)
{
new origin[3]
get_user_origin(victim, origin, 0)
addItem(origin)
}
}
// Fácil
if((get_pcvar_num(cvar_mode) == 3))
{
new random = random_num(0, 6)
if (random == 0 || random == 1 || random == 2 || random == 3 || random == 4)
{
new origin[3]
get_user_origin(victim, origin, 0)
addItem(origin)
}
}
// Sempre
if((get_pcvar_num(cvar_mode) == 4))
{
new random = random_num(0, 4)
if (random == 0 || random == 1 || random == 2 || random == 3 || random == 4)
{
new origin[3]
get_user_origin(victim, origin, 0)
addItem(origin)
}
}
return HAM_IGNORED
}
public removeEntity(ent)
{
if (pev_valid(ent))
engfunc(EngFunc_RemoveEntity, ent)
}
public addItem(origin[3])
{
new ent = fm_create_entity("info_target")
set_pev(ent, pev_classname, item_class_name)
engfunc(EngFunc_SetModel,ent, g_model[random_num(0, sizeof g_model - 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)
//set_pev(ent, pev_movetype, MOVETYPE_TOSS)
new Float:fOrigin[3]
origin[2]-=7
IVecFVec(origin, fOrigin)
set_pev(ent, pev_origin, fOrigin)
set_pev(ent, pev_renderfx, kRenderFxGlowShell)
switch(random_num(5, 5))
{
case 0: set_pev(ent, pev_rendercolor, Float:{0.0, 0.0, 255.0}) // Azul
case 1: set_pev(ent, pev_rendercolor, Float:{0.0, 255.0, 0.0}) // Verde
case 2: set_pev(ent, pev_rendercolor, Float:{255.0, 0.0, 0.0}) // Vermelho
case 3: set_pev(ent, pev_rendercolor, Float:{255.0, 0.0, 255.0}) // Rosa
case 4: set_pev(ent, pev_rendercolor, Float:{255.0, 255.0, 0.0}) // Amarelo
case 5: set_pev(ent, pev_rendercolor, Float:{255.0, 255.0, 255.0}) // Branco
}
}
public give_item(id)
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + 10)
fm_set_user_health(id, get_user_health(id) + 100)
client_printcolor(id, "!y[!gZP!y] Voce pegou a !tCaixa Umbrella Gift !ye !tGanhou !g10 !tAmmo Pack(s)!y")
if(get_user_armor(id) < 100)
{
fm_set_user_armor(id, get_user_armor(id) + 30)
}
}
stock get_configsdir(name[], len)
{
return get_localinfo("amxx_configsdir", name, len);
}
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();
}
}
}
}