Descrição:
Na hora que estiver com a faca aperte G para dropar 2 ammo packs
Na hora que estiver com a faca aperte G para dropar 2 ammo packs
Imagem:
Download Aqui
Última edição por [P]erfec[T] [S]cr[@]s[H] em 2/6/2014, 6:48 pm, editado 1 vez(es)
Código:
#include <amxmodx>
#include <engine>
#include < xs >
#include <zp50_ammopacks>
#define PLUGIN "\r[ZP 5.0]\y Addon:\w Dropar Ammo Packs"
#define VERSION "1.1"
#define AUTHOR "[P]erfec[T] [S]cr[@]s[H]"
new const egg_class[] = "ovo_de_ammopack"
new const egg_model[] = "models/zombie_plague/w_egg.mdl"
new const egg_sound[] = "egg_drop.wav"
new cvar_drop_amount, cvar_max_entities, entity_num
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("drop_ammopack", VERSION, FCVAR_SERVER|FCVAR_UNLOGGED);
register_clcmd("drop", "dropar_ammo_pack")
register_touch(egg_class, "player", "fwd_Touch")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
cvar_drop_amount = register_cvar("zp_ovo_drop_amount", "2") // Quantia de Ammo Packs a Perder Por Pack Dropado / Ganhar ao pegar o ovo
cvar_max_entities = register_cvar("zp_ovo_max_entities", "150") // Numero Maximo de Entidades no Mapa
}
public plugin_precache()
{
precache_model(egg_model)
precache_sound(egg_sound)
}
public event_round_start()
{
remove_entity_name(egg_class)
entity_num = 0
}
public fwd_Touch(touched, toucher)
{
if (!is_user_alive(toucher) || !is_valid_ent(touched)) return PLUGIN_HANDLED;
new class[32]; entity_get_string(touched, EV_SZ_classname, class, 31)
if (equal(class, egg_class))
{
zp_ammopacks_set(toucher, zp_ammopacks_get(toucher) + get_pcvar_num(cvar_drop_amount))
emit_sound(toucher, CHAN_WEAPON, egg_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
client_printcolor(toucher, "!g[ZP]!t Voce Pegou o Ovo Magico e Ganhou !g%d!t Ammo Packs", get_pcvar_num(cvar_drop_amount))
remove_entity(touched)
entity_num--
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public dropar_ammo_pack(id)
{
if(is_user_alive(id) && get_user_weapon(id) == CSW_KNIFE && zp_ammopacks_get(id) >= get_pcvar_num(cvar_drop_amount))
{
if(entity_num >= get_pcvar_num(cvar_max_entities))
{
client_printcolor(id, "!g[ZP]!t Numero Maximo de Ovos Atingidos")
return;
}
new Float:Origin[3], Float:vAngle[3], Float:flVelocity[3]
// Get position from eyes
get_user_eye_position(id, Origin)
entity_get_vector(id, EV_VEC_v_angle, vAngle)
new NewEnt = create_entity("info_target")
entity_set_string(NewEnt, EV_SZ_classname, egg_class)
entity_set_model(NewEnt, egg_model)
entity_set_size(NewEnt, Float:{-2.0, -2.0, -2.0}, Float:{5.0, 5.0, 5.0})
entity_set_origin(NewEnt, Origin)
entity_set_int(NewEnt,EV_INT_solid, SOLID_BBOX)
entity_set_int(NewEnt,EV_INT_movetype, MOVETYPE_TOSS)
entity_set_edict(NewEnt, EV_ENT_owner, id)
velocity_by_aim(id, 300, flVelocity)
entity_set_vector(NewEnt, EV_VEC_velocity, flVelocity)
set_rendering(NewEnt, kRenderFxGlowShell, random_num(0,255), random_num(0,255), random_num(0,255) , kRenderNormal, 16);
set_task(0.3, "unset_owner", NewEnt)
zp_ammopacks_set(id, zp_ammopacks_get(id) - get_pcvar_num(cvar_drop_amount))
client_printcolor(id, "!g[ZP]!t Voce Dropou !g%d!t Ammo Packs", get_pcvar_num(cvar_drop_amount))
entity_num++
}
}
public unset_owner(ent)
{
if(!is_valid_ent(ent)) return PLUGIN_HANDLED
new class[32]; entity_get_string(ent, EV_SZ_classname, class, 31)
if(!equal(class, egg_class)) return PLUGIN_HANDLED;
entity_set_edict(ent, EV_ENT_owner, ent)
return PLUGIN_CONTINUE;
}
stock get_user_eye_position(id, Float:flOrigin[3])
{
static Float:flViewOffs[3]
entity_get_vector(id, EV_VEC_view_ofs, flViewOffs)
entity_get_vector(id, EV_VEC_origin, flOrigin)
xs_vec_add(flOrigin, flViewOffs, flOrigin)
}
stock client_printcolor(const id,const input[], any:...)
{
new msg[191], players[32], count = 1; vformat(msg,190,input,3);
replace_all(msg,190,"!g","^4"); // green
replace_all(msg,190,"!y","^1"); // normal
replace_all(msg,190,"!t","^3"); // team
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();
}
}
}
rotam escreveu:Seria interessante colocar uma versao so para admin poder dropar e os ovos sairem pulando em alta velocidade
cancels escreveu:
cancels escreveu:
|
|