Raised This Month: $12 Target: $400
 3% 

[ZP] Extra Item: Zombie Force v.1.2


Post New Thread Reply   
 
Thread Tools Display Modes
manafi
Senior Member
Join Date: Jun 2009
Old 09-26-2010 , 07:14   Re: [ZP] Extra Item: Zombie Force v.1.2
Reply With Quote #11

Excalibur.007 Ty
manafi is offline
manafi
Senior Member
Join Date: Jun 2009
Old 09-26-2010 , 11:23   Re: [ZP] Extra Item: Zombie Force v.1.2
Reply With Quote #12

Excalibur.007 New error)

L 09/26/2010 - 19:228: Invalid player id 0
L 09/26/2010 - 19:228: [AMXX] Run time error 10 (plugin "zp_extra_zombie_force.amxx") (native "get_user_weapon") - debug not enabled!
L 09/26/2010 - 19:228: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
manafi is offline
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 09-27-2010 , 04:07   Re: [ZP] Extra Item: Zombie Force v.1.2
Reply With Quote #13

Oh my god. So many missing is_user_connected. New code:
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(!
is_user_connected(attacker) || !is_user_connected(victim))
        return 
HAM_IGNORED
        
    
if(get_user_weapon(attacker) == CSW_KNIFE && gHasZForce[attacker])
    {
        
SetHamParamFloat(4damage get_pcvar_num(pCvarDmgMultiplier))
    }
    return 
HAM_IGNORED
}

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(!
is_user_connected(victim))
        return 
HAM_IGNORED
    
    
if(gHasZForce[victim])
        
gHasZForce[victim] = false
        
    
return HAM_IGNORED

Excalibur.007 is offline
zombiiiizzz
BANNED
Join Date: Apr 2010
Old 09-28-2010 , 12:39   Re: [ZP] Extra Item: Zombie Force v.1.2
Reply With Quote #14

Quote:
Originally Posted by Excalibur.007 View Post
Oh my god. So many missing is_user_connected. New code:
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(!
is_user_connected(attacker) || !is_user_connected(victim))
        return 
HAM_IGNORED
 
    
if(get_user_weapon(attacker) == CSW_KNIFE && gHasZForce[attacker])
    {
        
SetHamParamFloat(4damage get_pcvar_num(pCvarDmgMultiplier))
    }
    return 
HAM_IGNORED
}
 
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(!
is_user_connected(victim))
        return 
HAM_IGNORED
 
    
if(gHasZForce[victim])
        
gHasZForce[victim] = false
 
    
return HAM_IGNORED


working great, tested.

PS: the speed is still as the zombie class you have selected, so the cvar is useless.

Last edited by zombiiiizzz; 10-01-2010 at 09:44.
zombiiiizzz is offline
SharmanteN
New Member
Join Date: Aug 2010
Old 02-17-2011 , 23:24   Re: [ZP] Extra Item: Zombie Force v.1.2
Reply With Quote #15

Can be added knockback
SharmanteN is offline
ThePain
New Member
Join Date: Mar 2022
Old 03-24-2022 , 06:35   Re: [ZP] Extra Item: Zombie Force v.1.2
Reply With Quote #16

Hello , can somebody add round limit to this plugin
ThePain is offline
Reply


Thread Tools
Display Modes

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 12:57.


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