bom gente to precisando daquele plugin que uns serve tem , tipo mato um zombie ai fica com uma ak47 + bunita ou muda de cor só 1 vez quando mata se alguem tiver o plugin e puder passar obrigado !
Código:
/*************************************************************************************
[ZP] Thunder Carabine by Lucas_7_94 For Allied Mods .
Enjoy The Plugin =D
***************************************************************************************/
#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include < fun >
#include <hamsandwich>
#include <engine>
#include <fakemeta>
#define NAME "[ZP] Extra Item : Thunder Carabine"
#define VERSION "v1.5"
#define CREATOR "lucas_7_94"
// Put Your Model =D
new const v_thunder[] = "models/v_gpexm3.mdl"
new const p_thunder[] = "models/p_gpexm3.mdl"
// Put The Cost For The Plugin
new const g_thunder_cost = 60
/*==========Customization==========*/
new bool: g_HasThunderCarabine[33]
new Thunder, g_thunder, g_maxplayers
new cvar_carbine_damage
new cvar_say, cvar_sounds
new cvar_round_started, cvar_logs
/*===== End Customization ======*/
#define is_valid_player(%1) (1 <= %1 <= g_maxplayers) // Thanks You meTaLicross's gauss. =D
public plugin_init()
{
register_plugin(NAME, VERSION, CREATOR)
register_cvar("Thunder Carabine", VERSION, (FCVAR_SERVER | FCVAR_SPONLY))
register_clcmd("drop", "clcmd_drop")
// Events And Others
register_event("CurWeapon", "event_CurWeapon", "be", "1=1")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
RegisterHam(Ham_Spawn, "player", "fw_player_spawn", 1)
// Cvars For Item
cvar_say = register_cvar("zp_thunder_says", "1")
cvar_sounds = register_cvar("zp_thunder_sounds", "1")
cvar_logs = register_cvar("zp_thunder_logs", "1")
cvar_round_started = register_cvar("zp_thunder_buy_started", "1")
cvar_carbine_damage = register_cvar("zp_thunder_damage", "2.0")
// Register the Plugin =D
g_thunder = zp_register_extra_item("Thunder Carabine", g_thunder_cost, ZP_TEAM_HUMAN);
// Maxplayers and the sucking Screenfade l0l D:
g_maxplayers = get_maxplayers()
}
public plugin_precache()
{
Thunder = precache_model("sprites/lgtning.spr");
precache_sound( "ambience/thunder_clap.wav" )
precache_model(v_thunder)
precache_model(p_thunder)
}
public client_disconnect(id) g_HasThunderCarabine[id] = false;
public client_putinserver(id) g_HasThunderCarabine[id] = false;
public fw_player_spawn(id)
{
if (g_HasThunderCarabine[id])
{
g_HasThunderCarabine[id] = false
fm_strip_user_gun(id, CSW_M4A1)
}
}
public zp_user_infected_post(infected, infector)
{
if (g_HasThunderCarabine[infected])
{
Color(infected, "^x04[ZP] Thunder Carabine Is OFF")
g_HasThunderCarabine[infected] = false;
}
}
public fw_player_killed(victim, attacker, shouldgib)
{
if(g_HasThunderCarabine[victim])
{
Color(victim, "^x04[ZP] Thunder Carabine Is OFF")
g_HasThunderCarabine[victim] = false
}
}
public event_CurWeapon(id)
{
new weapid = read_data(2)
if(!is_user_alive(id))
return;
if(!g_HasThunderCarabine[id])
return;
if(g_HasThunderCarabine[id] && weapid == CSW_M4A1)
{
entity_set_string(id, EV_SZ_viewmodel, v_thunder)
entity_set_string(id, EV_SZ_weaponmodel, p_thunder)
}
}
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_thunder)
{
if(get_pcvar_num(cvar_round_started) == 1)
{
if (!zp_has_round_started())
{
Color(player, "^x04[ZP]^x01 You need to buy this item after the start of the round.")
zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + g_thunder_cost)
return;
}
}
if(g_HasThunderCarabine[player])
{
Color(player, "^04[Zombie Plague]^x01 You've got the Thunder Carabine")
zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + g_thunder_cost)
return;
}
else
{
g_HasThunderCarabine[player] = true
strip_user_weapons(player)
give_item(player, "weapon_m4a1")
Color(player, "^x04[Zombie Plague]^x01 You purchased a Thunder Carabine!!! Search And Destroy !!")
}
}
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
new weapid = read_data(2)
if (!is_user_connected(attacker))
return;
if(!zp_get_user_zombie(victim))
return;
if (g_HasThunderCarabine[attacker] && weapid == CSW_M4A1)
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_carbine_damage))
}
if(g_HasThunderCarabine[victim])
{
Color(victim, "^x04[ZP] Thunder Carabine Is OFF")
g_HasThunderCarabine[victim] = false
}
}
public clcmd_drop(player)
{
if (g_HasThunderCarabine[player])
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
/*if(g_HasThunderCarabine[attacker])
return;
if(is_user_alive(attacker))
return;*/
if(!zp_get_user_zombie(victim))
return;
if(!is_valid_player(attacker))
return;
static killername[33], victimname[33]
get_user_name(attacker, killername, 31)
get_user_name(victim, victimname, 31)
g_HasThunderCarabine[victim] = false;
g_HasThunderCarabine[attacker]++;
new clip, ammo, wpnid = get_user_weapon(attacker, clip, ammo)
if(g_HasThunderCarabine[attacker] && wpnid == CSW_M4A1)
{
new vorigin[3],srco[3];
get_user_origin(victim, vorigin);
vorigin[2] -= 26
srco[0] = vorigin[0] + 150
srco[1] = vorigin[1] + 150
srco[2] = vorigin[2] + 800
set_user_rendering(victim, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16);
ThunderCarabine(srco,vorigin);
ThunderCarabine(srco,vorigin);
ThunderCarabine(srco,vorigin);
if(get_pcvar_num(cvar_say) == 1)
{
Color(attacker, "^x04[Thunder Carabine]^x01 You've Removed to ^x04%s", victimname)
Color(victim, "^x04[Thunder Carabine]^x01 You have been eliminated by %s", killername)
}
if(get_pcvar_num(cvar_sounds) == 1)
{
emit_sound(victim ,CHAN_ITEM, "ambience/thunder_clap.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
emit_sound(attacker ,CHAN_ITEM, "ambience/thunder_clap.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
}
if(get_pcvar_num(cvar_logs) == 1)
{
// Save Hummiliation
new namea[24],namev[24],authida[20],authidv[20],teama[8],teamv[8]
// Info On Attacker
get_user_name(attacker,namea,23)
get_user_team(attacker,teama,7)
get_user_authid(attacker,authida,19)
new attackerid = get_user_userid(attacker)
// Info On Victim
get_user_name(victim,namev,23)
get_user_team(victim,teamv,7)
get_user_authid(victim,authidv,19)
new victimid = get_user_userid(victim)
// Log This Kill
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"Thunder Carabine^"", namea, attackerid, authida, teama, namev, victimid, authidv, teamv)
}
if(g_HasThunderCarabine[victim])
{
Color(victim, "^x04[ZP] Thunder Carabine Is OFF")
g_HasThunderCarabine[victim] = false
}
}
}
ThunderCarabine(vec1[3],vec2[3])
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(0);
write_coord(vec1[0]);
write_coord(vec1[1]);
write_coord(vec1[2]);
write_coord(vec2[0]);
write_coord(vec2[1]);
write_coord(vec2[2]);
write_short(Thunder);
write_byte(1);
write_byte(5);
write_byte(2);
write_byte(20);
write_byte(30);
write_byte(200);
write_byte(200);
write_byte(200);
write_byte(200);
write_byte(200);
message_end();
message_begin( MSG_PVS, SVC_TEMPENTITY,vec2);
write_byte(9);
write_coord(vec2[0]);
write_coord(vec2[1]);
write_coord(vec2[2]);
message_end();
}
/****************************************************
Stocks Ands Others
****************************************************/
stock Color(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "^x04", "^4") // Green Color
replace_all(msg, 190, "^x01", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color
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 bool:fm_strip_user_gun(index, wid = 0, const wname[] = "")
{
new ent_class[32];
if (!wid && wname[0])
copy(ent_class, sizeof ent_class - 1, wname);
else
{
new weapon = wid, clip, ammo;
if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
return false;
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
}
new ent_weap = fm_find_ent_by_owner(-1, ent_class, index);
if (!ent_weap)
return false;
engclient_cmd(index, "drop", ent_class);
new ent_box = pev(ent_weap, pev_owner);
if (!ent_box || ent_box == index)
return false;
dllfunc(DLLFunc_Think, ent_box);
return true;
}
// Stock: fm_find_ent_by_owner (taked from fakemeta_util)
stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0)
{
new strtype[11] = "classname", ent = index;
switch (jghgtype)
{
case 1: strtype = "target";
case 2: strtype = "targetname";
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
return ent;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang11274\\ f0\\ fs16 \n\\ par }
*/