Queria um carniceiro como estilo RTK e DH ela tem:
(AURA AZUL, 500 de Colete, Faca Rápida)
Se possível postar .sma dela obrigado a todos !!!
(AURA AZUL, 500 de Colete, Faca Rápida)
Se possível postar .sma dela obrigado a todos !!!
waLLzyk escreveu:Carniceiro.
Plugin : zp_carniceiro
SMA : zp_carniceiro
Espero ter ajudado!
Código:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>
/*================================================================================
[Plugin Customization]
=================================================================================*/
new const g_item_name[] = { "Carniceiro \r[Faca Rapida]" }
const g_item_cost = 40
new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" }
const g_armor_amount = 500
const g_armor_limit = 1000
const OFFSET_WEAPONOWNER = 41
const OFFSET_LINUX_WEAPONS = 4
const m_flNextPrimaryAttack = 46
const m_flNextSecondaryAttack = 47
#define TASK_AURA 27000
#define IsValidUser(%1) (1 <= %1 <= g_maxplayers)
new g_hasCarniceiro[33], g_maxplayers, cvar_color, cvar_size, cvar_glowcolor, cvar_Primary, cvar_Secondary, cvar_PrimarySpeed, cvar_SecondarySpeed, cvar_dmgmultiplier
/*============================================================================*/
// Item IDs
new g_itemid_humanarmor
public plugin_init()
{
register_plugin("[ZP] Extra: Carniceiro", "1.0", "PrinTT/[P]erfec[T] [S]cr[@]s[H]")
g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fwd_Knife_PriAtk_Post", 1)
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fwd_Knife_SecAtk_Post", 1)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_maxplayers = get_maxplayers()
cvar_color = register_cvar("zp_carniceiro_aura_rgb", "60 160 225")
cvar_size = register_cvar("zp_carniceiro_aura_size", "15")
cvar_glowcolor = register_cvar("zp_carniceiro_glow_color_rgb", "60 160 225")
cvar_Primary = register_cvar("zp_carniceiro_pri", "1")
cvar_PrimarySpeed = register_cvar("zp_carniceiro_pri_speed", "0.33")
cvar_Secondary = register_cvar("zp_carniceiro_sec", "1")
cvar_SecondarySpeed = register_cvar("zp_carniceiro_sec_speed", "0.33")
cvar_dmgmultiplier = register_cvar("zp_carniceiro_knife_dmg", "4")
}
public plugin_precache()
{
precache_sound(g_sound_buyarmor)
}
/*===============================================================================
[Prevenção de Bugs]
=================================================================================*/
// Ao comecar o round
public event_round_start()
{
for (new id; id <= g_maxplayers; id++)
{
// Removemos a aura
remove_task(id + TASK_AURA)
}
for (new id = 1; id <= g_maxplayers; id++)
{
g_hasCarniceiro[id] = false
}
}
// Se o jogador desconecta
public client_disconnect(id)
{
remove_task(id + TASK_AURA)
g_hasCarniceiro[id] = false
}
// Se o jogador virar Nemesis ou Assassino
public zp_user_infected_pre(id)
{
g_hasCarniceiro[id] = false
remove_task(id + TASK_AURA)
}
// Se virar zombie
public zp_user_infected_post(id, infector)
{
remove_task(id + TASK_AURA)
g_hasCarniceiro[id] = false
}
// Se o jogador usar um antidoto
public zp_user_humanized_post(id, human)
{
remove_task(id + TASK_AURA)
g_hasCarniceiro[id] = false
}
// Se o jogador virar Survivor ou Sniper
public zp_user_humanized_pre(id)
{
if (g_hasCarniceiro[id])
{
g_hasCarniceiro[id] = false
remove_task(id + TASK_AURA)
}
}
/*===============================================================================
[Ações ao Selecionar o Item]
=================================================================================*/
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid_humanarmor)
{
// Colocamos o task que lhe dara a aura.
set_task(0.1, "aura", player + TASK_AURA, _, _, "b")
set_hudmessage(50, 160, 220, 0.01, 0.10, 0, 6.0, 1.2, 0.3, 0.4, 4)
show_hudmessage(0, ".::Voce se tornou um carniceiro::.")
client_printcolor(player, "/g[ZP]/y Voce Se Tornou um /tCarniceiro!!")
g_hasCarniceiro[player] = true
// Codigo do Glow soh o renderning ja bastava mas como quero de cvar cor a cor entao ta o codigo ai
new szGlowColors[16]
get_pcvar_string(cvar_glowcolor, szGlowColors, 15)
new gGlowRed[4], gGlowGreen[4], gGlowBlue[4], iGlowRed, iGlowGreen, iGlowBlue
parse(szGlowColors, gGlowRed, 3, gGlowGreen, 3, gGlowBlue, 3)
iGlowRed = clamp(str_to_num(gGlowRed), 0, 255)
iGlowGreen = clamp(str_to_num(gGlowGreen), 0, 255)
iGlowBlue = clamp(str_to_num(gGlowBlue), 0, 255)
fm_set_rendering(player, kRenderFxGlowShell, iGlowRed, iGlowGreen, iGlowBlue, kRenderNormal, 16)
// Se for nemesis desativa a aura
if(zp_get_user_nemesis(player))
{
remove_task(player + TASK_AURA)
}
set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit)))
engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
/*===============================================================================
[O Bang que dara Aura e Faca Rapida]
=================================================================================*/
public fwd_Knife_PriAtk_Post(ent)
{
if (!get_pcvar_num(cvar_Primary))
return HAM_IGNORED;
static owner
owner = ham_cs_get_weapon_ent_owner(ent)
if (!g_hasCarniceiro[owner])
return HAM_IGNORED
static Float:Speed, Float:Primary, Float:Secondary
Speed = get_pcvar_float(cvar_PrimarySpeed)
Primary = get_pdata_float(ent, m_flNextPrimaryAttack, OFFSET_LINUX_WEAPONS) * Speed
Secondary = get_pdata_float(ent, m_flNextSecondaryAttack, OFFSET_LINUX_WEAPONS) * Speed
if (Primary > 0.0 && Secondary > 0.0)
{
set_pdata_float(ent, m_flNextPrimaryAttack, Primary, OFFSET_LINUX_WEAPONS)
set_pdata_float(ent, m_flNextSecondaryAttack, Secondary, OFFSET_LINUX_WEAPONS)
}
return HAM_IGNORED;
}
public fwd_Knife_SecAtk_Post(ent)
{
if (!get_pcvar_num(cvar_Secondary))
return HAM_IGNORED;
static owner
owner = ham_cs_get_weapon_ent_owner(ent)
if (!g_hasCarniceiro[owner])
return HAM_IGNORED
static Float:Speed, Float:Primary, Float:Secondary
Speed = get_pcvar_float(cvar_SecondarySpeed)
Primary = get_pdata_float(ent, m_flNextPrimaryAttack, OFFSET_LINUX_WEAPONS) * Speed
Secondary = get_pdata_float(ent, m_flNextSecondaryAttack, OFFSET_LINUX_WEAPONS) * Speed
if (Primary > 0.0 && Secondary > 0.0)
{
set_pdata_float(ent, m_flNextPrimaryAttack, Primary, OFFSET_LINUX_WEAPONS)
set_pdata_float(ent, m_flNextSecondaryAttack, Secondary, OFFSET_LINUX_WEAPONS)
}
return HAM_IGNORED;
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( IsValidUser( attacker ) && get_user_weapon(attacker) == CSW_KNIFE && g_hasCarniceiro[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public aura(id)
{
id -= TASK_AURA
if (!is_user_alive(id))
return
// Codigo de kiske para passar de cvar a cor
new szColors[16]
get_pcvar_string(cvar_color, szColors, 15)
new gRed[4], gGreen[4], gBlue[4], iRed, iGreen, iBlue
parse(szColors, gRed, 3, gGreen, 3, gBlue, 3)
iRed = clamp(str_to_num(gRed), 0, 255)
iGreen = clamp(str_to_num(gGreen), 0, 255)
iBlue = clamp(str_to_num(gBlue), 0, 255)
//
static Float:FOrigin[3]
pev(id, pev_origin, FOrigin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, FOrigin, 0)
write_byte(TE_DLIGHT)
engfunc(EngFunc_WriteCoord, FOrigin[0])
engfunc(EngFunc_WriteCoord, FOrigin[1])
engfunc(EngFunc_WriteCoord, FOrigin[2])
write_byte(get_pcvar_num(cvar_size)) // Tamaño
write_byte(iRed) // R
write_byte(iGreen) // G
write_byte(iBlue) // B
write_byte(2)
write_byte(0)
message_end()
}
/*===============================================================================
[Mensagem Colorida (client_printcolor)]
=================================================================================*/
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();
}
}
}
}
stock ham_cs_get_weapon_ent_owner(entity)
{
return get_pdata_cbase(entity, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
}
[P]erfec[T] [S]cr[@]s[H] escreveu:
Esse Carniceiro seu não tem faca rapida. Pegue a sma que editei ao dele pra ter a faca rapida e ja aproveitei tambem e aumentei o dmg da faca e coloquei o glow.Código:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>
/*================================================================================
[Plugin Customization]
=================================================================================*/
new const g_item_name[] = { "Carniceiro \r[Faca Rapida]" }
const g_item_cost = 40
new const g_sound_buyarmor[] = { "items/tr_kevlar.wav" }
const g_armor_amount = 500
const g_armor_limit = 1000
const OFFSET_WEAPONOWNER = 41
const OFFSET_LINUX_WEAPONS = 4
const m_flNextPrimaryAttack = 46
const m_flNextSecondaryAttack = 47
#define TASK_AURA 27000
#define IsValidUser(%1) (1 <= %1 <= g_maxplayers)
new g_hasCarniceiro[33], g_maxplayers, cvar_color, cvar_size, cvar_glowcolor, cvar_Primary, cvar_Secondary, cvar_PrimarySpeed, cvar_SecondarySpeed, cvar_dmgmultiplier
/*============================================================================*/
// Item IDs
new g_itemid_humanarmor
public plugin_init()
{
register_plugin("[ZP] Extra: Carniceiro", "1.0", "PrinTT/[P]erfec[T] [S]cr[@]s[H]")
g_itemid_humanarmor = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN)
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fwd_Knife_PriAtk_Post", 1)
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fwd_Knife_SecAtk_Post", 1)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
g_maxplayers = get_maxplayers()
cvar_color = register_cvar("zp_carniceiro_aura_rgb", "60 160 225")
cvar_size = register_cvar("zp_carniceiro_aura_size", "15")
cvar_glowcolor = register_cvar("zp_carniceiro_glow_color_rgb", "60 160 225")
cvar_Primary = register_cvar("zp_carniceiro_pri", "1")
cvar_PrimarySpeed = register_cvar("zp_carniceiro_pri_speed", "0.33")
cvar_Secondary = register_cvar("zp_carniceiro_sec", "1")
cvar_SecondarySpeed = register_cvar("zp_carniceiro_sec_speed", "0.33")
cvar_dmgmultiplier = register_cvar("zp_carniceiro_knife_dmg", "4")
}
public plugin_precache()
{
precache_sound(g_sound_buyarmor)
}
/*===============================================================================
[Prevenção de Bugs]
=================================================================================*/
// Ao comecar o round
public event_round_start()
{
for (new id; id <= g_maxplayers; id++)
{
// Removemos a aura
remove_task(id + TASK_AURA)
}
for (new id = 1; id <= g_maxplayers; id++)
{
g_hasCarniceiro[id] = false
}
}
// Se o jogador desconecta
public client_disconnect(id)
{
remove_task(id + TASK_AURA)
g_hasCarniceiro[id] = false
}
// Se o jogador virar Nemesis ou Assassino
public zp_user_infected_pre(id)
{
g_hasCarniceiro[id] = false
remove_task(id + TASK_AURA)
}
// Se virar zombie
public zp_user_infected_post(id, infector)
{
remove_task(id + TASK_AURA)
g_hasCarniceiro[id] = false
}
// Se o jogador usar um antidoto
public zp_user_humanized_post(id, human)
{
remove_task(id + TASK_AURA)
g_hasCarniceiro[id] = false
}
// Se o jogador virar Survivor ou Sniper
public zp_user_humanized_pre(id)
{
if (g_hasCarniceiro[id])
{
g_hasCarniceiro[id] = false
remove_task(id + TASK_AURA)
}
}
/*===============================================================================
[Ações ao Selecionar o Item]
=================================================================================*/
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid_humanarmor)
{
// Colocamos o task que lhe dara a aura.
set_task(0.1, "aura", player + TASK_AURA, _, _, "b")
set_hudmessage(50, 160, 220, 0.01, 0.10, 0, 6.0, 1.2, 0.3, 0.4, 4)
show_hudmessage(0, ".::Voce se tornou um carniceiro::.")
client_printcolor(player, "/g[ZP]/y Voce Se Tornou um /tCarniceiro!!")
g_hasCarniceiro[player] = true
// Codigo do Glow soh o renderning ja bastava mas como quero de cvar cor a cor entao ta o codigo ai
new szGlowColors[16]
get_pcvar_string(cvar_glowcolor, szGlowColors, 15)
new gGlowRed[4], gGlowGreen[4], gGlowBlue[4], iGlowRed, iGlowGreen, iGlowBlue
parse(szGlowColors, gGlowRed, 3, gGlowGreen, 3, gGlowBlue, 3)
iGlowRed = clamp(str_to_num(gGlowRed), 0, 255)
iGlowGreen = clamp(str_to_num(gGlowGreen), 0, 255)
iGlowBlue = clamp(str_to_num(gGlowBlue), 0, 255)
fm_set_rendering(player, kRenderFxGlowShell, iGlowRed, iGlowGreen, iGlowBlue, kRenderNormal, 16)
// Se for nemesis desativa a aura
if(zp_get_user_nemesis(player))
{
remove_task(player + TASK_AURA)
}
set_pev(player, pev_armorvalue, float(min(pev(player, pev_armorvalue)+g_armor_amount, g_armor_limit)))
engfunc(EngFunc_EmitSound, player, CHAN_BODY, g_sound_buyarmor, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
/*===============================================================================
[O Bang que dara Aura e Faca Rapida]
=================================================================================*/
public fwd_Knife_PriAtk_Post(ent)
{
if (!get_pcvar_num(cvar_Primary))
return HAM_IGNORED;
static owner
owner = ham_cs_get_weapon_ent_owner(ent)
if (!g_hasCarniceiro[owner])
return HAM_IGNORED
static Float:Speed, Float:Primary, Float:Secondary
Speed = get_pcvar_float(cvar_PrimarySpeed)
Primary = get_pdata_float(ent, m_flNextPrimaryAttack, OFFSET_LINUX_WEAPONS) * Speed
Secondary = get_pdata_float(ent, m_flNextSecondaryAttack, OFFSET_LINUX_WEAPONS) * Speed
if (Primary > 0.0 && Secondary > 0.0)
{
set_pdata_float(ent, m_flNextPrimaryAttack, Primary, OFFSET_LINUX_WEAPONS)
set_pdata_float(ent, m_flNextSecondaryAttack, Secondary, OFFSET_LINUX_WEAPONS)
}
return HAM_IGNORED;
}
public fwd_Knife_SecAtk_Post(ent)
{
if (!get_pcvar_num(cvar_Secondary))
return HAM_IGNORED;
static owner
owner = ham_cs_get_weapon_ent_owner(ent)
if (!g_hasCarniceiro[owner])
return HAM_IGNORED
static Float:Speed, Float:Primary, Float:Secondary
Speed = get_pcvar_float(cvar_SecondarySpeed)
Primary = get_pdata_float(ent, m_flNextPrimaryAttack, OFFSET_LINUX_WEAPONS) * Speed
Secondary = get_pdata_float(ent, m_flNextSecondaryAttack, OFFSET_LINUX_WEAPONS) * Speed
if (Primary > 0.0 && Secondary > 0.0)
{
set_pdata_float(ent, m_flNextPrimaryAttack, Primary, OFFSET_LINUX_WEAPONS)
set_pdata_float(ent, m_flNextSecondaryAttack, Secondary, OFFSET_LINUX_WEAPONS)
}
return HAM_IGNORED;
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( IsValidUser( attacker ) && get_user_weapon(attacker) == CSW_KNIFE && g_hasCarniceiro[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public aura(id)
{
id -= TASK_AURA
if (!is_user_alive(id))
return
// Codigo de kiske para passar de cvar a cor
new szColors[16]
get_pcvar_string(cvar_color, szColors, 15)
new gRed[4], gGreen[4], gBlue[4], iRed, iGreen, iBlue
parse(szColors, gRed, 3, gGreen, 3, gBlue, 3)
iRed = clamp(str_to_num(gRed), 0, 255)
iGreen = clamp(str_to_num(gGreen), 0, 255)
iBlue = clamp(str_to_num(gBlue), 0, 255)
//
static Float:FOrigin[3]
pev(id, pev_origin, FOrigin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, FOrigin, 0)
write_byte(TE_DLIGHT)
engfunc(EngFunc_WriteCoord, FOrigin[0])
engfunc(EngFunc_WriteCoord, FOrigin[1])
engfunc(EngFunc_WriteCoord, FOrigin[2])
write_byte(get_pcvar_num(cvar_size)) // Tamaño
write_byte(iRed) // R
write_byte(iGreen) // G
write_byte(iBlue) // B
write_byte(2)
write_byte(0)
message_end()
}
/*===============================================================================
[Mensagem Colorida (client_printcolor)]
=================================================================================*/
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();
}
}
}
}
stock ham_cs_get_weapon_ent_owner(entity)
{
return get_pdata_cbase(entity, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
}