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

[AYUDA] Agregarle bits a extra item


  
 
 
Thread Tools Display Modes
Author Message
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 05-13-2013 , 15:16   [AYUDA] Agregarle bits a extra item
#1

Hola todos, bueno recien me pasaron un extra item pero me gustaria usarlo con bits en vez de bools alguien me ayudaria a cambiarlo?

este es el code:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <zp50_core>
#include <zp50_items>
#include <zp50_class_nemesis>
#include <zp50_class_survivor> 
#include <zp50_colorchat>

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

new g_bExecutioner[33]

new 
g_maxplayersitem_fastattack 

new cvar_Primarycvar_PrimarySpeedcvar_Secondarycvar_SecondarySpeed


public plugin_init() 
{
    
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_executioner_pri""1")
    
cvar_PrimarySpeed register_cvar("zp_executioner_pri_speed""0.33")
    
cvar_Secondary register_cvar("zp_executioner_sec""1")
    
cvar_SecondarySpeed register_cvar("zp_executioner_sec_speed""0.33")
    
    
g_maxplayers get_maxplayers()

    
item_fastattack zp_items_register ("Fast Attack"1)    
    
}

 public 
zp_fw_items_select_pre(iditemidignorecost)
{
                
          if (
itemid == item_fastattack)
       {
                        
                if (
zp_class_nemesis_get(id) || !zp_core_is_zombie(id) || zp_class_survivor_get(id))
                  {
                                
                     return 
ZP_ITEM_DONT_SHOW;
                  }
       }
               
           return 
ZP_ITEM_AVAILABLE;
}  
    
public 
zp_fw_items_select_post(iditemidignorecost)
{
    if (
itemid == item_fastattack
    {
        
g_bExecutioner[id] = true
        set_task
(5.0"remove_fastattack"id)
        
zp_colored_print(id"^x04You have fast attack^x01");
    }
}

public 
zp_fw_core_infect_post(id)
{
    
g_bExecutioner[id] = false
}

public 
zp_fw_core_cure_post(id)
{
    
g_bExecutioner[id] = false
}

public 
fw_PlayerKilled(victimattackershouldgib)
{
    
g_bExecutioner[victim] = false
}

public 
zp_round_ended(winteam)
{
    for (new 
id=1id<=g_maxplayersid++)
        
g_bExecutioner[id] = false
}

public 
client_connect(id)
{
    
g_bExecutioner[id] = false

}
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 (!
g_bExecutioner[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 (!
g_bExecutioner[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)
{

g_bExecutioner[id] = false
zp_colored_print
(id"^x04You're fast attack is finished^x01")

}

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

gracias antemano...
wicho is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 05-13-2013 , 15:59   Re: [AYUDA] Agregarle bits a extra item
#2

no merece la pena hacerlo si solo tienes un bool
baneado is offline
BlackFur
BANNED
Join Date: Apr 2012
Location: RCL
Old 05-13-2013 , 16:03   Re: [AYUDA] Agregarle bits a extra item
#3

igual se podria usar el task como la variable :I
BlackFur is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 05-13-2013 , 18:46   Re: [AYUDA] Agregarle bits a extra item
#4

Porque no vale la pena hacerlo con un bool?
wicho is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 05-13-2013 , 20:31   Re: [AYUDA] Agregarle bits a extra item
#5

Quote:
Originally Posted by wicho View Post
Porque no vale la pena hacerlo con un bool?
cumplen la misma funcion.
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 05-14-2013 , 11:27   Re: [AYUDA] Agregarle bits a extra item
#6

Quote:
Originally Posted by Roccoxx View Post
cumplen la misma funcion.
Está mal tu concepto, un conjunto de bits puede funcionar como bool. Pero un bool no puede funcionar como un conjunto de bits, ya que se pueden hacer infinidad de cosas con bits.

Respondiendo al problema planteado por el OP, ¿Para qué quieres cambiar algo que ya funciona por otra cosa si jamás notarás el cambio de rendimiento (en este caso)?
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 05-14-2013 , 12:04   Re: [AYUDA] Agregarle bits a extra item
#7

Porque quiero aprender como usar los bits en un ejemplo, ya se que funciona solo quiero ver como seria en bits para aprender un poco mas de ese tema..
wicho is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 05-14-2013 , 12:06   Re: [AYUDA] Agregarle bits a extra item
#8

https://forums.alliedmods.net/showthread.php?t=205032
baneado is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 05-14-2013 , 12:44   Re: [AYUDA] Agregarle bits a extra item
#9

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
Está mal tu concepto, un conjunto de bits puede funcionar como bool. Pero un bool no puede funcionar como un conjunto de bits, ya que se pueden hacer infinidad de cosas con bits.

Respondiendo al problema planteado por el OP, ¿Para qué quieres cambiar algo que ya funciona por otra cosa si jamás notarás el cambio de rendimiento (en este caso)?
a eso me referia, que es lo que quiere hacer el en este caso.
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
 



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:08.


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