Raised This Month: $ Target: $400
 0% 

[ZP] Extra Item: Zombie Force v.1.2


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 09-25-2010 , 22:18   Re: [ZP] Extra Item: Zombie Force v.1.2
Reply With Quote #10

PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <zombieplague>

// Extra Item ID
new g_item_zforce

// PCVars
new pCvarAdditionalHealthpCvarGravitypCvarSpeedpCvarDmgMultiplierpCvarGlowRedpCvarGlowGreenpCvarGlowBlue

// Player Variables
new gHasZForce[33]

// Credits to joaquimandrade
new Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

// Extra Item name, cost and sound
new const g_item_name[] = "Zombie Force" // Item name
new const g_item_cost 15 // Item cost
new const sound_force[] = "zombie_plague/buy_force.wav" // Sound

public plugin_init()
{
    
register_plugin("[ZP] Extra Item: Zombie Force""1.0""eXcalibur.007")
    
    
g_item_zforce zp_register_extra_item(g_item_nameg_item_costZP_TEAM_ZOMBIE)
    
    
pCvarAdditionalHealth register_cvar("zp_zforce_additional_health""2000")
    
pCvarGravity register_cvar("zp_zforce_gravity""0.6")
    
pCvarSpeed register_cvar("zp_zforce_speed""50.0")
    
pCvarDmgMultiplier register_cvar("zp_zforce_dmg_multi""1.2")
    
pCvarGlowRed register_cvar("zp_zforce_glow_red""255")
    
pCvarGlowGreen register_cvar("zp_zforce_glow_green""100")
    
pCvarGlowBlue register_cvar("zp_zforce_glow_blue""0")
    
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage_Pre")
    
RegisterHam(Ham_Player_ResetMaxSpeed"player""fw_Player_ResetMaxSpeed_Post"1)
    
RegisterHam(Ham_Killed"player""fw_Killed_Post"1)
}

public 
plugin_precache()
{
    
precache_sound(sound_force)
}

public 
zp_extra_item_selected(playeritemid)
{
    if(
itemid == g_item_zforce)
    {
        
gHasZForce[player] = true
        
        
// Set player's health, gravity, etc.
        
set_user_health(playerget_user_health(player) + get_pcvar_num(pCvarAdditionalHealth))
        
set_user_gravity(playerget_pcvar_float(pCvarGravity))
        
set_user_rendering(playerkRenderFxGlowShell,  get_pcvar_num(pCvarGlowRed), get_pcvar_num(pCvarGlowGreen),  get_pcvar_num(pCvarGlowBlue), kRenderNormal25)
        
        
// Plays a sound
        
emit_sound(playerCHAN_BODYsound_force1.0ATTN_NORM0PITCH_NORM)
        
        static 
szName[32]
        
get_user_name(playerszNamecharsmax(szName))
        
        
set_hudmessage(255000.050.4510.05.01.01.0, -1)
        
show_hudmessage(0"%s has bought Zombie Force!!"szName)
        
    }
}

public 
fw_TakeDamage_Pre(victiminflictorattackerFloat:damagedamage_type)

    if(
get_user_weapon(attacker) == CSW_KNIFE && gHasZForce[attacker])
    {
        
SetHamParamFloat(4damage get_pcvar_num(pCvarDmgMultiplier))
    }
}

public 
fw_Player_ResetMaxSpeed_Post(player)
{
    if(!
is_user_connected(player) || !is_user_alive(player) || !gHasZForce[player])
        return
        
    static 
Float:iMaxSpeediMaxSpeed get_user_maxspeed(player)
    
    
// Not moving(Doesn't need to change since it's not moving)
    
if(iMaxSpeed != 1.0)
    {
        
set_user_maxspeed(playeriMaxSpeed get_pcvar_float(pCvarSpeed))
    }
}

public 
fw_Killed_Post(victimattacker)
{
    if(
gHasZForce[victim])
        
gHasZForce[victim] = false

No FM + No Engine.

My bad. Forgotten to add a _Pre on the public function. This is the new code.

Last edited by Excalibur.007; 09-27-2010 at 04:09.
Excalibur.007 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode