Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP5.0] Extra Item: Fast Attack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-12-2013 , 13:07   [ZP5.0] Extra Item: Fast Attack
Reply With Quote #1

[ZP5.0] Fast Attack

-Description-

With this extra item you can attack fast with knife for some time (can be edited by Cvar).

Default Team : Zombies
Default Price : 10 Ammo Packs

-Credits-

Especial thanks to:

MeRcyLeZZ - For his awesome Zombie Plague mod.
schmurgel1983 - For his Executioner Zombie.
H.RED.ZONE - For help me to convert the bools to bitsums.

-Cvars-

-zp_fastattack_pri 1 // Allow faster primary attack (slash) [0-disabled / 1-enabled]
-zp_fastattack_pri_speed 0.33 // primary attack speed (0.5 = reduces attack speed by a half)
-zp_fastattack_sec 1 // Allow faster secondary attack (stab) [0-disabled / 1-enabled]
-zp_fastattack_sec_speed 0.33 // secondary attack speed (0.5 = reduces attack speed by a half)
-zp_fastattack_time 5.0 // Time of fast attack
-zp_fastattack_limit 3 // per round limit

This is my first plugin I post in the forum I hope you enjoy..
Attached Files
File Type: sma Get Plugin or Get Source (zp50_extra_fastattack.sma - 975 views - 5.7 KB)

Last edited by wicho; 08-12-2013 at 16:33.
wicho is offline
Cigojlo
Senior Member
Join Date: May 2013
Location: Serbia / Belgrade
Old 08-12-2013 , 16:27   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #2

hm
#define AUTHOR "schmurgel1983, wicho"
__________________
Quote:
Originally Posted by ghinghis View Post
the fuking TOP.SMA cannot be compiled moron !!!!!

Last edited by Cigojlo; 08-12-2013 at 16:29.
Cigojlo is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-12-2013 , 16:34   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #3

I already changed it..
wicho is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 08-13-2013 , 04:27   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #4

Seems nice..... Gj BTW i think this is your first plugin so it's good for that
__________________
You will find everything u need :-
Catastrophe is offline
Egan
BANNED
Join Date: May 2013
Location: GB
Old 08-13-2013 , 10:34   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #5

shh dont talk in here cat
Egan is offline
Send a message via ICQ to Egan Send a message via AIM to Egan Send a message via Yahoo to Egan Send a message via Skype™ to Egan
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 08-13-2013 , 11:33   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #6

Quote:
Originally Posted by Egan View Post
shh dont talk in here cat
Lol you're everywhere xD
__________________
You will find everything u need :-
Catastrophe is offline
BLacking98
Veteran Member
Join Date: Oct 2012
Location: California
Old 08-31-2013 , 10:20   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #7

bump

Can you make this for Zombie Plague 4.3 ?
__________________
BLacking98 is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 08-31-2013 , 13:28   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #8

Try..

PHP Code:
#include <amxmodx>   
#include <fakemeta>   
#include <fakemeta_util>   
#include <hamsandwich>        
#include <zombieplague> 
#include <colorchat> 

#define PLUGIN   "[ZP4.3] Extra Item: Fast Attack" 
#define AUTHOR      "schmurgel1983 & wicho" 
#define VERSION              "1.0" 

const OFFSET_WEAPONOWNER 41   
const OFFSET_LINUX_WEAPONS 4   
const m_flNextPrimaryAttack 46   
const m_flNextSecondaryAttack 47   

#define MarkPlayergFastattack(%0)  bitPlayerFastattack |= (1 << (%0 & 31)) 
#define ClearPlayerFastattack(%0) bitPlayerFastattack &= ~(1 << (%0 & 31)) 
#define IsPlayerFastattack(%0)    bitPlayerFastattack & (1 << (%0 & 31)) 

new bitPlayerFastattack
new item_fastattack    
new cvar_Primarycvar_PrimarySpeedcvar_Secondarycvar_SecondarySpeed  
new cvar_Fastattack_time 
new cvar_Fastattack_limit
new g_Limit[33]
new 
g_MaxPlayers

const COST 10

public plugin_init() 
{   
    
register_plugin(PLUGINVERSIONAUTHOR)    
    
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fwd_Knife_PriAtk_Post"1)   
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fwd_Knife_SecAtk_Post"1)   
       
    
cvar_Primary register_cvar("zp_fastattack_pri""1")   
    
cvar_PrimarySpeed register_cvar("zp_fastattack_pri_speed""0.33")   
    
cvar_Secondary register_cvar("zp_fastattack_sec""1")   
    
cvar_SecondarySpeed register_cvar("zp_fastattack_sec_speed""0.33")   
    
cvar_Fastattack_time register_cvar("zp_fastattack_time""5.0")
    
cvar_Fastattack_limit register_cvar("zp_fastattack_limit""2")
    
    
register_event("HLTV""NewRound""a""1=0""2=0")
    
    
g_MaxPlayers get_maxplayers()
       
    
item_fastattack zp_register_extra_item("Fast Attack"COSTZP_TEAM_ZOMBIE)
}   
      
public 
zp_extra_item_selected(id,itemid)
{
    if (
itemid == item_fastattack
        return 
PLUGIN_CONTINUE;
    
    if(
is_user_alive(id))
    {
        
    if (
g_Limit[id] >= get_pcvar_num(cvar_Fastattack_limit))
    {
        
client_print(idprint_chat"[ZP] You only can buy two times per round")
        return 
ZP_PLUGIN_HANDLED
    }
    
    
MarkPlayergFastattack(id
    
set_task(get_pcvar_float(cvar_Fastattack_time), "remove_fastattack"id)   
    
ColorChat(idTEAM_COLOR"^x01You bought fast attack for ^x04%.f0 ^x01seconds !!!"get_pcvar_float(cvar_Fastattack_time));  
    
g_Limit[id]++
    
    }   
    return 
PLUGIN_CONTINUE;
}  

public 
zp_user_infected_post(id
{   
    
ClearPlayerFastattack(id
}   

public 
zp_user_humanized_post(id
{   
    
ClearPlayerFastattack(id
}   

public 
fw_PlayerKilled(victimattackershouldgib
{   
    
ClearPlayerFastattack(victim
}   

public 
zp_round_ended(winteam
{   
    
bitPlayerFastattack 
}   

public 
client_connect(id
{   
    
ClearPlayerFastattack(id
}  

public 
client_disconnect(id)
{   
    
ClearPlayerFastattack(id
}   

public 
fwd_Knife_PriAtk_Post(ent
{   

    if (!
get_pcvar_num(cvar_Primary))   
        return 
HAM_IGNORED;   
       
    static 
owner   
    owner 
ham_cs_get_weapon_ent_owner(ent)   
       
    if (~
IsPlayerFastattack(owner))   
        return 
HAM_IGNORED   
       
    
static Float:SpeedFloat:PrimaryFloat:Secondary   
     
    Speed 
get_pcvar_float(cvar_PrimarySpeed)   
    
Primary get_pdata_float(entm_flNextPrimaryAttackOFFSET_LINUX_WEAPONS) * Speed   
    Secondary 
get_pdata_float(entm_flNextSecondaryAttackOFFSET_LINUX_WEAPONS) * Speed   
       
    
if (Primary 0.0 && Secondary 0.0
    {   
        
set_pdata_float(entm_flNextPrimaryAttackPrimaryOFFSET_LINUX_WEAPONS)   
        
set_pdata_float(entm_flNextSecondaryAttackSecondaryOFFSET_LINUX_WEAPONS)   
    }   
    return 
HAM_IGNORED;   
}   

public 
fwd_Knife_SecAtk_Post(ent
{   
    if (!
get_pcvar_num(cvar_Secondary))   
        return 
HAM_IGNORED;   
     
    static 
owner   
    owner 
ham_cs_get_weapon_ent_owner(ent)   
       
    if (~
IsPlayerFastattack(owner))   
        return 
HAM_IGNORED   
       
    
static Float:SpeedFloat:PrimaryFloat:Secondary   
     
    Speed 
get_pcvar_float(cvar_SecondarySpeed)   
    
Primary get_pdata_float(entm_flNextPrimaryAttackOFFSET_LINUX_WEAPONS) * Speed   
    Secondary 
get_pdata_float(entm_flNextSecondaryAttackOFFSET_LINUX_WEAPONS) * Speed   
       
    
if (Primary 0.0 && Secondary 0.0
    {   
        
set_pdata_float(entm_flNextPrimaryAttackPrimaryOFFSET_LINUX_WEAPONS)   
        
set_pdata_float(entm_flNextSecondaryAttackSecondaryOFFSET_LINUX_WEAPONS)   
    }   
    return 
HAM_IGNORED;   
}   

public 
remove_fastattack(id
{   
    
ClearPlayerFastattack(id
    
ColorChat(idTEAM_COLOR"^x01Your fast attack is over !!!")   
}  

public 
NewRound() 
{   
    for (new 
idid <= g_MaxPlayersid++) 
    {                     
        
g_Limit[id] = 0
    
}
}  

stock ham_cs_get_weapon_ent_owner(entity
{   
    if (
pev_valid(entity) != 2)   
        return 
0;   
       
    return 
get_pdata_cbase(entityOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS);   


Last edited by wicho; 08-31-2013 at 13:31.
wicho is offline
BLacking98
Veteran Member
Join Date: Oct 2012
Location: California
Old 08-31-2013 , 13:51   Re: [ZP5.0] Extra Item: Fast Attack
Reply With Quote #9

Quote:
Originally Posted by wicho View Post
Try..

PHP Code:
#include <amxmodx>   
#include <fakemeta>   
#include <fakemeta_util>   
#include <hamsandwich>        
#include <zombieplague> 
#include <colorchat> 

#define PLUGIN   "[ZP4.3] Extra Item: Fast Attack" 
#define AUTHOR      "schmurgel1983 & wicho" 
#define VERSION              "1.0" 

const OFFSET_WEAPONOWNER 41   
const OFFSET_LINUX_WEAPONS 4   
const m_flNextPrimaryAttack 46   
const m_flNextSecondaryAttack 47   

#define MarkPlayergFastattack(%0)  bitPlayerFastattack |= (1 << (%0 & 31)) 
#define ClearPlayerFastattack(%0) bitPlayerFastattack &= ~(1 << (%0 & 31)) 
#define IsPlayerFastattack(%0)    bitPlayerFastattack & (1 << (%0 & 31)) 

new bitPlayerFastattack
new item_fastattack    
new cvar_Primarycvar_PrimarySpeedcvar_Secondarycvar_SecondarySpeed  
new cvar_Fastattack_time 
new cvar_Fastattack_limit
new g_Limit[33]
new 
g_MaxPlayers

const COST 10

public plugin_init() 
{   
    
register_plugin(PLUGINVERSIONAUTHOR)    
    
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fwd_Knife_PriAtk_Post"1)   
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fwd_Knife_SecAtk_Post"1)   
       
    
cvar_Primary register_cvar("zp_fastattack_pri""1")   
    
cvar_PrimarySpeed register_cvar("zp_fastattack_pri_speed""0.33")   
    
cvar_Secondary register_cvar("zp_fastattack_sec""1")   
    
cvar_SecondarySpeed register_cvar("zp_fastattack_sec_speed""0.33")   
    
cvar_Fastattack_time register_cvar("zp_fastattack_time""5.0")
    
cvar_Fastattack_limit register_cvar("zp_fastattack_limit""2")
    
    
register_event("HLTV""NewRound""a""1=0""2=0")
    
    
g_MaxPlayers get_maxplayers()
       
    
item_fastattack zp_register_extra_item("Fast Attack"COSTZP_TEAM_ZOMBIE)
}   
      
public 
zp_extra_item_selected(id,itemid)
{
    if (
itemid == item_fastattack
        return 
PLUGIN_CONTINUE;
    
    if(
is_user_alive(id))
    {
        
    if (
g_Limit[id] >= get_pcvar_num(cvar_Fastattack_limit))
    {
        
client_print(idprint_chat"[ZP] You only can buy two times per round")
        return 
ZP_PLUGIN_HANDLED
    }
    
    
MarkPlayergFastattack(id
    
set_task(get_pcvar_float(cvar_Fastattack_time), "remove_fastattack"id)   
    
ColorChat(idTEAM_COLOR"^x01You bought fast attack for ^x04%.f0 ^x01seconds !!!"get_pcvar_float(cvar_Fastattack_time));  
    
g_Limit[id]++
    
    }   
    return 
PLUGIN_CONTINUE;
}  

public 
zp_user_infected_post(id
{   
    
ClearPlayerFastattack(id
}   

public 
zp_user_humanized_post(id
{   
    
ClearPlayerFastattack(id
}   

public 
fw_PlayerKilled(victimattackershouldgib
{   
    
ClearPlayerFastattack(victim
}   

public 
zp_round_ended(winteam
{   
    
bitPlayerFastattack 
}   

public 
client_connect(id
{   
    
ClearPlayerFastattack(id
}  

public 
client_disconnect(id)
{   
    
ClearPlayerFastattack(id
}   

public 
fwd_Knife_PriAtk_Post(ent
{   

    if (!
get_pcvar_num(cvar_Primary))   
        return 
HAM_IGNORED;   
       
    static 
owner   
    owner 
ham_cs_get_weapon_ent_owner(ent)   
       
    if (~
IsPlayerFastattack(owner))   
        return 
HAM_IGNORED   
       
    
static Float:SpeedFloat:PrimaryFloat:Secondary   
     
    Speed 
get_pcvar_float(cvar_PrimarySpeed)   
    
Primary get_pdata_float(entm_flNextPrimaryAttackOFFSET_LINUX_WEAPONS) * Speed   
    Secondary 
get_pdata_float(entm_flNextSecondaryAttackOFFSET_LINUX_WEAPONS) * Speed   
       
    
if (Primary 0.0 && Secondary 0.0
    {   
        
set_pdata_float(entm_flNextPrimaryAttackPrimaryOFFSET_LINUX_WEAPONS)   
        
set_pdata_float(entm_flNextSecondaryAttackSecondaryOFFSET_LINUX_WEAPONS)   
    }   
    return 
HAM_IGNORED;   
}   

public 
fwd_Knife_SecAtk_Post(ent
{   
    if (!
get_pcvar_num(cvar_Secondary))   
        return 
HAM_IGNORED;   
     
    static 
owner   
    owner 
ham_cs_get_weapon_ent_owner(ent)   
       
    if (~
IsPlayerFastattack(owner))   
        return 
HAM_IGNORED   
       
    
static Float:SpeedFloat:PrimaryFloat:Secondary   
     
    Speed 
get_pcvar_float(cvar_SecondarySpeed)   
    
Primary get_pdata_float(entm_flNextPrimaryAttackOFFSET_LINUX_WEAPONS) * Speed   
    Secondary 
get_pdata_float(entm_flNextSecondaryAttackOFFSET_LINUX_WEAPONS) * Speed   
       
    
if (Primary 0.0 && Secondary 0.0
    {   
        
set_pdata_float(entm_flNextPrimaryAttackPrimaryOFFSET_LINUX_WEAPONS)   
        
set_pdata_float(entm_flNextSecondaryAttackSecondaryOFFSET_LINUX_WEAPONS)   
    }   
    return 
HAM_IGNORED;   
}   

public 
remove_fastattack(id
{   
    
ClearPlayerFastattack(id
    
ColorChat(idTEAM_COLOR"^x01Your fast attack is over !!!")   
}  

public 
NewRound() 
{   
    for (new 
idid <= g_MaxPlayersid++) 
    {                     
        
g_Limit[id] = 0
    
}
}  

stock ham_cs_get_weapon_ent_owner(entity
{   
    if (
pev_valid(entity) != 2)   
        return 
0;   
       
    return 
get_pdata_cbase(entityOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS);   

Gnna try it out in a few days because im on my phone
__________________
BLacking98 is offline
Reply



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 14:43.


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