Ola pessoal raramente tenho duvidas aqui mas eu vo postar uma delas.
Eu estava tentando fazer a elemental para 4.3 usando a nitrogen galil e a flame xm1014 como base mas no maximo que consegui foi fazer soltar fumaça quando atiro no zm.
Eis a SMA:
@Edit
Já Consegui Fazer Então: Closed !
Eu estava tentando fazer a elemental para 4.3 usando a nitrogen galil e a flame xm1014 como base mas no maximo que consegui foi fazer soltar fumaça quando atiro no zm.
Eis a SMA:
- Código:
#include <amxmodx>
#include <fakemeta>
#include < fun >
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#include < xs >
#define is_valid_player(%1) (1 <= %1 <= 32)
#define ITEM_NAME "Elemental \r[Fire & Frost]"
#define ITEM_COST 65
new EL_V_MODEL[64] = "models/zombie_plague/v_Elemental.mdl"
new EL_P_MODEL[64] = "models/zombie_plague/p_Elemental.mdl"
new const burn_sounds[ ][ ] =
{
"zombie_plague/zombie_burn3.wav",
"zombie_plague/zombie_burn4.wav",
"zombie_plague/zombie_burn5.wav",
"zombie_plague/zombie_burn6.wav",
"zombie_plague/zombie_burn7.wav"
}
/* Pcvars */
new cvar_custommodel, cvar_tracer, cvar_uclip, cvar_fr_duration
new cvar_MaxBurnDMG, cvar_MinBurnDMG, cvar_BurnTime, cvar_Delay, cvar_MinHealth
new cvar_cMaxBurnDMG, cvar_cMinBurnDMG, cvar_cBurnTime, Float:cvar_cDelay, cvar_cMinHealth
new Time[ 33 ]
new sprFlame, sprSmoke
// Item ID
new g_itemid
new bool:g_HasEL[33]
new bool:g_AlreadyBurn[ 33 ]
new g_hasZoom[ 33 ]
new bullets[ 33 ]
new g_FrozeN[33]
new NitrogenGalilSpr
new g_msgScreenFade
new g_MaxPlayers
new BackSpeed1
new BackSpeed2
// Sprite
new m_spriteTexture
const Wep_elite = ((1<<CSW_ELITE))
const UNIT_SECOND = (1<<12)
const FFADE_IN = 0x0000
public plugin_init()
{
/* CVARS */
cvar_custommodel = register_cvar("zp_ultra_custom_model", "1")
cvar_uclip = register_cvar("zp_ultra_unlimited_clip", "1")
cvar_tracer = register_cvar("zp_elemental_tracers", "1")
cvar_fr_duration = register_cvar("zp_frost_duration","3.0")
cvar_BurnTime = register_cvar( "zp_flame_duration", "12" )
cvar_MaxBurnDMG = register_cvar( "zp_flame_maxdmg", "3" )
cvar_MinBurnDMG = register_cvar( "zp_flame_mindmg", "1" )
cvar_Delay = register_cvar( "zp_flame_delay", "4.0" )
cvar_MinHealth = register_cvar( "zp_flame_minhp", "50" )
BackSpeed1 = register_cvar("zp_ng_back_spd_h", "300.0")
BackSpeed2 = register_cvar("zp_ng_back_spd_z", "300.0")
// Register The Plugin
register_plugin("[ZP] Extra: Elemental", "1.1", "Catastrophe")
// Register Zombie Plague extra item
g_itemid = zp_register_extra_item(ITEM_NAME, ITEM_COST, ZP_TEAM_HUMAN)
register_event("DeathMsg", "Death", "a")
// Weapon Pick Up
register_event("WeapPickup","checkModel","b","1=19")
//Previne o bug do gelo
register_event("ResetHUD", "playerSpawn", "be")
register_clcmd( "drop", "HookDrop" )
// 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)
RegisterHam( Ham_Killed, "player", "fw_PlayerKilled_Post", 1 )
}
public event_round_start( )
{
for (new i = 1; i <= g_MaxPlayers; i++)
{
if (!is_user_connected(i))
continue
if (g_HasEL[i])
{
g_HasEL[i] = false
}
if(g_FrozeN[i])
{
g_FrozeN[i] = false
}
}
cvar_cMaxBurnDMG = get_pcvar_num( cvar_MaxBurnDMG )
cvar_cMinBurnDMG = get_pcvar_num( cvar_MinBurnDMG )
cvar_cBurnTime = get_pcvar_num( cvar_BurnTime )
cvar_cDelay = get_pcvar_float( cvar_Delay )
cvar_cMinHealth = get_pcvar_num( cvar_MinHealth )
}
public playerSpawn(id)
{
g_FrozeN[id] = false
}
public client_connect(id)
{
g_HasEL[id] = false
g_FrozeN[id] = false
}
public client_disconnect(id)
{
g_HasEL[id] = false
g_FrozeN[id] = false
}
public Death()
{
g_HasEL[read_data(2)] = false
}
public fwHamPlayerSpawnPost(id)
{
g_HasEL[id] = false
g_FrozeN[id] = false
}
public fw_PlayerKilled_Post( victim, attacker, shouldgib )
{
if(g_HasEL[ victim ] )
g_HasEL[ victim ] = false
}
public HookDrop( id )
{
if(is_user_alive( id ) && get_user_weapon( id ) == CSW_ELITE && g_HasEL [ id ] )
{
g_HasEL[ id ] = false
}
}
public plugin_precache()
{
precache_model(EL_V_MODEL)
precache_model(EL_P_MODEL)
m_spriteTexture = precache_model("sprites/dot.spr")
precache_sound("weapons/zoom.wav")
precache_sound("warcraft3/impalehit.wav");
sprFlame = precache_model( "sprites/flame.spr" )
sprSmoke = precache_model( "sprites/black_smoke3.spr" )
NitrogenGalilSpr = precache_model("sprites/shockwave.spr");
for( new i = 0; i < sizeof burn_sounds; i++ )
precache_sound( burn_sounds[ i ] )
}
public zp_user_infected_post(id)
{
if (zp_get_user_zombie(id))
{
g_HasEL[id] = false
}
}
public checkModel(id)
{
if ( zp_get_user_zombie(id) )
return PLUGIN_HANDLED
new szWeapID = read_data(2)
if ( szWeapID == CSW_ELITE && g_HasEL[id] == true && get_pcvar_num(cvar_custommodel) )
{
set_pev(id, pev_viewmodel2, EL_V_MODEL)
set_pev(id, pev_weaponmodel2, EL_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_ELITE && g_HasEL[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_ELITE && g_HasEL[attacker] )
{
switch(random_num(1,100))
{
case 1..30:
{
if(!is_user_connected(attacker) || !is_user_connected(victim) || zp_get_user_nemesis(victim) || attacker == victim || !attacker)
return HAM_IGNORED
// For Frost Effect Ring
static Float:originF[3]
pev(victim, pev_origin, originF)
// For Frost Effect Sound
static originF2[3]
get_user_origin(victim, originF2)
if (g_HasEL[attacker] && get_user_weapon(attacker) == CSW_ELITE)
{
FrostEffect(victim)
FrostEffectRing(originF)
FrostEffectSound(originF2)
}
return HAM_IGNORED
}
case 31..100:
{
if( is_valid_player( attacker ) && victim != attacker && zp_get_user_zombie( victim )
&& g_HasEL[ attacker ] && get_user_weapon( attacker ) == CSW_ELITE && !g_AlreadyBurn[ victim ] && get_user_health( victim ) > cvar_cMinHealth ) // O bang que fara pegar fogo no player
{
// Burn / ON
g_AlreadyBurn[ victim ] = true
// Set burn time
Time[ victim ] = cvar_cBurnTime
// Burn victim
Burn( victim )
// Emit burn sound
emit_sound( victim, CHAN_VOICE, burn_sounds[random_num(0, sizeof burn_sounds - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
}
}
}
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
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_ELITE && g_HasEL[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_ELITE && g_HasEL[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_tracer))
{
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_ELITE) && g_HasEL[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)
switch(random_num(1, 100))
{
case 1..30 :
{
//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( 0 ) // r, g, b
write_byte( 180 ) // r, g, b
write_byte( 255 ) // r, g, b
write_byte(200) // brightness
write_byte(150) // speed
message_end()
}
case 31..100 :
{
//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( 255 ) // r, g, b
write_byte( 175 ) // r, g, b
write_byte( 0 ) // 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_ELITE) )
{
drop_prim(player)
}
give_item(player, "weapon_elite")
client_print(player, print_chat, "[ZP] You bought an Elemental")
g_HasEL[player] = true;
}
}
public fw_PlayerPreThink(id)
{
switch(random_num(1, 100))
{
case 1..30:
{
if (!is_user_alive(id))
return;
// Set Player MaxSpeed
if (g_FrozeN[id])
{
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0}) // stop motion
set_pev(id, pev_maxspeed, 1.0) // prevent from moving
}
else
{
if(!zp_get_user_zombie(id))
{
set_pev(id, pev_maxspeed, get_pcvar_float(BackSpeed1)) // Change this in Cvar if you Want
}
else
{
set_pev(id, pev_maxspeed, get_pcvar_float(BackSpeed2)) // Change this in Cvar if you Want
}
}
}
case 31..100:
{
if (!is_user_alive(id))
return;
}
}
}
// Frost Effect
public FrostEffect(id)
{
// Only effect alive unfrozen zombies
if (!is_user_alive(id) || !zp_get_user_zombie(id) || g_FrozeN[id])
return;
message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
write_short(UNIT_SECOND*1) // duration
write_short(UNIT_SECOND*1) // hold time
write_short(0x0000) // fade type
write_byte(0) // red
write_byte(50) // green
write_byte(200) // blue
write_byte(100) // alpha
message_end()
// Light blue glow while frozen
#if defined HANDLE_MODELS_ON_SEPARATE_ENT
fm_set_rendering(g_ent_playermodel[id], kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
#else
fm_set_rendering(id, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
#endif
g_FrozeN[id] = true
set_task(get_pcvar_float(cvar_fr_duration), "RemoveFrost", id) // O bang que ira descongelar o kra
}
// Frost Effect Sound
public FrostEffectSound(iOrigin[3])
{
new Entity = create_entity("info_target")
new Float:flOrigin[3]
IVecFVec(iOrigin, flOrigin)
entity_set_origin(Entity, flOrigin)
emit_sound(Entity, CHAN_WEAPON, "warcraft3/impalehit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
remove_entity(Entity)
}
// Frost Effect Ring
FrostEffectRing(const Float:originF3[3])
{
// Largest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF3, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF3[0]) // x
engfunc(EngFunc_WriteCoord, originF3[1]) // y
engfunc(EngFunc_WriteCoord, originF3[2]) // z
engfunc(EngFunc_WriteCoord, originF3[0]) // x axis
engfunc(EngFunc_WriteCoord, originF3[1]) // y axis
engfunc(EngFunc_WriteCoord, originF3[2]+100.0) // z axis
write_short(NitrogenGalilSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(41) // red
write_byte(138) // green
write_byte(255) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
}
public RemoveFrost(id)
{
// Not alive or not frozen anymore
if (!is_user_alive(id) || !g_FrozeN[id])
return;
// Unfreeze
g_FrozeN[id] = false;
// Remove glow
#if defined HANDLE_MODELS_ON_SEPARATE_ENT
fm_set_rendering(g_ent_playermodel[id])
#else
fm_set_rendering(id)
#endif
}
public Burn( victim )
{
// Get user origin
static Origin[ 3 ] ; get_user_origin( victim, Origin )
// If burn time is over or victim are in water
if( Time[ victim ] <= 0 || get_entity_flags( victim ) & FL_INWATER )
{
// Show Smoke sprite
message_begin( MSG_PVS, SVC_TEMPENTITY, Origin )
write_byte( TE_SMOKE ) // TE id
write_coord( Origin[0] ) // x
write_coord( Origin[1] ) // y
write_coord( Origin[2]-50 ) // z
write_short( sprSmoke ) // sprite
write_byte( random_num(15, 20) ) // scale
write_byte( random_num(10, 20) ) // framerate
message_end( )
// Delay to allow burn again
set_task( cvar_cDelay, "Stop", victim )
// Exit
return
}
else
{
if( cvar_cBurnTime / 2 == Time[ victim ] ) // At half-burntime
{
// Play another sound
emit_sound( victim, CHAN_VOICE, burn_sounds[ random_num( 0, charsmax( burn_sounds ) ) ], 1.0, ATTN_NORM, 0, PITCH_NORM )
}
// Flame sprite
message_begin( MSG_PVS, SVC_TEMPENTITY, Origin )
write_byte( TE_SPRITE ) // TE id
write_coord( Origin[0]+random_num(-5, 5) ) // x
write_coord( Origin[1]+random_num(-5, 5) ) // y
write_coord( Origin[2]+random_num(-10, 10) ) // z
write_short( sprFlame ) // sprite
write_byte( random_num(5, 10) ) // scale
write_byte( 200 ) // brightness
message_end( )
// Decrease Time
Time[ victim ]--
// Decrease life (random)
set_user_health( victim, get_user_health( victim ) - random_num( cvar_cMinBurnDMG, cvar_cMaxBurnDMG ) )
// Stop fire if health <= min health.
if( get_user_health( victim ) <= cvar_cMinHealth )
{
g_AlreadyBurn[ victim ] = false
return
}
// Repeat
set_task( 0.5, "Burn", victim )
}
}
public Stop( victim )
{
g_AlreadyBurn[ victim ] = false // Allow burn again
}
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
static Float:color[3]
color[0] = float(r)
color[1] = float(g)
color[2] = float(b)
set_pev(entity, pev_renderfx, fx)
set_pev(entity, pev_rendercolor, color)
set_pev(entity, pev_rendermode, render)
set_pev(entity, pev_renderamt, float(amount))
}
stock drop_prim(id)
{
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; i++) {
if (Wep_elite & (1<<weapons[i]))
{
static wname[32]
get_weaponname(weapons[i], wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
@Edit
Já Consegui Fazer Então: Closed !
Última edição por [P]erfec[T] [S]cr[@]s[H] em 20/10/2013, 2:22 am, editado 1 vez(es)