Estava customizando umas .sma, pra ficar com as siglas do nome do server.
Mas eu colocava pra ficar Red, algumas ficava outras não.
Alguem pode me explicar o que devo fazer ?
Imagem :
Estava colocando assim :
// Register Zombie Plague extra item
g_itemid = zp_register_extra_item("Cinder M4A1 \r[BNVD]", 70, ZP_TEAM_HUMAN)
Sma da Cinder :
Sma do Kit De Damage :
Agradeço quem me ajudar REP+
Mas eu colocava pra ficar Red, algumas ficava outras não.
Alguem pode me explicar o que devo fazer ?
Imagem :
Estava colocando assim :
// Register Zombie Plague extra item
g_itemid = zp_register_extra_item("Cinder M4A1 \r[BNVD]", 70, ZP_TEAM_HUMAN)
Sma da Cinder :
Sma Cinder :
#include
#include
#include < fun >
#include
#include
#include
#define is_valid_player(%1) (1 <= %1 <= 32)
new M4_V_MODEL[64] = "models/zombie_plague/v_m4a1_super_new_v1.mdl"
new M4_P_MODEL[64] = "models/zombie_plague/p_m4a1_super_new_v1.mdl"
/* Pcvars */
new cvar_dmgmultiplier, cvar_goldbullets, cvar_custommodel, cvar_uclip
// Item ID
new g_itemid
new bool:g_HasM4[33]
new g_hasZoom[ 33 ]
new bullets[ 33 ]
// Sprite
new m_spriteTexture
const Wep_m4a1 = ((1<
public plugin_init()
{
/* CVARS */
cvar_dmgmultiplier = register_cvar("zp_goldenm4_dmg_multiplier", "12")
cvar_custommodel = register_cvar("zp_goldenm4_custom_model", "1")
cvar_goldbullets = register_cvar("zp_goldenm4_gold_bullets", "1")
cvar_uclip = register_cvar("zp_goldenm4_unlimited_clip", "1")
// Register The Plugin
register_plugin("[ZP] Extra: Golden M4A1", "1.1", "Bill=Thailand=[UP]")
// Register Zombie Plague extra item
g_itemid = zp_register_extra_item("Cinder M4A1 \r[BNVD]", 70, ZP_TEAM_HUMAN)
// Death Msg
register_event("DeathMsg", "Death", "a")
// Weapon Pick Up
register_event("WeapPickup","checkModel","b","1=19")
// Current Weapon Event
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
// Ham TakeDamage
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward( FM_CmdStart, "fw_CmdStart" )
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
}
public client_connect(id)
{
g_HasM4[id] = false
}
public client_disconnect(id)
{
g_HasM4[id] = false
}
public Death()
{
g_HasM4[read_data(2)] = false
}
public fwHamPlayerSpawnPost(id)
{
g_HasM4[id] = false
}
public plugin_precache()
{
precache_model(M4_V_MODEL)
precache_model(M4_P_MODEL)
m_spriteTexture = precache_model("sprites/dot.spr")
precache_sound("weapons/zoom.wav")
}
public zp_user_infected_post(id)
{
if (zp_get_user_zombie(id))
{
g_HasM4[id] = false
}
}
public checkModel(id)
{
if ( zp_get_user_zombie(id) )
return PLUGIN_HANDLED
new szWeapID = read_data(2)
if ( szWeapID == CSW_M4A1 && g_HasM4[id] == true && get_pcvar_num(cvar_custommodel) )
{
set_pev(id, pev_viewmodel2, M4_V_MODEL)
set_pev(id, pev_weaponmodel2, M4_P_MODEL)
}
return PLUGIN_HANDLED
}
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_M4A1 && g_HasM4[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
}
if (plrClip == 0 && get_pcvar_num(cvar_uclip))
{
// If the user is out of ammo..
get_weaponname(plrWeapId, plrWeap, 31)
// Get the name of their weapon
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_M4A1 && g_HasM4[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public fw_CmdStart( id, uc_handle, seed )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED
if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
{
new szClip, szAmmo
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if( szWeapID == CSW_M4A1 && g_HasM4[id] == true && !g_hasZoom[id] == true)
{
g_hasZoom[id] = true
cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
}
else if ( szWeapID == CSW_M4A1 && g_HasM4[id] == true && g_hasZoom[id])
{
g_hasZoom[ id ] = false
cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
}
}
return PLUGIN_HANDLED
}
public make_tracer(id)
{
if (get_pcvar_num(cvar_goldbullets))
{
new clip,ammo
new wpnid = get_user_weapon(id,clip,ammo)
new pteam[16]
get_user_team(id, pteam, 15)
if ((bullets[id] > clip) && (wpnid == CSW_M4A1) && g_HasM4[id])
{
new vec1[3], vec2[3]
get_user_origin(id, vec1, 1) // origin; your camera point.
get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
//BEAMENTPOINTS
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0) //TE_BEAMENTPOINTS 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( m_spriteTexture )
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(10) // width
write_byte(0) // noise
write_byte( 30 ) // r, g, b
write_byte( 144 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte(200) // brightness
write_byte(150) // speed
message_end()
}
bullets[id] = clip
}
}
public zp_extra_item_selected(player, itemid)
{
if ( itemid == g_itemid )
{
if ( user_has_weapon(player, CSW_M4A1) )
{
drop_prim(player)
}
give_item(player, "weapon_m4a1")
client_print(player, print_chat, "[ZP] Voce comprou Golden M4A1")
g_HasM4[player] = true;
}
}
stock drop_prim(id)
{
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; i++) {
if (Wep_m4a1 & (1< {
static wname[32]
get_weaponname(weapons[i], wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
#include
#include < fun >
#include
#include
#include
#define is_valid_player(%1) (1 <= %1 <= 32)
new M4_V_MODEL[64] = "models/zombie_plague/v_m4a1_super_new_v1.mdl"
new M4_P_MODEL[64] = "models/zombie_plague/p_m4a1_super_new_v1.mdl"
/* Pcvars */
new cvar_dmgmultiplier, cvar_goldbullets, cvar_custommodel, cvar_uclip
// Item ID
new g_itemid
new bool:g_HasM4[33]
new g_hasZoom[ 33 ]
new bullets[ 33 ]
// Sprite
new m_spriteTexture
const Wep_m4a1 = ((1<
public plugin_init()
{
/* CVARS */
cvar_dmgmultiplier = register_cvar("zp_goldenm4_dmg_multiplier", "12")
cvar_custommodel = register_cvar("zp_goldenm4_custom_model", "1")
cvar_goldbullets = register_cvar("zp_goldenm4_gold_bullets", "1")
cvar_uclip = register_cvar("zp_goldenm4_unlimited_clip", "1")
// Register The Plugin
register_plugin("[ZP] Extra: Golden M4A1", "1.1", "Bill=Thailand=[UP]")
// Register Zombie Plague extra item
g_itemid = zp_register_extra_item("Cinder M4A1 \r[BNVD]", 70, ZP_TEAM_HUMAN)
// Death Msg
register_event("DeathMsg", "Death", "a")
// Weapon Pick Up
register_event("WeapPickup","checkModel","b","1=19")
// Current Weapon Event
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
// Ham TakeDamage
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward( FM_CmdStart, "fw_CmdStart" )
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
}
public client_connect(id)
{
g_HasM4[id] = false
}
public client_disconnect(id)
{
g_HasM4[id] = false
}
public Death()
{
g_HasM4[read_data(2)] = false
}
public fwHamPlayerSpawnPost(id)
{
g_HasM4[id] = false
}
public plugin_precache()
{
precache_model(M4_V_MODEL)
precache_model(M4_P_MODEL)
m_spriteTexture = precache_model("sprites/dot.spr")
precache_sound("weapons/zoom.wav")
}
public zp_user_infected_post(id)
{
if (zp_get_user_zombie(id))
{
g_HasM4[id] = false
}
}
public checkModel(id)
{
if ( zp_get_user_zombie(id) )
return PLUGIN_HANDLED
new szWeapID = read_data(2)
if ( szWeapID == CSW_M4A1 && g_HasM4[id] == true && get_pcvar_num(cvar_custommodel) )
{
set_pev(id, pev_viewmodel2, M4_V_MODEL)
set_pev(id, pev_weaponmodel2, M4_P_MODEL)
}
return PLUGIN_HANDLED
}
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_M4A1 && g_HasM4[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
}
if (plrClip == 0 && get_pcvar_num(cvar_uclip))
{
// If the user is out of ammo..
get_weaponname(plrWeapId, plrWeap, 31)
// Get the name of their weapon
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_M4A1 && g_HasM4[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public fw_CmdStart( id, uc_handle, seed )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED
if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
{
new szClip, szAmmo
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if( szWeapID == CSW_M4A1 && g_HasM4[id] == true && !g_hasZoom[id] == true)
{
g_hasZoom[id] = true
cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
}
else if ( szWeapID == CSW_M4A1 && g_HasM4[id] == true && g_hasZoom[id])
{
g_hasZoom[ id ] = false
cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
}
}
return PLUGIN_HANDLED
}
public make_tracer(id)
{
if (get_pcvar_num(cvar_goldbullets))
{
new clip,ammo
new wpnid = get_user_weapon(id,clip,ammo)
new pteam[16]
get_user_team(id, pteam, 15)
if ((bullets[id] > clip) && (wpnid == CSW_M4A1) && g_HasM4[id])
{
new vec1[3], vec2[3]
get_user_origin(id, vec1, 1) // origin; your camera point.
get_user_origin(id, vec2, 4) // termina; where your bullet goes (4 is cs-only)
//BEAMENTPOINTS
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0) //TE_BEAMENTPOINTS 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( m_spriteTexture )
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(10) // width
write_byte(0) // noise
write_byte( 30 ) // r, g, b
write_byte( 144 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte(200) // brightness
write_byte(150) // speed
message_end()
}
bullets[id] = clip
}
}
public zp_extra_item_selected(player, itemid)
{
if ( itemid == g_itemid )
{
if ( user_has_weapon(player, CSW_M4A1) )
{
drop_prim(player)
}
give_item(player, "weapon_m4a1")
client_print(player, print_chat, "[ZP] Voce comprou Golden M4A1")
g_HasM4[player] = true;
}
}
stock drop_prim(id)
{
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; i++) {
if (Wep_m4a1 & (1<
static wname[32]
get_weaponname(weapons[i], wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
Sma do Kit De Damage :
Kit De Damage :
#include
#include
#include
#include
#include < fun >
#include
new cvar_knife_dmg, cvar_m3_dmg
new cvar_deagle_dmg, g_itemid, cvar_health, cvar_armor
new cvar_red, cvar_green, cvar_blue
new cvar_color, cvar_size
#define TASK_AURA 27000
new bool:g_bHasKitDamage[33], g_maxplayers, g_msgSayText
const kit_damage_ap_cost = 90
new const v_m3_model[] = "models/kit_de_damage_new/v_kit_m3_new.mdl"
new const p_m3_model[] = "models/kit_de_damage_new/p_kit_m3_new.mdl"
new const v_deagle_model[] = "models/kit_de_damage_new/v_kit_deagle_new.mdl"
new const p_deagle_model[] = "models/kit_de_damage_new/p_kit_deagle_new.mdl"
new const v_knife_model[] = "models/kit_de_damage_new/v_kit_knife_new.mdl"
new const p_knife_model[] = "models/kit_de_damage_new/p_kit_knife_new.mdl"
public plugin_init()
{
register_plugin("Kit de Damage" , "1.3b", "lucas_7_94")
register_cvar ("zp_extra_damage", "1.3b", FCVAR_SERVER)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("CurWeapon", "event_CurWeapon", "be", "1=1")
g_itemid = zp_register_extra_item("Kit de Damage \r[BNVD]", kit_damage_ap_cost, ZP_TEAM_HUMAN)
cvar_m3_dmg = register_cvar ("zp_m3_damage", "6.0")
cvar_knife_dmg = register_cvar ("zp_knife_damage", "4.0")
cvar_deagle_dmg = register_cvar ("zp_deagle_damage", "6.0")
cvar_health = register_cvar ("zp_kit_health", "400")
cvar_armor = register_cvar ("zp_kit_armor", "500")
cvar_red = register_cvar ("zp_kit_glow_R", "000")
cvar_green = register_cvar ("zp_kit_glow_G", "255")
cvar_blue = register_cvar ("zp_kit_glow_B", "255")
cvar_size = register_cvar ("zp_kit_aura_size", "20")
cvar_color = register_cvar ("zp_kit_aura_rgb", "0 255 255")
g_maxplayers = get_maxplayers()
g_msgSayText = get_user_msgid("SayText")
}
public plugin_precache()
{
precache_model(v_m3_model)
precache_model(p_m3_model)
precache_model(v_deagle_model)
precache_model(p_deagle_model)
precache_model(v_knife_model)
precache_model(p_knife_model)
}
public event_round_start()
{
{
for(new id = 1; id <= g_maxplayers; id++)
g_bHasKitDamage[id] = false
}
for (new id; id <= g_maxplayers; id++)
{
// Removemos a aura
remove_task(id + TASK_AURA)
}
}
public client_disconnect(id)
{
remove_task(id + TASK_AURA)
}
public zp_user_infected_post(id, infected, infector)
{
if (g_bHasKitDamage[id])
{
g_bHasKitDamage[id] = false
remove_task(id + TASK_AURA)
}
}
public zp_user_humanized_post(id, human)
{
if (g_bHasKitDamage[id])
{
g_bHasKitDamage[id] = false
}
}
public zp_user_humanized_pre(id)
{
if (g_bHasKitDamage[id])
{
g_bHasKitDamage[id] = false
remove_task(id + TASK_AURA)
}
}
public fw_player_killed(victim, attacker, shouldgib)
{
if(g_bHasKitDamage[victim])
{
KitDamage(victim, "^x04[ZP] ^x01Voce nao pode comprar o kit de damage!")
g_bHasKitDamage[victim] = false
}
}
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid)
{
if(g_bHasKitDamage[player])
{
KitDamage(player, "^x04[ZP] ^x01Voce ja tem o kit de damage")
zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + kit_damage_ap_cost)
return;
}
if (!zp_has_round_started())
{
KitDamage(player, "^x04[ZP] ^01Espere o round comecar...", player, "WAIT")
zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + kit_damage_ap_cost)
return;
}
else
{
new name[32]
new param[1]
param[0] = player
g_bHasKitDamage[player] = true
fm_set_user_health(player, get_user_health(player) + get_pcvar_num(cvar_health));
fm_set_user_armor(player, get_user_armor(player) + get_pcvar_num(cvar_armor));
fm_set_rendering(player, kRenderFxGlowShell, get_pcvar_num(cvar_red), get_pcvar_num(cvar_green), get_pcvar_num(cvar_blue), kRenderNormal, 16);
fm_strip_user_weapons(player)
give_item(player, "weapon_knife")
give_item(player, "weapon_deagle")
give_item(player, "weapon_m3")
give_item(player, "ammo_buckshot")
give_item(player, "ammo_buckshot")
give_item(player, "ammo_buckshot")
give_item(player, "ammo_buckshot")
set_task(0.1, "aura", player + TASK_AURA, _, _, "b")
set_hudmessage(0, 100, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
get_user_name(player, name, 31)
show_hudmessage(0, "O Jogador %s Comprou o Kit de Damage", name)
KitDamage(player, "^x04[ZP] ^01Voce comprou o kit de damage!!")
}
}
}
public event_CurWeapon(id)
{
new weapid = read_data(2)
if(!is_user_alive(id))
return;
if(g_bHasKitDamage[id] && weapid == CSW_M3)
{
entity_set_string(id, EV_SZ_viewmodel, v_m3_model)
entity_set_string(id, EV_SZ_weaponmodel, p_m3_model)
}
else if(g_bHasKitDamage[id] && weapid == CSW_DEAGLE)
{
entity_set_string(id, EV_SZ_viewmodel, v_deagle_model)
entity_set_string(id, EV_SZ_weaponmodel, p_deagle_model)
}
else if(g_bHasKitDamage[id] && weapid == CSW_KNIFE)
{
entity_set_string(id, EV_SZ_viewmodel, v_knife_model)
entity_set_string(id, EV_SZ_weaponmodel, p_knife_model)
}
}
public aura(id)
{
id -= TASK_AURA
if (!is_user_alive(id))
return
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))
write_byte(iRed) // R
write_byte(iGreen) // G
write_byte(iBlue) // B
write_byte(2)
write_byte(0)
message_end()
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(!(1 <= attacker <= g_maxplayers))
return HAM_IGNORED;
if(get_user_weapon(attacker) != CSW_M3)
if(get_user_weapon(attacker) != CSW_DEAGLE)
if(get_user_weapon(attacker) != CSW_KNIFE)
return HAM_IGNORED;
if (get_user_weapon(attacker) && g_bHasKitDamage[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_m3_dmg))
SetHamParamFloat(4, damage * get_pcvar_float(cvar_deagle_dmg))
SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_dmg))
}
return HAM_IGNORED;
}
KitDamage(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
// Send to everyone
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
// Not connected
if (!is_user_connected(player))
continue;
static changed[5], changedcount;
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, sizeof buffer - 1, message, 3)
message_begin(MSG_ONE, g_msgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
else
{
// Format message for player
vformat(buffer, sizeof buffer - 1, message, 3)
// Send it
message_begin(MSG_ONE, g_msgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
#include
#include
#include
#include < fun >
#include
new cvar_knife_dmg, cvar_m3_dmg
new cvar_deagle_dmg, g_itemid, cvar_health, cvar_armor
new cvar_red, cvar_green, cvar_blue
new cvar_color, cvar_size
#define TASK_AURA 27000
new bool:g_bHasKitDamage[33], g_maxplayers, g_msgSayText
const kit_damage_ap_cost = 90
new const v_m3_model[] = "models/kit_de_damage_new/v_kit_m3_new.mdl"
new const p_m3_model[] = "models/kit_de_damage_new/p_kit_m3_new.mdl"
new const v_deagle_model[] = "models/kit_de_damage_new/v_kit_deagle_new.mdl"
new const p_deagle_model[] = "models/kit_de_damage_new/p_kit_deagle_new.mdl"
new const v_knife_model[] = "models/kit_de_damage_new/v_kit_knife_new.mdl"
new const p_knife_model[] = "models/kit_de_damage_new/p_kit_knife_new.mdl"
public plugin_init()
{
register_plugin("Kit de Damage" , "1.3b", "lucas_7_94")
register_cvar ("zp_extra_damage", "1.3b", FCVAR_SERVER)
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("CurWeapon", "event_CurWeapon", "be", "1=1")
g_itemid = zp_register_extra_item("Kit de Damage \r[BNVD]", kit_damage_ap_cost, ZP_TEAM_HUMAN)
cvar_m3_dmg = register_cvar ("zp_m3_damage", "6.0")
cvar_knife_dmg = register_cvar ("zp_knife_damage", "4.0")
cvar_deagle_dmg = register_cvar ("zp_deagle_damage", "6.0")
cvar_health = register_cvar ("zp_kit_health", "400")
cvar_armor = register_cvar ("zp_kit_armor", "500")
cvar_red = register_cvar ("zp_kit_glow_R", "000")
cvar_green = register_cvar ("zp_kit_glow_G", "255")
cvar_blue = register_cvar ("zp_kit_glow_B", "255")
cvar_size = register_cvar ("zp_kit_aura_size", "20")
cvar_color = register_cvar ("zp_kit_aura_rgb", "0 255 255")
g_maxplayers = get_maxplayers()
g_msgSayText = get_user_msgid("SayText")
}
public plugin_precache()
{
precache_model(v_m3_model)
precache_model(p_m3_model)
precache_model(v_deagle_model)
precache_model(p_deagle_model)
precache_model(v_knife_model)
precache_model(p_knife_model)
}
public event_round_start()
{
{
for(new id = 1; id <= g_maxplayers; id++)
g_bHasKitDamage[id] = false
}
for (new id; id <= g_maxplayers; id++)
{
// Removemos a aura
remove_task(id + TASK_AURA)
}
}
public client_disconnect(id)
{
remove_task(id + TASK_AURA)
}
public zp_user_infected_post(id, infected, infector)
{
if (g_bHasKitDamage[id])
{
g_bHasKitDamage[id] = false
remove_task(id + TASK_AURA)
}
}
public zp_user_humanized_post(id, human)
{
if (g_bHasKitDamage[id])
{
g_bHasKitDamage[id] = false
}
}
public zp_user_humanized_pre(id)
{
if (g_bHasKitDamage[id])
{
g_bHasKitDamage[id] = false
remove_task(id + TASK_AURA)
}
}
public fw_player_killed(victim, attacker, shouldgib)
{
if(g_bHasKitDamage[victim])
{
KitDamage(victim, "^x04[ZP] ^x01Voce nao pode comprar o kit de damage!")
g_bHasKitDamage[victim] = false
}
}
public zp_extra_item_selected(player, itemid)
{
if (itemid == g_itemid)
{
if(g_bHasKitDamage[player])
{
KitDamage(player, "^x04[ZP] ^x01Voce ja tem o kit de damage")
zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + kit_damage_ap_cost)
return;
}
if (!zp_has_round_started())
{
KitDamage(player, "^x04[ZP] ^01Espere o round comecar...", player, "WAIT")
zp_set_user_ammo_packs(player, zp_get_user_ammo_packs(player) + kit_damage_ap_cost)
return;
}
else
{
new name[32]
new param[1]
param[0] = player
g_bHasKitDamage[player] = true
fm_set_user_health(player, get_user_health(player) + get_pcvar_num(cvar_health));
fm_set_user_armor(player, get_user_armor(player) + get_pcvar_num(cvar_armor));
fm_set_rendering(player, kRenderFxGlowShell, get_pcvar_num(cvar_red), get_pcvar_num(cvar_green), get_pcvar_num(cvar_blue), kRenderNormal, 16);
fm_strip_user_weapons(player)
give_item(player, "weapon_knife")
give_item(player, "weapon_deagle")
give_item(player, "weapon_m3")
give_item(player, "ammo_buckshot")
give_item(player, "ammo_buckshot")
give_item(player, "ammo_buckshot")
give_item(player, "ammo_buckshot")
set_task(0.1, "aura", player + TASK_AURA, _, _, "b")
set_hudmessage(0, 100, 255, -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
get_user_name(player, name, 31)
show_hudmessage(0, "O Jogador %s Comprou o Kit de Damage", name)
KitDamage(player, "^x04[ZP] ^01Voce comprou o kit de damage!!")
}
}
}
public event_CurWeapon(id)
{
new weapid = read_data(2)
if(!is_user_alive(id))
return;
if(g_bHasKitDamage[id] && weapid == CSW_M3)
{
entity_set_string(id, EV_SZ_viewmodel, v_m3_model)
entity_set_string(id, EV_SZ_weaponmodel, p_m3_model)
}
else if(g_bHasKitDamage[id] && weapid == CSW_DEAGLE)
{
entity_set_string(id, EV_SZ_viewmodel, v_deagle_model)
entity_set_string(id, EV_SZ_weaponmodel, p_deagle_model)
}
else if(g_bHasKitDamage[id] && weapid == CSW_KNIFE)
{
entity_set_string(id, EV_SZ_viewmodel, v_knife_model)
entity_set_string(id, EV_SZ_weaponmodel, p_knife_model)
}
}
public aura(id)
{
id -= TASK_AURA
if (!is_user_alive(id))
return
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))
write_byte(iRed) // R
write_byte(iGreen) // G
write_byte(iBlue) // B
write_byte(2)
write_byte(0)
message_end()
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(!(1 <= attacker <= g_maxplayers))
return HAM_IGNORED;
if(get_user_weapon(attacker) != CSW_M3)
if(get_user_weapon(attacker) != CSW_DEAGLE)
if(get_user_weapon(attacker) != CSW_KNIFE)
return HAM_IGNORED;
if (get_user_weapon(attacker) && g_bHasKitDamage[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_m3_dmg))
SetHamParamFloat(4, damage * get_pcvar_float(cvar_deagle_dmg))
SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_dmg))
}
return HAM_IGNORED;
}
KitDamage(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
// Send to everyone
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
// Not connected
if (!is_user_connected(player))
continue;
static changed[5], changedcount;
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, sizeof buffer - 1, message, 3)
message_begin(MSG_ONE, g_msgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
else
{
// Format message for player
vformat(buffer, sizeof buffer - 1, message, 3)
// Send it
message_begin(MSG_ONE, g_msgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
Agradeço quem me ajudar REP+