[Need Help] ZP M4A1 Frost By Raheem, Frost Elite!

Useless Stuffs, Spam ... etc
Post Reply
Mohamed
Member
Member
Tunisia
Posts: 15
Joined: 7 years ago
Contact:

[Need Help] ZP M4A1 Frost By Raheem, Frost Elite!

#1

Post by Mohamed » 7 years ago

Hi , i am so sory that i post something about zp here but want the maker to help me
i acutely convert m4a1 frost tp elite frost but when i test it the gun comes and i can buy it but the frost thing not working that 1000 dmg and zm get frost.
i am sory again i hope raheem help me and thanks

Code: Select all

#include <amxmodx>
#include <zombieplague>
#include <dhudmessage>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <engine>
#include <fun>

#define write_coord_fl(%1) engfunc(EngFunc_WriteCoord, %1)
#define message_begin_fl(%1,%2,%3,%4) engfunc(EngFunc_MessageBegin, %1, %2, %3, %4)

new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame

new const V_ELITE_MODEL[] = "models/v_elite.mdl"
new const P_ELITE_MODEL[] = "models/p_elite.mdl"
new const W_ELITE_MODEL[] = "models/w_elite.mdl" 
new const W_OLD_ELITE_MODEL[] = "models/w_elite.mdl"
new const ICE_MODEL[] = "models/zombie_plague/icecube_frozen.mdl"
new const MODEL_GLASSGIBS[]	= "models/glassgibs.mdl"
new const SOUND_UNFROZEN[]	= "debris/glass3.wav"

enum _:Sprites
{
SPRITE_FROST,
SPRITE_FROST2,
SPRITE_FLAKE
}

new g_iSprites[Sprites]

new g_iItemID, g_iELITEFrostSpr, g_iMsgScreenFade, g_iMaxPlayers, g_iHudSync, g_iSpriteLaser, g_iGlassGibs, g_iFreezeDmg, g_fFrostTime, g_iDmgMultiplier, g_iStatusIcon
new bool:g_bHasFrostElite [33], g_bIsFrozen[33], bool:g_bHasFrostELITE[33] 
new g_iDmg[33]

public plugin_init()
{
register_plugin("[ZP] Extra Item: Elite Frost", "1.4", "Raheem")

// Cvars
g_fFrostTime = register_cvar("zp_frost_elite_time", "7.0") // Freeze Time. It's Float you can make it 0.5
g_iFreezeDmg = register_cvar("zp_freezing_elite_damage", "1000") // Damage Requried So Zombie got Frozen
g_iDmgMultiplier = register_cvar("zp_multiplier_elite_damage", "5") // Multiplie Weapon Damage

// Message IDS
g_iHudSync = CreateHudSyncObj()
g_iMsgScreenFade = get_user_msgid("ScreenFade")
g_iStatusIcon = get_user_msgid("StatusIcon")

// Server Max Slots
g_iMaxPlayers = get_maxplayers()

// ITEM NAME & COST
g_iItemID = zp_register_extra_item("Frost ELITE", 5, ZP_TEAM_HUMAN) // It's cost 30 Ammo Pack

// Events
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("WeapPickup","CheckModel","b","1=19")
register_event("CurWeapon","CurrentWeapon","be","1=1")
register_event("DeathMsg", "EventDeathMsg", "a")

// Forwards
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
register_forward(FM_SetModel, "fw_SetModel")

// Hams
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
RegisterHam(Ham_Item_AddToPlayer, "weapon_elite", "fw_ELITEFROSTAddToPlayer")
}

public plugin_precache() 
{
// Models
precache_model(V_ELITE_MODEL) 
precache_model(P_ELITE_MODEL)
precache_model(W_ELITE_MODEL)
precache_model(ICE_MODEL)
g_iGlassGibs = precache_model(MODEL_GLASSGIBS)

// Sounds
precache_sound("warcraft3/impalehit.wav")
precache_sound(SOUND_UNFROZEN)

// Sprites
g_iELITEFrostSpr = precache_model("sprites/shockwave.spr")
g_iSpriteLaser = precache_model( "sprites/Newlightning.spr")
g_iSprites[SPRITE_FROST] = precache_model("sprites/frostexp_1.spr");
g_iSprites[SPRITE_FROST2] = precache_model("sprites/frostexp_2.spr");
g_iSprites[SPRITE_FLAKE] = precache_model("sprites/snowflake_1.spr");
}

public client_putinserver(id)
{
g_bHasFrostElite[id] = false
g_bIsFrozen[id] = false
}

public client_disconnect(id)
{
g_bHasFrostElite[id] = false
g_bIsFrozen[id] = false
RemoveEntity(id)
}

public zp_extra_item_selected(player, itemid)
{
if (itemid == g_iItemID) 
{
g_bHasFrostElite[player] = true
ham_strip_weapon(player, "weapon_elite")
give_item(player, "weapon_elite")
cs_set_user_bpammo(player, CSW_ELITE, 90)
new sName[32]
get_user_name(player, sName, 31)
set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
show_hudmessage(0, "%s Has bought Frost ELITE!", sName)
ColorPrint(player, "^1[^4ZP^1] ^3You Have bought Frost ELITE^1!")
}
}

public TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
{
if(!is_user_alive(iAttacker))
return 

if(get_user_weapon(iAttacker) != CSW_ELITE || !g_bHasFrostELITE[iAttacker])
return

set_hudmessage(34, 138, 255, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
ShowSyncHudMsg(iAttacker, g_iHudSync, "Freeze Damage^n%d/%d", g_iDmg[iAttacker], get_pcvar_num(g_iFreezeDmg))

new vec1[3], vec2[3]
get_user_origin(iAttacker, vec1, 1) 
get_user_origin(iAttacker, vec2, 4)

make_beam(vec1, vec2, g_iSpriteLaser, 0, 50, 200, 200)
}

public zp_user_infected_post(infected, infector)
{
if (g_bHasFrostELITE[infected])
{
g_bHasFrostELITE[infected] = false
}
}

public zp_user_humanized_post(id)
{
g_bHasFrostELITE[id] = false
g_iDmg[id] = 0
RemoveEntity(id)
}

public event_round_start()
{
for (new i = 1; i <= g_iMaxPlayers; i++)
{
g_bHasFrostELITE = false
g_bIsFrozen = false
g_iDmg = 0

if(is_user_alive(i))
{
Remove_Rendering(i)
}
}
}

public EventDeathMsg()
{
new iVictim = read_data(2)
RemoveEntity(iVictim)
Remove_Rendering(iVictim)
g_bIsFrozen[iVictim] = false
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(!is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_nemesis(victim) || attacker == victim || !attacker)
return HAM_IGNORED

if(g_bIsFrozen[victim])
return HAM_SUPERCEDE

if(g_bHasFrostELITE[attacker] && (get_user_weapon(attacker) == CSW_ELITE))
SetHamParamFloat(4, damage * get_pcvar_num(g_iDmgMultiplier))

// 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((get_user_weapon(attacker) == CSW_ELITE) && g_bHasFrostELITE[attacker])
{
g_iDmg[attacker] += (floatround(damage) * get_pcvar_num(g_iDmgMultiplier))
}

if((g_iDmg[attacker] >= get_pcvar_num(g_iFreezeDmg)) && (get_user_weapon(attacker) == CSW_ELITE) && g_bHasFrostELITE[attacker])
{
new sName[32]
get_user_name(victim, sName, charsmax(sName))
FrostEffect(victim)
FrostEffectRing(originF)
FrostEffectSound(originF2)
g_iDmg[attacker] = 0
set_dhudmessage(34, 138, 255, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5)
show_dhudmessage(attacker, "%s Has been Freezed!", sName)
}
return HAM_IGNORED
}

public CheckModel(id)
{
if(zp_get_user_survivor(id))
return PLUGIN_HANDLED

if (is_user_alive(id))
{
set_pev(id, pev_viewmodel2, V_ELITE_MODEL)
set_pev(id, pev_weaponmodel2, P_ELITE_MODEL)
}
return PLUGIN_HANDLED
}

public CurrentWeapon(id)
{
if ((get_user_weapon(id) == CSW_ELITE) && g_bHasFrostELITE[id] == true)
{
CheckModel(id)
}
else
{
ClearSyncHud(id, g_iHudSync)
}
return PLUGIN_HANDLED
}

public FrostEffect(id)
{
// Only effect alive unfrozen zombies
if (!is_user_alive(id) || !zp_get_user_zombie(id) || g_bIsFrozen[id])
return

message_begin(MSG_ONE_UNRELIABLE, g_iMsgScreenFade, _, id)
write_short(4096*1) // duration
write_short(4096*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()

message_begin(MSG_ONE, g_iStatusIcon, {0,0,0}, id)
write_byte(1) // Status [0=Hide, 1=Show, 2=Flash]
write_string("dmg_cold") // Sprite Name
write_byte(000) // Red
write_byte(206) // Green
write_byte(209) // Blue
message_end()

new ent = create_entity("info_target")

UTIL_Explosion(id, g_iSprites[SPRITE_FROST], 40, 30, 4)
UTIL_Explosion(id, g_iSprites[SPRITE_FROST2], 20, 30, 4)
UTIL_SpriteTrail(id, g_iSprites[SPRITE_FLAKE], 30, 3, 2, 30, 0)

new Float:iOrigin[3]
entity_get_vector(id, EV_VEC_origin, iOrigin)
set_pev(ent, pev_body, 1)
entity_set_model(ent, ICE_MODEL)
iOrigin[2] -= 35
entity_set_origin(ent, iOrigin)
set_pev(ent, pev_owner, id)
set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 255)
entity_set_string(ent, EV_SZ_classname, "ent_frozen")
entity_set_int(ent, EV_INT_solid, 2)
new Float: iOriginNew[3]
entity_get_vector(id, EV_VEC_origin, iOriginNew)
set_user_rendering(id, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
g_bIsFrozen[id] = true
set_task(get_pcvar_float(g_fFrostTime), "RemoveFrost", id) // Time to Remove Frost Effect 
}

public fw_PlayerPreThink(id)
{
// Not alive or Not Zombie
if (!is_user_alive(id) || !g_bIsFrozen[id])
return

// Stop motion
set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
set_user_maxspeed(id, 1.0)

// Stop Moving Mouse
set_pev(id , pev_v_angle , Float:{0.0,0.0,0.0})
set_pev(id , pev_fixangle , 1)
}

// 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)
}

UTIL_Explosion(iEnt, iSprite, iScale, iFramerate, Flags)
{
new Float:vOrigin[3]
pev(iEnt, pev_origin, vOrigin)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, vOrigin[0])
engfunc(EngFunc_WriteCoord, vOrigin[1])
engfunc(EngFunc_WriteCoord, vOrigin[2])
write_short(iSprite)
write_byte(iScale)
write_byte(iFramerate)
write_byte(Flags)
message_end()
}

UTIL_SpriteTrail(iEnt, iSprite, iCount, iLife, iScale, iVelocity, iVary)
{
new Float:vOrigin[3]
pev(iEnt, pev_origin, vOrigin)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITETRAIL)
engfunc(EngFunc_WriteCoord, vOrigin[0])
engfunc(EngFunc_WriteCoord, vOrigin[1])
engfunc(EngFunc_WriteCoord, vOrigin[2] + 100)
engfunc(EngFunc_WriteCoord, vOrigin[0] + random_float( -200.0, 200.0 ))
engfunc(EngFunc_WriteCoord, vOrigin[1] + random_float( -200.0, 200.0 ))
engfunc(EngFunc_WriteCoord, vOrigin[2])
write_short(iSprite)
write_byte(iCount)
write_byte(iLife)
write_byte(iScale)
write_byte(iVelocity)
write_byte(iVary)
message_end()
}

// 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(g_iELITEFrostSpr) // 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()
}

// Remove Frost Effect
public RemoveFrost(id)
{
// Not alive or not frozen anymore
if (!is_user_alive(id) || !g_bIsFrozen[id])
return

// Unfreeze
g_bIsFrozen[id] = false;
set_task(0.1, "remove_jibs", id)

// Rest Player Speed
ExecuteHamB(Ham_Player_ResetMaxSpeed, id)

Remove_Rendering(id)
RemoveStatusIcon(id)
}

public remove_jibs(id)
{
RemoveEntity(id)

new Float:origin[3]
pev(id,pev_origin,origin)

message_begin_fl(MSG_PVS,SVC_TEMPENTITY,origin,0)
write_byte(TE_IMPLOSION)
write_coord_fl(origin[0]) // x
write_coord_fl(origin[1]) // y
write_coord_fl(origin[2] + 8.0) // z
write_byte(64) // radius
write_byte(10) // count
write_byte(3) // duration
message_end()

message_begin_fl(MSG_PVS,SVC_TEMPENTITY,origin,0)
write_byte(TE_SPARKS)
write_coord_fl(origin[0]) // x
write_coord_fl(origin[1]) // y
write_coord_fl(origin[2]) // z
message_end()

message_begin_fl(MSG_PAS,SVC_TEMPENTITY,origin,0)
write_byte(TE_BREAKMODEL)
write_coord_fl(origin[0]) // x
write_coord_fl(origin[1]) // y
write_coord_fl(origin[2] + 24.0) // z
write_coord_fl(16.0) // size x
write_coord_fl(16.0) // size y
write_coord_fl(16.0) // size z
write_coord(random_num(-50,50)) // velocity x
write_coord(random_num(-50,50)) // velocity y
write_coord_fl(25.0) // velocity z
write_byte(10) // random velocity
write_short(g_iGlassGibs) // model
write_byte(10) // count
write_byte(25) // life
write_byte(0x01) // flags
message_end()

emit_sound(0,CHAN_ITEM,SOUND_UNFROZEN,VOL_NORM,ATTN_NORM,0,PITCH_LOW)
}

stock ColorPrint(const id, const input[], any: ...)
{
new count = 1, players[32]
static msg[192]
vformat(msg, 191, input, 3)

replace_all(msg, 191, "!g", "^4")
replace_all(msg, 191, "!y", "^1")
replace_all(msg, 191, "!t", "^3")
replace_all(msg, 191, "!t2", "^0")

if (id) players[0] = id;else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected( players))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
write_byte(players)
write_string(msg)
message_end()
}
}
}
}

stock ham_strip_weapon(id,weapon[])
{
if(!equal(weapon,"weapon_",7)) return 0

new wId = get_weaponid(weapon)
if(!wId) return 0

new wEnt
while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
if(!wEnt) return 0

if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)

if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0
ExecuteHamB(Ham_Item_Kill,wEnt)

set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId))

return 1
}

make_beam(const origin2[3], const origin[3], sprite, red, green, blue, alpha)
{
//BEAMENTPOINTS
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0) //TE_BEAMENTPOINTS 0
write_coord(origin2[0])
write_coord(origin2[1])
write_coord(origin2[2])
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_short(sprite) // sprite
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(20) // width
write_byte(0) // noise 
write_byte(red) // r, g, b
write_byte(green) // r, g, b 
write_byte(blue) // r, g, b 
write_byte(alpha) // brightness
write_byte(150) // speed
message_end()
}

public RemoveStatusIcon(id)
{
// Remove Status Icon
message_begin(MSG_ONE, g_iStatusIcon, {0,0,0}, id)
write_byte(0) // Status [0=Hide, 1=Show, 2=Flash]
write_string("dmg_cold") // Sprite Name
message_end()
}

public fw_SetModel(entity, model[])
{

if(!is_valid_ent(entity)) 
return FMRES_IGNORED

if(!equali(model, W_OLD_ELITE_MODEL)) 
return FMRES_IGNORED

new className[33]
entity_get_string(entity, EV_SZ_classname, className, 32)

static iOwner, iStoredELITEID

// Frost ELITE Owner
iOwner = entity_get_edict(entity, EV_ENT_owner)

// Get drop weapon index (Frost ELITE) to use in fw_FrostELITEAddToPlayer forward
iStoredELITEID = find_ent_by_owner(-1, "weapon_elite", entity)

// If Player Has Frost ELITE and It's weapon_elite
if(g_bHasFrostELITE[iOwner] && is_valid_ent(iStoredELITEID))
{
// Setting weapon options
entity_set_int(iStoredELITEID, EV_INT_impulse, 1997)

// Rest Var
g_bHasFrostELITE[iOwner] = false

// Set weaponbox new model
entity_set_model(entity, W_ELITE_MODEL)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}

public fw_FrostELITEAddToPlayer(FrostELITE, id)
{
// Make sure that this is ELITE
if(is_valid_ent(FrostELITE) && is_user_connected(id) && entity_get_int(FrostELITE, EV_INT_impulse) == 1997)
{
// Update Var
g_bHasFrostELITE[id] = true

// Reset weapon options
entity_set_int(FrostELITE, EV_INT_impulse, 0)
return HAM_HANDLED
}
return HAM_IGNORED
}

stock Remove_Rendering(id)
{
set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderNormal, 16)
}

public RemoveEntity(id)
{
if(!is_user_connected(id))
return

new iEnt = find_ent_by_owner(-1, "ent_frozen", id);

if(pev_valid(iEnt))
remove_entity(iEnt)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 7 years ago

Sorry brother but i stopped supporting my ZP works i only now work for Zombie Escape. So this topic should be trashed.

-Contact me here in Private Messages and i'll help you but don't create threads about ZP here.
He who fails to plan is planning to fail

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#3

Post by Raheem » 7 years ago

Here is the code:
    1. #include <amxmodx>
    2. #include <zombieplague>
    3. #include <dhudmessage>
    4. #include <hamsandwich>
    5. #include <fakemeta>
    6. #include <cstrike>
    7. #include <engine>
    8. #include <fun>
    9.  
    10. #define write_coord_fl(%1) engfunc(EngFunc_WriteCoord, %1)
    11. #define message_begin_fl(%1,%2,%3,%4) engfunc(EngFunc_MessageBegin, %1, %2, %3, %4)
    12.  
    13. new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame
    14.  
    15. new const V_ELITE_MODEL[] = "models/zombie_plague/v_frost_elite.mdl"
    16. new const P_ELITE_MODEL[] = "models/zombie_plague/p_frost_elite.mdl"
    17. new const W_ELITE_MODEL[]    = "models/zombie_plague/w_frost_elite.mdl"
    18. new const W_OLD_ELITE_MODEL[]    = "models/w_elite.mdl"
    19. new const ICE_MODEL[] = "models/zombie_plague/icecube_frozen.mdl"
    20. new const MODEL_GLASSGIBS[] = "models/glassgibs.mdl"
    21. new const SOUND_UNFROZEN[]  = "debris/glass3.wav"
    22.  
    23. enum _:Sprites
    24. {
    25.     SPRITE_FROST,
    26.     SPRITE_FROST2,
    27.     SPRITE_FLAKE
    28. }
    29.  
    30. new g_iSprites[Sprites]
    31.  
    32. new g_iItemID, g_iEliteFrostSpr, g_iMsgScreenFade, g_iMaxPlayers, g_iHudSync, g_iSpriteLaser, g_iGlassGibs, g_iFreezeDmg, g_fFrostTime, g_iDmgMultiplier, g_iStatusIcon
    33. new bool:g_bHasFrostElite[33], g_bIsFrozen[33]
    34. new g_iDmg[33]
    35.  
    36. public plugin_init()
    37. {
    38.     register_plugin("[ZP] Extra Item: Frost Elite", "1.4", "Raheem")
    39.    
    40.     // Cvars
    41.     g_fFrostTime = register_cvar("zp_frost_elite_time", "7.0") // Freeze Time. It's Float you can make it 0.5
    42.     g_iFreezeDmg = register_cvar("zp_freezing_elite_damage", "2000") // Damage Requried So Zombie got Frozen
    43.     g_iDmgMultiplier = register_cvar("zp_multiplier_elite_damage", "10") // Multiplie Weapon Damage
    44.  
    45.     // Message IDS
    46.     g_iHudSync = CreateHudSyncObj()
    47.     g_iMsgScreenFade = get_user_msgid("ScreenFade")
    48.     g_iStatusIcon = get_user_msgid("StatusIcon")
    49.  
    50.     // Server Max Slots
    51.     g_iMaxPlayers = get_maxplayers()
    52.    
    53.     // ITEM NAME & COST
    54.     g_iItemID = zp_register_extra_item("Frost Elite", 30, ZP_TEAM_HUMAN) // It's cost 30 Ammo Pack
    55.    
    56.     // Events
    57.     register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
    58.     register_event("WeapPickup","CheckModel","b","1=19")
    59.     register_event("CurWeapon","CurrentWeapon","be","1=1")
    60.     register_event("DeathMsg", "EventDeathMsg", "a")
    61.    
    62.     // Forwards
    63.     register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
    64.     register_forward(FM_SetModel, "fw_SetModel")
    65.    
    66.     // Hams
    67.     RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    68.     RegisterHam(Ham_TraceAttack, "player", "TraceAttack", 1)
    69.     RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttack", 1)
    70.     RegisterHam(Ham_Item_AddToPlayer, "weapon_elite", "fw_FrostEliteAddToPlayer")
    71. }
    72.  
    73. public plugin_precache()
    74. {
    75.     // Models
    76.     precache_model(V_ELITE_MODEL)
    77.     precache_model(P_ELITE_MODEL)
    78.     precache_model(W_ELITE_MODEL)
    79.     precache_model(ICE_MODEL)
    80.     g_iGlassGibs = precache_model(MODEL_GLASSGIBS)
    81.    
    82.     // Sounds
    83.     precache_sound("warcraft3/impalehit.wav")
    84.     precache_sound(SOUND_UNFROZEN)
    85.    
    86.     // Sprites
    87.     g_iEliteFrostSpr = precache_model("sprites/shockwave.spr")
    88.     g_iSpriteLaser = precache_model( "sprites/Newlightning.spr")
    89.     g_iSprites[SPRITE_FROST] = precache_model("sprites/frostexp_1.spr");
    90.     g_iSprites[SPRITE_FROST2] = precache_model("sprites/frostexp_2.spr");
    91.     g_iSprites[SPRITE_FLAKE] = precache_model("sprites/snowflake_1.spr");
    92. }
    93.  
    94. public client_putinserver(id)
    95. {
    96.     g_bHasFrostElite[id] = false
    97.     g_bIsFrozen[id] = false
    98. }
    99.  
    100. public client_disconnect(id)
    101. {
    102.     g_bHasFrostElite[id] = false
    103.     g_bIsFrozen[id] = false
    104.     RemoveEntity(id)
    105. }
    106.  
    107. public zp_extra_item_selected(player, itemid)
    108. {
    109.     if (itemid == g_iItemID)
    110.     {
    111.         g_bHasFrostElite[player] = true
    112.         ham_strip_weapon(player, "weapon_elite")
    113.         give_item(player, "weapon_elite")
    114.         cs_set_user_bpammo(player, CSW_ELITE, 90)
    115.         new sName[32]
    116.         get_user_name(player, sName, 31)
    117.         set_hudmessage(random(255), random(255), random(255), -1.0, 0.17, 1, 0.0, 5.0, 1.0, 1.0, -1)
    118.         show_hudmessage(0, "%s Has bought Frost Elite!", sName)
    119.         ColorPrint(player, "^1[^4ZP^1] ^3You Have bought Frost Elite^1!")
    120.     }
    121. }
    122.  
    123. public TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType)
    124. {
    125.     if(!is_user_alive(iAttacker))
    126.         return
    127.    
    128.     if(get_user_weapon(iAttacker) != CSW_ELITE || !g_bHasFrostElite[iAttacker])
    129.         return
    130.    
    131.     set_hudmessage(34, 138, 255, -1.0, 0.17, 1, 0.0, 2.0, 1.0, 1.0, -1)
    132.     ShowSyncHudMsg(iAttacker, g_iHudSync, "Freeze Damage^n%d/%d", g_iDmg[iAttacker], get_pcvar_num(g_iFreezeDmg))
    133.    
    134.     new vec1[3], vec2[3]
    135.     get_user_origin(iAttacker, vec1, 1)
    136.     get_user_origin(iAttacker, vec2, 4)
    137.  
    138.     make_beam(vec1, vec2, g_iSpriteLaser, 0, 50, 200, 200)
    139. }
    140.  
    141. public zp_user_infected_post(infected, infector)
    142. {
    143.     if (g_bHasFrostElite[infected])
    144.     {
    145.         g_bHasFrostElite[infected] = false
    146.     }
    147. }
    148.  
    149. public zp_user_humanized_post(id)
    150. {
    151.     g_bHasFrostElite[id] = false
    152.     g_iDmg[id] = 0
    153.     RemoveEntity(id)
    154. }
    155.  
    156. public event_round_start()
    157. {
    158.     for (new i = 1; i <= g_iMaxPlayers; i++)
    159.     {
    160.         g_bHasFrostElite[i] = false
    161.         g_bIsFrozen[i] = false
    162.         g_iDmg[i] = 0
    163.        
    164.         if(is_user_alive(i))
    165.         {
    166.             Remove_Rendering(i)
    167.         }
    168.     }
    169. }
    170.  
    171. public EventDeathMsg()
    172. {
    173.     new iVictim = read_data(2)
    174.     RemoveEntity(iVictim)
    175.     Remove_Rendering(iVictim)
    176.     g_bIsFrozen[iVictim] = false
    177. }
    178.  
    179. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
    180. {
    181.     if(!is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_nemesis(victim) || attacker == victim || !attacker)
    182.         return HAM_IGNORED
    183.  
    184.     if(g_bIsFrozen[victim])
    185.         return HAM_SUPERCEDE
    186.  
    187.     if(g_bHasFrostElite[attacker] && (get_user_weapon(attacker) == CSW_ELITE))
    188.         SetHamParamFloat(4, damage * get_pcvar_num(g_iDmgMultiplier))
    189.    
    190.     // For Frost Effect Ring
    191.     static Float:originF[3]
    192.     pev(victim, pev_origin, originF)
    193.    
    194.     // For Frost Effect Sound
    195.     static originF2[3]
    196.     get_user_origin(victim, originF2)
    197.    
    198.     if((get_user_weapon(attacker) == CSW_ELITE) && g_bHasFrostElite[attacker])
    199.     {
    200.         g_iDmg[attacker] += (floatround(damage) * get_pcvar_num(g_iDmgMultiplier))
    201.     }
    202.    
    203.     if((g_iDmg[attacker] >= get_pcvar_num(g_iFreezeDmg)) && (get_user_weapon(attacker) == CSW_ELITE) && g_bHasFrostElite[attacker])
    204.     {
    205.         new sName[32]
    206.         get_user_name(victim, sName, charsmax(sName))
    207.         FrostEffect(victim)
    208.         FrostEffectRing(originF)
    209.         FrostEffectSound(originF2)
    210.         g_iDmg[attacker] = 0
    211.         set_dhudmessage(34, 138, 255, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5)
    212.         show_dhudmessage(attacker, "%s Has been Freezed!", sName)
    213.     }
    214.     return HAM_IGNORED
    215. }
    216.  
    217. public CheckModel(id)
    218. {
    219.     if(zp_get_user_survivor(id))
    220.         return PLUGIN_HANDLED
    221.    
    222.     if (is_user_alive(id))
    223.     {
    224.         set_pev(id, pev_viewmodel2, V_ELITE_MODEL)
    225.         set_pev(id, pev_weaponmodel2, P_ELITE_MODEL)
    226.     }
    227.     return PLUGIN_HANDLED
    228. }
    229.  
    230. public CurrentWeapon(id)
    231. {
    232.     if ((get_user_weapon(id) == CSW_ELITE) && g_bHasFrostElite[id] == true)
    233.     {
    234.         CheckModel(id)
    235.     }
    236.     else
    237.     {
    238.         ClearSyncHud(id, g_iHudSync)
    239.     }
    240.     return PLUGIN_HANDLED
    241. }
    242.  
    243. public FrostEffect(id)
    244. {
    245.     // Only effect alive unfrozen zombies
    246.     if (!is_user_alive(id) || !zp_get_user_zombie(id) || g_bIsFrozen[id])
    247.         return
    248.    
    249.     message_begin(MSG_ONE_UNRELIABLE, g_iMsgScreenFade, _, id)
    250.     write_short(4096*1) // duration
    251.     write_short(4096*1) // hold time
    252.     write_short(0x0000) // fade type
    253.     write_byte(0) // red
    254.     write_byte(50) // green
    255.     write_byte(200) // blue
    256.     write_byte(100) // alpha
    257.     message_end()
    258.  
    259.     message_begin(MSG_ONE, g_iStatusIcon, {0,0,0}, id)
    260.     write_byte(1) // Status [0=Hide, 1=Show, 2=Flash]
    261.     write_string("dmg_cold") // Sprite Name
    262.     write_byte(000) // Red
    263.     write_byte(206) // Green
    264.     write_byte(209) // Blue
    265.     message_end()
    266.    
    267.     new ent = create_entity("info_target")
    268.    
    269.     UTIL_Explosion(id, g_iSprites[SPRITE_FROST], 40, 30, 4)
    270.     UTIL_Explosion(id, g_iSprites[SPRITE_FROST2], 20, 30, 4)
    271.     UTIL_SpriteTrail(id, g_iSprites[SPRITE_FLAKE], 30, 3, 2, 30, 0)
    272.    
    273.     new Float:iOrigin[3]
    274.     entity_get_vector(id, EV_VEC_origin, iOrigin)
    275.     set_pev(ent, pev_body, 1)
    276.     entity_set_model(ent, ICE_MODEL)
    277.     iOrigin[2] -= 35
    278.     entity_set_origin(ent, iOrigin)
    279.     set_pev(ent, pev_owner, id)
    280.     set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 255)
    281.     entity_set_string(ent, EV_SZ_classname, "ent_frozen")
    282.     entity_set_int(ent, EV_INT_solid, 2)
    283.     new Float: iOriginNew[3]
    284.     entity_get_vector(id, EV_VEC_origin, iOriginNew)
    285.     set_user_rendering(id, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 25)
    286.     g_bIsFrozen[id] = true
    287.     set_task(get_pcvar_float(g_fFrostTime), "RemoveFrost", id) // Time to Remove Frost Effect
    288. }
    289.  
    290. public fw_PlayerPreThink(id)
    291. {
    292.     // Not alive or Not Zombie
    293.     if (!is_user_alive(id) || !g_bIsFrozen[id])
    294.         return
    295.  
    296.     // Stop motion
    297.     set_pev(id, pev_velocity, Float:{0.0,0.0,0.0})
    298.     set_user_maxspeed(id, 1.0)
    299.    
    300.     // Stop Moving Mouse
    301.     set_pev(id , pev_v_angle , Float:{0.0,0.0,0.0})
    302.     set_pev(id , pev_fixangle , 1)
    303. }
    304.  
    305. // Frost Effect Sound
    306. public FrostEffectSound(iOrigin[3])
    307. {
    308.     new Entity = create_entity("info_target")
    309.  
    310.     new Float:flOrigin[3]
    311.     IVecFVec(iOrigin, flOrigin)
    312.     entity_set_origin(Entity, flOrigin)
    313.     emit_sound(Entity, CHAN_WEAPON, "warcraft3/impalehit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    314.     remove_entity(Entity)
    315. }
    316.  
    317. UTIL_Explosion(iEnt, iSprite, iScale, iFramerate, Flags)
    318. {
    319.     new Float:vOrigin[3]
    320.     pev(iEnt, pev_origin, vOrigin)
    321.    
    322.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    323.     write_byte(TE_EXPLOSION)
    324.     engfunc(EngFunc_WriteCoord, vOrigin[0])
    325.     engfunc(EngFunc_WriteCoord, vOrigin[1])
    326.     engfunc(EngFunc_WriteCoord, vOrigin[2])
    327.     write_short(iSprite)
    328.     write_byte(iScale)
    329.     write_byte(iFramerate)
    330.     write_byte(Flags)
    331.     message_end()
    332. }
    333.  
    334. UTIL_SpriteTrail(iEnt, iSprite, iCount, iLife, iScale, iVelocity, iVary)
    335. {
    336.     new Float:vOrigin[3]
    337.     pev(iEnt, pev_origin, vOrigin)
    338.    
    339.     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
    340.     write_byte(TE_SPRITETRAIL)
    341.     engfunc(EngFunc_WriteCoord, vOrigin[0])
    342.     engfunc(EngFunc_WriteCoord, vOrigin[1])
    343.     engfunc(EngFunc_WriteCoord, vOrigin[2] + 100)
    344.     engfunc(EngFunc_WriteCoord, vOrigin[0] + random_float( -200.0, 200.0 ))
    345.     engfunc(EngFunc_WriteCoord, vOrigin[1] + random_float( -200.0, 200.0 ))
    346.     engfunc(EngFunc_WriteCoord, vOrigin[2])
    347.     write_short(iSprite)
    348.     write_byte(iCount)
    349.     write_byte(iLife)
    350.     write_byte(iScale)
    351.     write_byte(iVelocity)
    352.     write_byte(iVary)
    353.     message_end()
    354. }
    355.  
    356. // Frost Effect Ring
    357. FrostEffectRing(const Float:originF3[3])
    358. {
    359.     // Largest ring
    360.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF3, 0)
    361.     write_byte(TE_BEAMCYLINDER) // TE id
    362.     engfunc(EngFunc_WriteCoord, originF3[0]) // x
    363.     engfunc(EngFunc_WriteCoord, originF3[1]) // y
    364.     engfunc(EngFunc_WriteCoord, originF3[2]) // z
    365.     engfunc(EngFunc_WriteCoord, originF3[0]) // x axis
    366.     engfunc(EngFunc_WriteCoord, originF3[1]) // y axis
    367.     engfunc(EngFunc_WriteCoord, originF3[2]+100.0) // z axis
    368.     write_short(g_iEliteFrostSpr) // sprite
    369.     write_byte(0) // startframe
    370.     write_byte(0) // framerate
    371.     write_byte(4) // life
    372.     write_byte(60) // width
    373.     write_byte(0) // noise
    374.     write_byte(41) // red
    375.     write_byte(138) // green
    376.     write_byte(255) // blue
    377.     write_byte(200) // brightness
    378.     write_byte(0) // speed
    379.     message_end()
    380. }
    381.  
    382. // Remove Frost Effect
    383. public RemoveFrost(id)
    384. {
    385.     // Not alive or not frozen anymore
    386.     if (!is_user_alive(id) || !g_bIsFrozen[id])
    387.         return
    388.    
    389.     // Unfreeze
    390.     g_bIsFrozen[id] = false;
    391.     set_task(0.1, "remove_jibs", id)
    392.  
    393.     // Rest Player Speed
    394.     ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
    395.    
    396.     Remove_Rendering(id)
    397.     RemoveStatusIcon(id)
    398. }
    399.  
    400. public remove_jibs(id)
    401. {
    402.     RemoveEntity(id)
    403.    
    404.     new Float:origin[3]
    405.     pev(id,pev_origin,origin)
    406.    
    407.     message_begin_fl(MSG_PVS,SVC_TEMPENTITY,origin,0)
    408.     write_byte(TE_IMPLOSION)
    409.     write_coord_fl(origin[0]) // x
    410.     write_coord_fl(origin[1]) // y
    411.     write_coord_fl(origin[2] + 8.0) // z
    412.     write_byte(64) // radius
    413.     write_byte(10) // count
    414.     write_byte(3) // duration
    415.     message_end()
    416.    
    417.     message_begin_fl(MSG_PVS,SVC_TEMPENTITY,origin,0)
    418.     write_byte(TE_SPARKS)
    419.     write_coord_fl(origin[0]) // x
    420.     write_coord_fl(origin[1]) // y
    421.     write_coord_fl(origin[2]) // z
    422.     message_end()
    423.    
    424.     message_begin_fl(MSG_PAS,SVC_TEMPENTITY,origin,0)
    425.     write_byte(TE_BREAKMODEL)
    426.     write_coord_fl(origin[0]) // x
    427.     write_coord_fl(origin[1]) // y
    428.     write_coord_fl(origin[2] + 24.0) // z
    429.     write_coord_fl(16.0) // size x
    430.     write_coord_fl(16.0) // size y
    431.     write_coord_fl(16.0) // size z
    432.     write_coord(random_num(-50,50)) // velocity x
    433.     write_coord(random_num(-50,50)) // velocity y
    434.     write_coord_fl(25.0) // velocity z
    435.     write_byte(10) // random velocity
    436.     write_short(g_iGlassGibs) // model
    437.     write_byte(10) // count
    438.     write_byte(25) // life
    439.     write_byte(0x01) // flags
    440.     message_end()
    441.    
    442.     emit_sound(0,CHAN_ITEM,SOUND_UNFROZEN,VOL_NORM,ATTN_NORM,0,PITCH_LOW)
    443. }
    444.  
    445. stock ColorPrint(const id, const input[], any: ...)
    446. {
    447.     new count = 1, players[32]
    448.     static msg[192]
    449.     vformat(msg, 191, input, 3)
    450.    
    451.     replace_all(msg, 191, "!g", "^4")
    452.     replace_all(msg, 191, "!y", "^1")
    453.     replace_all(msg, 191, "!t", "^3")
    454.     replace_all(msg, 191, "!t2", "^0")
    455.    
    456.     if (id) players[0] = id;else get_players(players, count, "ch")
    457.     {
    458.         for (new i = 0; i < count; i++)
    459.         {
    460.             if (is_user_connected( players[i]))
    461.             {
    462.                 message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
    463.                 write_byte(players[i])
    464.                 write_string(msg)
    465.                 message_end()
    466.             }
    467.         }
    468.     }
    469. }
    470.  
    471. stock ham_strip_weapon(id,weapon[])
    472. {
    473.     if(!equal(weapon,"weapon_",7)) return 0
    474.  
    475.     new wId = get_weaponid(weapon)
    476.     if(!wId) return 0
    477.  
    478.     new wEnt
    479.     while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    480.     if(!wEnt) return 0
    481.  
    482.     if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)
    483.  
    484.     if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0
    485.     ExecuteHamB(Ham_Item_Kill,wEnt)
    486.  
    487.     set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId))
    488.  
    489.     return 1
    490. }
    491.  
    492. make_beam(const origin2[3], const origin[3], sprite, red, green, blue, alpha)
    493. {
    494.     //BEAMENTPOINTS
    495.     message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
    496.     write_byte (0) //TE_BEAMENTPOINTS 0
    497.     write_coord(origin2[0])
    498.     write_coord(origin2[1])
    499.     write_coord(origin2[2])
    500.     write_coord(origin[0])
    501.     write_coord(origin[1])
    502.     write_coord(origin[2])
    503.     write_short(sprite) // sprite
    504.     write_byte(1) // framestart
    505.     write_byte(5) // framerate
    506.     write_byte(2) // life
    507.     write_byte(20) // width
    508.     write_byte(0) // noise
    509.     write_byte(red) // r, g, b
    510.     write_byte(green) // r, g, b
    511.     write_byte(blue) // r, g, b
    512.     write_byte(alpha) // brightness
    513.     write_byte(150) // speed
    514.     message_end()
    515. }
    516.  
    517. public RemoveStatusIcon(id)
    518. {
    519.     // Remove Status Icon
    520.     message_begin(MSG_ONE, g_iStatusIcon, {0,0,0}, id)
    521.     write_byte(0) // Status [0=Hide, 1=Show, 2=Flash]
    522.     write_string("dmg_cold") // Sprite Name
    523.     message_end()
    524. }
    525.  
    526. public fw_SetModel(entity, model[])
    527. {
    528.    
    529.     if(!is_valid_ent(entity))
    530.         return FMRES_IGNORED
    531.  
    532.     if(!equali(model, W_OLD_ELITE_MODEL))
    533.         return FMRES_IGNORED
    534.  
    535.     new className[33]
    536.     entity_get_string(entity, EV_SZ_classname, className, 32)
    537.  
    538.     static iOwner, iStoredEliteID
    539.  
    540.     // Frost Elite Owner
    541.     iOwner = entity_get_edict(entity, EV_ENT_owner)
    542.  
    543.     // Get drop weapon index (Frost Elite) to use in fw_FrostEliteAddToPlayer forward
    544.     iStoredEliteID = find_ent_by_owner(-1, "weapon_elite", entity)
    545.  
    546.     // If Player Has Frost Elite and It's weapon_elite
    547.     if(g_bHasFrostElite[iOwner] && is_valid_ent(iStoredEliteID))
    548.     {
    549.         // Setting weapon options
    550.         entity_set_int(iStoredEliteID, EV_INT_impulse, 1997)
    551.  
    552.         // Rest Var
    553.         g_bHasFrostElite[iOwner] = false
    554.        
    555.         // Set weaponbox new model
    556.         entity_set_model(entity, W_ELITE_MODEL)
    557.         return FMRES_SUPERCEDE
    558.     }
    559.     return FMRES_IGNORED
    560. }
    561.  
    562. public fw_FrostEliteAddToPlayer(FrostElite, id)
    563. {
    564.     // Make sure that this is Elite
    565.     if(is_valid_ent(FrostElite) && is_user_connected(id) && entity_get_int(FrostElite, EV_INT_impulse) == 1997)
    566.     {
    567.         // Update Var
    568.         g_bHasFrostElite[id] = true
    569.  
    570.         // Reset weapon options
    571.         entity_set_int(FrostElite, EV_INT_impulse, 0)
    572.         return HAM_HANDLED
    573.     }
    574.     return HAM_IGNORED
    575. }
    576.  
    577. stock Remove_Rendering(id)
    578. {
    579.     set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderNormal, 16)
    580. }
    581.  
    582. public RemoveEntity(id)
    583. {
    584.     if(!is_user_connected(id))
    585.         return
    586.        
    587.     new iEnt = find_ent_by_owner(-1, "ent_frozen", id);
    588.    
    589.     if(pev_valid(iEnt))
    590.         remove_entity(iEnt)
    591. }
AMXX:
He who fails to plan is planning to fail

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 1 guest