AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Issue with CHEGrenade::SecondaryAttack (https://forums.alliedmods.net/showthread.php?t=206779)

CVarsMaster 01-25-2013 23:03

Issue with CHEGrenade::SecondaryAttack
 
On windows this works rights, pressing the right click I can execute the related function, but on linux it just works 1 time and after that I ALSO can't throw a nade, but on windows it works like a charm

PHP Code:

// CBasePlayerItem
const XO_CBASEPLAYERITEM 4
const m_pPlayer 41

// CBasePlayer
const XO_CBASEPLAYER 5
const m_pClientActiveItem =     374

// CBaseMonster
const XO_CBASEMONSTER 5
const m_flNextAttack 83

// CBaseEntity
const XO_CBASEENTITY 3
const m_flStartThrow 30

// CBasePlayerWeapon
const XO_CBASEPLAYERWEAPON 4
const m_flNextSecondaryAttack 47

// plugin_init:
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_hegrenade""OnHESecondaryAttack")

public 
OnHESecondaryAttack(hegrenade)
{
    if(
get_pdata_float(hegrenadem_flStartThrowXO_CBASEENTITY) > 0.0// is this right? trying to check if grenade is not ready to throw
        
return HAM_IGNORED
        
    
new id get_pdata_cbase(hegrenadem_pPlayerXO_CBASEPLAYERITEM)
    
    if(!(
<= id <= g_maxplayers))
        return 
HAM_IGNORED
    
    ExecuteHamB
(Ham_Item_Holsterhegrenade0// trying to do a weapon switch
    
set_pdata_cbase(idm_pClientActiveItem, -1XO_CBASEPLAYERWEAPON)
    
ExecuteHamB(Ham_Item_Deployhegrenade)
    
    
set_pdata_float(idm_flNextAttack0.3XO_CBASEMONSTER// a delay of 0.3
    
set_pdata_float(hegrenadem_flNextSecondaryAttack0.3XO_CBASEPLAYERWEAPON)
    
    
client_print(idprint_center"Pressed the button at %.2f"get_gametime())
    
    return 
HAM_SUPERCEDE// prevent supposed shield functions


EDIT: I've noticed that i set the wrong linux offset for ClientActiveItem, i was reseting ActiveItem and that was causing that i wasn't able to throw and those things. Thanks anyway

Arkshine 01-26-2013 04:08

Re: Issue with CHEGrenade::SecondaryAttack
 
m_pClientActiveItem +5
m_flNextAttack + 5


All times are GMT -4. The time now is 20:33.

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